summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llmaterialeditor.cpp27
-rw-r--r--indra/newview/llmaterialeditor.h2
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);