From dd8569823d97ef243661bf46400c0a92f2ae79e5 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 7 Mar 2023 13:04:03 -0800 Subject: SL-19128: Fix adding material to face sometimes not respecting protections --- indra/newview/llselectmgr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 55cf6795fe..30a7f34ea8 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1938,6 +1938,12 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) LLUUID asset_id = mMatId; if (mItem) { + // If success, the material may be copied into the object's inventory + BOOL success = LLToolDragAndDrop::handleDropMaterialProtections(objectp, mItem, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); + if (!success) + { + return false; + } asset_id = mItem->getAssetUUID(); } -- cgit v1.2.3 From baed7a64049901c6756180450da7692891bceb6f Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 7 Mar 2023 14:31:17 -0800 Subject: SL-19128: Cleanup --- indra/newview/llselectmgr.cpp | 48 +++++++++++-------------------------------- 1 file changed, 12 insertions(+), 36 deletions(-) (limited to 'indra') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 30a7f34ea8..a5f857395a 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1847,21 +1847,11 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) } if (mItem) { - if (te == -1) // all faces - { - LLToolDragAndDrop::dropTextureAllFaces(objectp, - mItem, - LLToolDragAndDrop::SOURCE_AGENT, - LLUUID::null); - } - else // one face - { - LLToolDragAndDrop::dropTextureOneFace(objectp, - te, - mItem, - LLToolDragAndDrop::SOURCE_AGENT, - LLUUID::null); - } + LLToolDragAndDrop::dropTextureOneFace(objectp, + te, + mItem, + LLToolDragAndDrop::SOURCE_AGENT, + LLUUID::null); } else // not an inventory item { @@ -1931,21 +1921,14 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) f(LLViewerInventoryItem* item, const LLUUID& id) : mItem(item), mMatId(id) {} bool apply(LLViewerObject* objectp, S32 te) { - if (objectp && !objectp->permModify()) - { - return false; - } LLUUID asset_id = mMatId; - if (mItem) + // If success, the material may be copied into the object's inventory + BOOL success = LLToolDragAndDrop::handleDropMaterialProtections(objectp, mItem, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); + if (!success) { - // If success, the material may be copied into the object's inventory - BOOL success = LLToolDragAndDrop::handleDropMaterialProtections(objectp, mItem, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); - if (!success) - { - return false; - } - asset_id = mItem->getAssetUUID(); + return false; } + asset_id = mItem->getAssetUUID(); // Blank out most override data on the object and send to server objectp->setRenderMaterialID(te, asset_id); @@ -1954,15 +1937,8 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) } }; - if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) - { - getSelection()->applyNoCopyPbrMaterialToTEs(item); - } - else - { - f setfunc(item, mat_id); - getSelection()->applyToTEs(&setfunc); - } + f setfunc(item, mat_id); + getSelection()->applyToTEs(&setfunc); struct g : public LLSelectedObjectFunctor { -- cgit v1.2.3 From f2c49654d84113ab1be426cf5b9f6d03ffebaff3 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 7 Mar 2023 14:49:44 -0800 Subject: Revert "SL-19128: Cleanup" This reverts commit baed7a64049901c6756180450da7692891bceb6f. --- indra/newview/llselectmgr.cpp | 48 ++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index a5f857395a..30a7f34ea8 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1847,11 +1847,21 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) } if (mItem) { - LLToolDragAndDrop::dropTextureOneFace(objectp, - te, - mItem, - LLToolDragAndDrop::SOURCE_AGENT, - LLUUID::null); + if (te == -1) // all faces + { + LLToolDragAndDrop::dropTextureAllFaces(objectp, + mItem, + LLToolDragAndDrop::SOURCE_AGENT, + LLUUID::null); + } + else // one face + { + LLToolDragAndDrop::dropTextureOneFace(objectp, + te, + mItem, + LLToolDragAndDrop::SOURCE_AGENT, + LLUUID::null); + } } else // not an inventory item { @@ -1921,14 +1931,21 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) f(LLViewerInventoryItem* item, const LLUUID& id) : mItem(item), mMatId(id) {} bool apply(LLViewerObject* objectp, S32 te) { - LLUUID asset_id = mMatId; - // If success, the material may be copied into the object's inventory - BOOL success = LLToolDragAndDrop::handleDropMaterialProtections(objectp, mItem, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); - if (!success) + if (objectp && !objectp->permModify()) { return false; } - asset_id = mItem->getAssetUUID(); + LLUUID asset_id = mMatId; + if (mItem) + { + // If success, the material may be copied into the object's inventory + BOOL success = LLToolDragAndDrop::handleDropMaterialProtections(objectp, mItem, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); + if (!success) + { + return false; + } + asset_id = mItem->getAssetUUID(); + } // Blank out most override data on the object and send to server objectp->setRenderMaterialID(te, asset_id); @@ -1937,8 +1954,15 @@ void LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id) } }; - f setfunc(item, mat_id); - getSelection()->applyToTEs(&setfunc); + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) + { + getSelection()->applyNoCopyPbrMaterialToTEs(item); + } + else + { + f setfunc(item, mat_id); + getSelection()->applyToTEs(&setfunc); + } struct g : public LLSelectedObjectFunctor { -- cgit v1.2.3 From ac224dc8b41fa23e30c87a53ca121a55d99cee14 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 7 Mar 2023 14:50:25 -0800 Subject: SL-19128: More conservative cleanup --- indra/newview/llselectmgr.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 30a7f34ea8..22c1176b05 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1847,21 +1847,11 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) } if (mItem) { - if (te == -1) // all faces - { - LLToolDragAndDrop::dropTextureAllFaces(objectp, - mItem, - LLToolDragAndDrop::SOURCE_AGENT, - LLUUID::null); - } - else // one face - { - LLToolDragAndDrop::dropTextureOneFace(objectp, - te, - mItem, - LLToolDragAndDrop::SOURCE_AGENT, - LLUUID::null); - } + LLToolDragAndDrop::dropTextureOneFace(objectp, + te, + mItem, + LLToolDragAndDrop::SOURCE_AGENT, + LLUUID::null); } else // not an inventory item { -- cgit v1.2.3