diff options
author | Graham Madarasz <graham@lindenlab.com> | 2013-06-07 14:17:13 -0700 |
---|---|---|
committer | Graham Madarasz <graham@lindenlab.com> | 2013-06-07 14:17:13 -0700 |
commit | af0cc77199f22c223fcdfb8b46241fb6b81e8e27 (patch) | |
tree | 2a8c0ebb083b25d593581dd5ad541c21be354848 /indra/newview | |
parent | b15cdc828ea188f278b3ffec4e6442cb4688901d (diff) |
NORSPEC-233 WIP cleanup and fix crasher in templated material get driver func
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llpanelface.cpp | 74 | ||||
-rwxr-xr-x | indra/newview/llpanelface.h | 16 |
2 files changed, 15 insertions, 75 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7ab9b4cb38..51d1f82603 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1402,76 +1402,6 @@ void LLPanelFace::refresh() getState(); } -/* -void LLPanelFace::updateMaterialParams(LLMaterialEditFunctorBase* edit_func) -{ - if (!edit_func) - return; - - struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor - { - LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctorBase* edit) : _panel(panel), _edit(edit) {}; - virtual ~LLSelectedTEEditMaterial() {}; - virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) - { - if (_edit) - { - // Yesterday's news... - // - //U32 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); - //LLUUID old_normal_map_id = _panel->getCurrentNormalMap(); - //LLUUID old_spec_map_id = _panel->getCurrentSpecularMap(); - //bool was_default_blend_mode = (current_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); - //bool was_need_material = !was_default_blend_mode || !old_normal_map_id.isNull() || !old_spec_map_id.isNull(); - - LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial()); - llassert_always(new_material); - - // Do "It"! - // - _edit->apply(new_material); - - U32 new_alpha_mode = new_material->getDiffuseAlphaMode(); - LLUUID new_normal_map_id = new_material->getNormalID(); - LLUUID new_spec_map_id = new_material->getSpecularID(); - - bool is_default_blend_mode = (new_alpha_mode == (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE)); - bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull(); - - if (!current_material.isNull() && !is_need_material) - { - LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL; - LLMaterialMgr::getInstance()->remove(object->getID(),face); - } - else - { - // Replicate old init behavior - // - if (current_material.isNull()) - { - U8 current_alpha_mode = _panel->getCurrentDiffuseAlphaMode(); - U8 current_alpha_mask_cutoff = _panel->getCurrentAlphaMaskCutoff(); - - new_material->setDiffuseAlphaMode(current_alpha_mode); - new_material->setAlphaMaskCutoff(current_alpha_mask_cutoff); - } - - LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL; - LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material); - } - - object->setTEMaterialParams(face, new_material); - return new_material; - } - return NULL; - } - LLMaterialEditFunctorBase* _edit; - LLPanelFace* _panel; - } editor(this, edit_func); - LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor); -} -*/ - // // Static functions // @@ -1513,10 +1443,6 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLUUID specmap = self->getCurrentSpecularMap(); - LLUUID normmap = self->getCurrentNormalMap(); - self->updateShinyControls(!specmap.isNull(), true); - self->updateBumpyControls(!normmap.isNull(), true); self->updateUI(); } diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index c178ed783f..d76d940d5c 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -287,7 +287,21 @@ private: { struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType> { - DataType get(LLViewerObject* object, S32 face) { return (object && object->getTE(face)) ? ((object->getTE(face)->getMaterialParams()->*(MaterialGetFunc))()) : DataType(); } + DataType get(LLViewerObject* object, S32 face) + { + DataType ret = DataType(); + LLMaterialPtr material_ptr; + LLTextureEntry* tep = object ? object->getTE(face) : NULL; + if (tep) + { + material_ptr = object->getTE(face)->getMaterialParams(); + if (!material_ptr.isNull()) + { + ret = (material_ptr->*(MaterialGetFunc))(); + } + } + return ret; + } } GetFunc; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_to_return); } |