From 1a39876c64be99456291724bb539e71344962ab5 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Mon, 6 May 2013 10:19:55 -0700 Subject: NORSPEC-94 fix this without setting in getState causing round-trip wierdness with spec color picker --- indra/newview/llpanelface.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 74b1915cac..1fbf4a39e6 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1297,6 +1297,7 @@ void LLPanelFace::getState() mColorSwatch->setEnabled( editable ); mColorSwatch->setCanApplyImmediately( editable ); } + // Color transparency { getChildView("color trans")->setEnabled(editable); @@ -1363,14 +1364,10 @@ void LLPanelFace::getState() getChild("shinycolorswatch")->setTentative(!identical); getChildView("label shinycolor")->setEnabled(editable); } - // NORSPEC-94: Set default specular color to white (will get - // overwritten from material when loaded) + LLColorSwatchCtrl* mShinyColorSwatch = getChild("shinycolorswatch"); - color = LLColor4::white; if(mShinyColorSwatch) { - mShinyColorSwatch->setOriginal(color); - mShinyColorSwatch->set(color, TRUE); mShinyColorSwatch->setValid(editable); mShinyColorSwatch->setEnabled( editable ); mShinyColorSwatch->setCanApplyImmediately( editable ); @@ -1716,13 +1713,20 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild("shinyRot")->setValue(rot*RAD_TO_DEG); getChild("shinyOffsetU")->setValue(offset_x); getChild("shinyOffsetV")->setValue(offset_y); - getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); - getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); getChild("glossiness")->setValue(material->getSpecularLightExponent()); getChild("environment")->setValue(material->getEnvironmentIntensity()); } updateShinyControls(combobox_shininess,this, true); + // Assert desired colorswatch color to match material AFTER updateShinyControls + // to avoid getting overwritten with the default on some UI state changes. + // + if (!material->getSpecularID().isNull()) + { + getChild("shinycolorswatch")->setOriginal(material->getSpecularLightColor()); + getChild("shinycolorswatch")->set(material->getSpecularLightColor(),TRUE); + } + // Bumpy (normal) texture_ctrl = getChild("bumpytexture control"); texture_ctrl->setImageAssetID(material->getNormalID()); @@ -2097,6 +2101,18 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ if (!comboShiny->itemExists(USE_TEXTURE)) { comboShiny->add(USE_TEXTURE); + + // NORSPEC-94: Set default specular color to white + // + LLColorSwatchCtrl* mShinyColorSwatch = self->getChild("shinycolorswatch"); + if(mShinyColorSwatch) + { + // Doing sets in a getState func causes the 'blinking updates' of swatch colors....DON'T. + // + LL_DEBUGS("Materials") << "Resetting specular color to default of white" << LL_ENDL; + mShinyColorSwatch->setOriginal(LLColor4::white); + mShinyColorSwatch->set(LLColor4::white, TRUE); + } } comboShiny->setSimple(USE_TEXTURE); } -- cgit v1.2.3