diff options
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rwxr-xr-x | indra/newview/llpanelface.cpp | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index d0eea6eb9b..49750c8c19 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -318,16 +318,18 @@ void LLPanelFace::sendTexGen() void LLPanelFace::sendShiny(U32 shininess) { + LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); + if (shininess < SHINY_TEXTURE) - { - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); + { texture_ctrl->clear(); texture_ctrl->setImageAssetID(LLUUID()); + + U8 shiny = (U8) shininess & TEM_SHINY_MASK; + LLSelectMgr::getInstance()->selectionSetShiny( shiny ); } - U8 shiny = (U8) shininess & TEM_SHINY_MASK; - LLSelectMgr::getInstance()->selectionSetShiny( shiny ); - updateShinyControls(shininess == SHINY_TEXTURE, true); + updateShinyControls(!texture_ctrl->getImageAssetID().isNull(), true); updateMaterial(); } @@ -686,6 +688,25 @@ void LLPanelFace::updateUI() getChildView("ColorTrans")->setEnabled(editable); } + // Specular map + struct spec_get : public LLSelectedTEGetFunctor<LLUUID> + { + LLUUID get(LLViewerObject* object, S32 te_index) + { + LLUUID id; + + LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); + + if (mat) + { + id = mat->getSpecularID(); + } + + return id; + } + } spec_get_func; + identical_spec = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ); + U8 shiny = 0; // Shiny @@ -701,6 +722,9 @@ void LLPanelFace::updateUI() LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); + + shiny = specmap_id.isNull() ? shiny : SHINY_TEXTURE; + if (combobox_shininess) { combobox_shininess->selectNthItem((S32)shiny); @@ -813,28 +837,6 @@ void LLPanelFace::updateUI() if (bumpy != BUMPY_TEXTURE) normmap_id = LLUUID::null; - // Specular map - struct spec_get : public LLSelectedTEGetFunctor<LLUUID> - { - LLUUID get(LLViewerObject* object, S32 te_index) - { - LLUUID id; - - LLMaterial* mat = object->getTE(te_index)->getMaterialParams().get(); - - if (mat) - { - id = mat->getSpecularID(); - } - - return id; - } - } spec_get_func; - identical_spec = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &spec_get_func, specmap_id ); - - if (shiny != SHINY_TEXTURE) - specmap_id = LLUUID::null; - mIsAlpha = FALSE; LLGLenum image_format; struct f2 : public LLSelectedTEGetFunctor<LLGLenum> @@ -960,7 +962,9 @@ void LLPanelFace::updateUI() if (shinytexture_ctrl && !shinytexture_ctrl->isPickerShown()) { - if (identical_spec && (shiny == SHINY_TEXTURE)) + // Can't use this test as we can't actually store SHINY_TEXTURE in the TEs *sigh* + // + if (identical_spec /*&& (shiny == SHINY_TEXTURE)*/) { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); @@ -1534,7 +1538,7 @@ void LLPanelFace::updateUI() BOOL identical = true; F32 repeats = 1.0f; - U32 material_type = combobox_mattype->getCurrentIndex(); + U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? combobox_mattype->getCurrentIndex() : MATTYPE_DIFFUSE; switch (material_type) { default: @@ -1850,7 +1854,7 @@ void LLPanelFace::updateMaterial() LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); - if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) + if (!spec_map_id.isNull() && (shininess == SHINY_TEXTURE)) { LL_DEBUGS("Materials") << "Setting shiny texture, shininess = " << shininess << LL_ENDL; material->setSpecularID(spec_map_id); @@ -2276,6 +2280,7 @@ void LLPanelFace::onCommitNormalTexture( const LLSD& data ) void LLPanelFace::onCancelSpecularTexture(const LLSD& data) { + U8 shiny = 0; struct get_shiny : public LLSelectedTEGetFunctor<U8> { @@ -2285,6 +2290,9 @@ void LLPanelFace::onCancelSpecularTexture(const LLSD& data) } } func; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, shiny ); + + LLUUID spec_map_id = getChild<LLTextureCtrl>("shinytexture control")->getImageAssetID(); + shiny = spec_map_id.isNull() ? shiny : SHINY_TEXTURE; sendShiny(shiny); } |