summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-18 20:12:38 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-18 20:13:08 +0300
commit7be33594eaab6b9c0da863778bbdacdb8cbe7838 (patch)
treef4e7273ba497092717738e301d56052b59718f16 /indra/newview/llviewermenu.cpp
parentf20c47a5968c82b1627139537e07a2ae67f64b24 (diff)
SL-18008 Updated Save and Edit PBR buttons
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp86
1 files changed, 29 insertions, 57 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 8a92d9062f..ffa104230e 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2782,47 +2782,36 @@ void handle_object_open()
LLFloaterReg::showInstance("openobject");
}
-bool enable_object_edit_gltf_material()
+struct LLSelectedTEGetmatIdAndPermissions : public LLSelectedTEGetFunctor<LLUUID>
{
- struct LLSelectedTEGetmatId : public LLSelectedTEGetFunctor<LLUUID>
+ LLSelectedTEGetmatIdAndPermissions() : mCanCopy(true), mCanModify(true), mCanTransfer(true) {}
+ LLUUID get(LLViewerObject* object, S32 te_index)
{
- LLSelectedTEGetmatId() : mCanModify(true) {}
- LLUUID get(LLViewerObject* object, S32 te_index)
- {
- mCanModify &= (bool)object->permModify();
- // Todo: probabnly should compare material
- // pointers instead
- return object->getRenderMaterialID(te_index);
- }
- bool mCanModify;
- } func;
+ mCanCopy &= (bool)object->permCopy();
+ mCanTransfer &= (bool)object->permTransfer();
+ mCanModify &= (bool)object->permModify();
+ // return true if all ids are identical
+ return object->getRenderMaterialID(te_index);
+ }
+ bool mCanCopy;
+ bool mCanModify;
+ bool mCanTransfer;
+};
+
+bool enable_object_edit_gltf_material()
+{
+ LLSelectedTEGetmatIdAndPermissions func;
LLUUID mat_id;
- bool identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat_id);
- LL_INFOS() << " Placeholder " << identical << " " << mat_id << LL_ENDL;
- // Todo: this is a placeholder for overrides,
- // it will have to make sure all selection is identical
+ LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat_id);
+
return func.mCanModify;
}
bool enable_object_save_gltf_material()
{
- struct LLSelectedTEGetmatId : public LLSelectedTEGetFunctor<LLUUID>
- {
- LLSelectedTEGetmatId() : mCanCopy(true) {}
- LLUUID get(LLViewerObject* object, S32 te_index)
- {
- mCanCopy &= (bool)object->permCopy();
- // permTransfer probably should be passed to editor instead
- mCanCopy &= (bool)object->permTransfer();
- return object->getRenderMaterialID(te_index);
- }
- bool mCanCopy;
- } func;
+ LLSelectedTEGetmatIdAndPermissions func;
LLUUID mat_id;
- bool identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat_id);
- LL_INFOS() << " Placeholder " << identical << " " << mat_id << LL_ENDL;
- // Todo: this is a placeholder for overrides,
- // it will have to make sure all selection is identical
+ LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat_id);
return func.mCanCopy;
}
@@ -2942,38 +2931,21 @@ void handle_object_edit()
void load_life_gltf_material(bool copy)
{
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- // All materials are supposed to be identical, so pcik any node
- LLViewerObject* object = selection->getFirstNode()->getObject();
- if (!object)
- {
- return;
- }
+ update_camera();
- // This functionality is a plcaholder for overrides
- // so id doesn't load object by id, but instead gets material directly
- LLGLTFMaterial * mat = NULL;
+ LLSelectedTEGetmatIdAndPermissions func;
+ LLUUID mat_id;
+ LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat_id);
- const S32 num_tes = llmin((S32)object->getNumTEs(), (S32)object->getNumFaces()); // avatars have TEs but no faces
- for (S32 face = 0; face < num_tes; ++face)
+ if (copy)
{
- LLTextureEntry *te = object->getTE(face);
- if (te->isSelected())
- {
- mat = te->getGLTFMaterial();
- break;
- }
+ LLMaterialEditor::loadFromGLTFMaterial(mat_id);
}
-
- if (mat == NULL)
+ else
{
- return;
+ LLMaterialEditor::loadLiveMaterial(mat_id);
}
- update_camera();
-
- LLMaterialEditor::loadLiveMaterial(mat, copy);
-
LLViewerJoystick::getInstance()->moveObjects(true);
LLViewerJoystick::getInstance()->setNeedsReset(true);
}