diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-10-27 21:35:46 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2022-10-27 21:35:46 +0300 |
commit | 414efe56bdf061edddd9026b015f6197c7615577 (patch) | |
tree | 932f6451a7b332f2af2c3e2cbb80bf2a2c2b2005 /indra/newview/llviewermenu.cpp | |
parent | 6860df0b981a0fa656bc21c98137dd2395578670 (diff) |
SL-18008 Edit PBR in menu should not be enabled if selection has no pbr materials
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r-- | indra/newview/llviewermenu.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e1b92e5f2e..3161579482 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2809,37 +2809,39 @@ void handle_object_open() LLFloaterReg::showInstance("openobject"); } -struct LLSelectedTEGetmatIdAndPermissions : public LLSelectedTEGetFunctor<LLUUID> +struct LLSelectedTEGetmatIdAndPermissions : public LLSelectedTEFunctor { LLSelectedTEGetmatIdAndPermissions() : mCanCopy(true), mCanModify(true), mCanTransfer(true) {} - LLUUID get(LLViewerObject* object, S32 te_index) + bool apply(LLViewerObject* objectp, S32 te_index) { - mCanCopy &= (bool)object->permCopy(); - mCanTransfer &= (bool)object->permTransfer(); - mCanModify &= (bool)object->permModify(); - // return true if all ids are identical - return object->getRenderMaterialID(te_index); + mCanCopy &= (bool)objectp->permCopy(); + mCanTransfer &= (bool)objectp->permTransfer(); + mCanModify &= (bool)objectp->permModify(); + LLUUID mat_id = objectp->getRenderMaterialID(te_index); + if (mat_id.notNull()) + { + mMaterialId = mat_id; + } + return true; } bool mCanCopy; bool mCanModify; bool mCanTransfer; + LLUUID mMaterialId; }; bool enable_object_edit_gltf_material() { LLSelectedTEGetmatIdAndPermissions func; - LLUUID mat_id; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat_id); - - return func.mCanModify; + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); + return func.mCanModify && func.mMaterialId.notNull(); } bool enable_object_save_gltf_material() { LLSelectedTEGetmatIdAndPermissions func; - LLUUID mat_id; - LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&func, mat_id); - return func.mCanCopy && mat_id.notNull(); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); + return func.mCanCopy && func.mMaterialId.notNull(); } bool enable_object_open() |