diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-10-17 23:33:27 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-10-17 23:33:27 +0300 |
commit | a27e701530e3498f71b828d7639024330cd0ccb7 (patch) | |
tree | 3d54a904e2bd92c6d556c18ecde146b0855b0b89 /indra/newview/llmaterialeditor.cpp | |
parent | 5fc91f6911ec2e2749ac26766595840b34807875 (diff) |
SL-18008 Add Save and Edit buttons to right click menu for materials
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index c23f9ec4e7..80a0583fd0 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1401,6 +1401,16 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind } } +void LLMaterialEditor::loadLiveMaterial(LLGLTFMaterial * material, bool make_copy) +{ + if (!material) + { + return; + } + LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + me->loadMaterial(material, make_copy); +} + void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename_lc, S32 index) { if (model_in.materials.size() <= index) @@ -1505,6 +1515,40 @@ void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std:: applyToSelection(); } +void LLMaterialEditor::loadMaterial(LLGLTFMaterial * material, bool make_copy) +{ + setBaseColorId(material->mBaseColorId); + setMetallicRoughnessId(material->mMetallicRoughnessId); + setEmissiveId(material->mEmissiveId); + setNormalId(material->mNormalId); + + setAlphaMode(material->getAlphaMode()); + setAlphaCutoff(material->mAlphaCutoff); + + setBaseColor(material->mBaseColor); + setEmissiveColor(material->mEmissiveColor); + + setMetalnessFactor(material->mMetallicFactor); + setRoughnessFactor(material->mRoughnessFactor); + + setDoubleSided(material->mDoubleSided); + + if (make_copy) + { + setTitle(LLTrans::getString("New Material")); + } + // else ??? Think of a name for live editing + + // Todo: At the moment it always makes a 'copy' + // Will need a way to expand existing material + // once overrides are done + + setHasUnsavedChanges(make_copy); + + openFloater(); + setFocus(TRUE); +} + bool LLMaterialEditor::setFromGltfModel(const tinygltf::Model& model, S32 index, bool set_textures) { if (model.materials.size() > index) |