diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llpanelface.cpp | 90 | ||||
-rwxr-xr-x | indra/newview/llpanelface.h | 13 |
2 files changed, 64 insertions, 39 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 877c7743fa..9c40ff06cc 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -158,9 +158,9 @@ BOOL LLPanelFace::postBuild() if(mShinyTextureCtrl) { mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); - mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); - mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); - mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) ); + mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) ); mShinyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mShinyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mShinyTextureCtrl->setFollowsTop(); @@ -173,9 +173,9 @@ BOOL LLPanelFace::postBuild() if(mBumpyTextureCtrl) { mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" ))); - mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitMaterialTexture, this, _2) ); - mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelMaterialTexture, this, _2) ); - mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectMaterialTexture, this, _2) ); + mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) ); + mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) ); mBumpyTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, this, _2)); mBumpyTextureCtrl->setOnTextureSelectedCallback(boost::bind(&LLPanelFace::onTextureSelectionChanged, this, _1)); mBumpyTextureCtrl->setFollowsTop(); @@ -303,14 +303,14 @@ void LLPanelFace::sendBump() LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); bumpytexture_ctrl->clear(); LLSD dummy_data; - onSelectMaterialTexture(dummy_data); + onSelectNormalTexture(dummy_data); } U8 bump = (U8) bumpiness & TEM_BUMP_MASK; LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); //refresh material state (in case this change impacts material params) LLSD dummy_data; - onCommitMaterialTexture(dummy_data); + onCommitNormalTexture(dummy_data); } void LLPanelFace::sendTexGen() @@ -333,6 +333,10 @@ void LLPanelFace::sendShiny() } U8 shiny = (U8) shininess & TEM_SHINY_MASK; LLSelectMgr::getInstance()->selectionSetShiny( shiny ); + + //refresh material state (in case this change impacts material params) + LLSD dummy_data; + onCommitSpecularTexture(dummy_data); } void LLPanelFace::sendFullbright() @@ -1716,7 +1720,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild<LLUICtrl>("glossiness")->setValue(material->getSpecularLightExponent()); getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity()); } - updateShinyControls(combobox_shininess,this, true); + updateShinyControls(combobox_shininess,this, !material->getSpecularID().isNull(), true); // Assert desired colorswatch color to match material AFTER updateShinyControls // to avoid getting overwritten with the default on some UI state changes. @@ -1749,7 +1753,7 @@ void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMate getChild<LLUICtrl>("bumpyOffsetU")->setValue(offset_x); getChild<LLUICtrl>("bumpyOffsetV")->setValue(offset_y); } - updateBumpyControls(combobox_bumpiness,this, true); + updateBumpyControls(combobox_bumpiness,this, !material->getNormalID().isNull(), true); } void LLPanelFace::updateMaterial() @@ -1820,7 +1824,7 @@ void LLPanelFace::updateMaterial() material_to_set->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger())); LLUUID norm_map_id = getChild<LLTextureCtrl>("bumpytexture control")->getImageAssetID(); - if (!norm_map_id.isNull()) + if (!norm_map_id.isNull() && (bumpiness == BUMPY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting bumpy texture, bumpiness = " << bumpiness << LL_ENDL; material_to_set->setNormalID(norm_map_id); @@ -1850,7 +1854,7 @@ void LLPanelFace::updateMaterial() LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); - if (!spec_map_id.isNull()) + if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; material_to_set->setSpecularID(spec_map_id); @@ -2084,10 +2088,8 @@ void LLPanelFace::onCommitBump(LLUICtrl* ctrl, void* userdata) self->sendBump(); LLComboBox* combo_bumpy = self->getChild<LLComboBox>("combobox bumpiness"); - // Need 'true' here to insure that the 'Use Texture' choice is removed - // when we select something other than a normmap texture - // - updateBumpyControls(combo_bumpy,self, true); + + updateBumpyControls(combo_bumpy,self, false, true); self->updateMaterial(); } @@ -2099,7 +2101,7 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) } // static -void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_shiny_combobox) +void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_shiny_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild<LLTextureCtrl>("shinytexture control"); @@ -2113,7 +2115,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ { return; } - if (!shiny_texture_ID.isNull()) + if (!shiny_texture_ID.isNull() && is_setting_texture) { if (!comboShiny->itemExists(USE_TEXTURE)) { @@ -2124,12 +2126,12 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ LLColorSwatchCtrl* mShinyColorSwatch = self->getChild<LLColorSwatchCtrl>("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); } + self->getChild<LLUICtrl>("glossiness")->setValue(LLMaterial::DEFAULT_SPECULAR_LIGHT_EXPONENT); + self->getChild<LLUICtrl>("environment")->setValue(0); } comboShiny->setSimple(USE_TEXTURE); } @@ -2161,7 +2163,7 @@ void LLPanelFace::updateShinyControls(LLUICtrl* ctrl, void* userdata, bool mess_ } // static -void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_with_combobox) +void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool is_setting_texture, bool mess_with_combobox) { LLPanelFace* self = (LLPanelFace*) userdata; LLTextureCtrl* texture_ctrl = self->getChild<LLTextureCtrl>("bumpytexture control"); @@ -2175,7 +2177,11 @@ void LLPanelFace::updateBumpyControls(LLUICtrl* ctrl, void* userdata, bool mess_ if (mess_with_combobox) { - if (!bumpy_texture_ID.isNull()) + LLTextureCtrl* texture_ctrl = self->getChild<LLTextureCtrl>("bumpytexture control"); + LLUUID bumpy_texture_ID = texture_ctrl->getImageAssetID(); + LL_DEBUGS("Materials") << "texture: " << bumpy_texture_ID << (mess_with_combobox ? "" : " do not") << " update combobox" << LL_ENDL; + + if (!bumpy_texture_ID.isNull() && is_setting_texture) { if (!comboBumpy->itemExists(USE_TEXTURE)) { @@ -2204,7 +2210,7 @@ void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) // Need 'true' here to insure that the 'Use Texture' choice is removed // when we select something other than a spec texture // - updateShinyControls(combo_shiny,self, true); + updateShinyControls(combo_shiny,self, false, true); self->updateMaterial(); } @@ -2298,34 +2304,50 @@ void LLPanelFace::onSelectTexture(const LLSD& data) sendTexture(); } -void LLPanelFace::onCommitMaterialTexture( const LLSD& data ) +void LLPanelFace::onCommitSpecularTexture( const LLSD& data ) { LL_DEBUGS("Materials") << data << LL_ENDL; - updateMaterial(); LLComboBox* combo_shiny = getChild<LLComboBox>("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, true, true); + updateMaterial(); +} + +void LLPanelFace::onCommitNormalTexture( const LLSD& data ) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; LLComboBox* combo_bumpy = getChild<LLComboBox>("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy, this, true, true); + updateMaterial(); } -void LLPanelFace::onCancelMaterialTexture(const LLSD& data) +void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { - // not sure what to do here other than updateMaterial(); LLComboBox* combo_shiny = getChild<LLComboBox>("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, false, true); +} + +void LLPanelFace::onCancelNormalTexture(const LLSD& data) +{ + updateMaterial(); LLComboBox* combo_bumpy = getChild<LLComboBox>("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy,this, false, true); } -void LLPanelFace::onSelectMaterialTexture(const LLSD& data) +void LLPanelFace::onSelectSpecularTexture(const LLSD& data) { LL_DEBUGS("Materials") << data << LL_ENDL; updateMaterial(); LLComboBox* combo_shiny = getChild<LLComboBox>("combobox shininess"); - updateShinyControls(combo_shiny,this, true); + updateShinyControls(combo_shiny,this, true, true); +} + +void LLPanelFace::onSelectNormalTexture(const LLSD& data) +{ + LL_DEBUGS("Materials") << data << LL_ENDL; LLComboBox* combo_bumpy = getChild<LLComboBox>("combobox bumpiness"); - updateBumpyControls(combo_bumpy,this, true); + updateBumpyControls(combo_bumpy,this, true, true); + updateMaterial(); } //static diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 2138319365..7fbeef223b 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -76,9 +76,12 @@ protected: void onCommitTexture(const LLSD& data); void onCancelTexture(const LLSD& data); void onSelectTexture(const LLSD& data); - void onCommitMaterialTexture(const LLSD& data); - void onCancelMaterialTexture(const LLSD& data); - void onSelectMaterialTexture(const LLSD& data); + void onCommitSpecularTexture(const LLSD& data); + void onCancelSpecularTexture(const LLSD& data); + void onSelectSpecularTexture(const LLSD& data); + void onCommitNormalTexture(const LLSD& data); + void onCancelNormalTexture(const LLSD& data); + void onSelectNormalTexture(const LLSD& data); void onCommitColor(const LLSD& data); void onCommitShinyColor(const LLSD& data); void onCommitAlpha(const LLSD& data); @@ -93,8 +96,8 @@ protected: static void onCommitMaterialType( LLUICtrl* ctrl, void* userdata); static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); - static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); - static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool mess_with_combobox = false); + static void updateShinyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false); + static void updateBumpyControls( LLUICtrl* ctrl, void* userdata, bool is_setting_texture = false, bool mess_with_combobox = false); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); static void updateAlphaControls( LLUICtrl* ctrl, void* userdata); static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); |