diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-22 11:01:35 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-22 11:01:35 -0500 |
commit | 7135934e50bf2727c2366687af7427d44483e984 (patch) | |
tree | a63ea03f82028d6896cf30891b9d45c42d54897b /indra/newview | |
parent | 0cd7c3842119f1801872b4db05e17544b4eb7158 (diff) |
SL-18105 Fix for crash when attempting to "Edit PBR Material" when there's no PBR material
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llmaterialeditor.h | 2 |
2 files changed, 19 insertions, 10 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 86efdfcd06..038f4df863 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1404,13 +1404,16 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind void LLMaterialEditor::loadLiveMaterialEditor() { LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD(LIVE_MATERIAL_EDITOR_KEY)); - me->mIsOverride = true; - me->setTitle(me->getString("material_override_title")); - me->childSetVisible("save", false); - me->childSetVisible("save_as", false); - me->setFromSelection(); - me->openFloater(); - me->setFocus(TRUE); + if (me->setFromSelection()) + { + me->mIsOverride = true; + me->setTitle(me->getString("material_override_title")); + me->childSetVisible("save", false); + me->childSetVisible("save_as", false); + + me->openFloater(); + me->setFocus(TRUE); + } } void LLMaterialEditor::loadFromGLTFMaterial(LLUUID &asset_id) @@ -1973,7 +1976,7 @@ void LLMaterialEditor::setFromGLTFMaterial(LLGLTFMaterial* mat) setAlphaCutoff(mat->mAlphaCutoff); } -void LLMaterialEditor::setFromSelection() +bool LLMaterialEditor::setFromSelection() { struct LLSelectedTEGetGLTFRenderMaterial : public LLSelectedTEGetFunctor<LLPointer<LLGLTFMaterial> > { @@ -1985,7 +1988,13 @@ void LLMaterialEditor::setFromSelection() LLPointer<LLGLTFMaterial> mat; LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat); - setFromGLTFMaterial(mat); + if (mat.notNull()) + { + setFromGLTFMaterial(mat); + return true; + } + + return false; } diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 0aaf391431..9cd8bcd88b 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -222,7 +222,7 @@ public: private: void setFromGLTFMaterial(LLGLTFMaterial* mat); - void setFromSelection(); + bool setFromSelection(); void loadMaterial(const tinygltf::Model &model, const std::string &filename_lc, S32 index); |