summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-12-16 18:49:26 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-12-16 19:32:38 +0200
commite07e31af1c8e0c56e5c2e7b91f1f707cc57180f3 (patch)
treeb91f0832e7fdaeb2c0bcc26fc3ed056ffa30ff02 /indra/newview
parentd27d23ab269f6d22483c4b4dc1db1664cf3e441e (diff)
SL-18854 Prevent texture drop onto faces that have pbr
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lltooldraganddrop.cpp54
1 files changed, 49 insertions, 5 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 3f45d4f0da..5c4f7f75bf 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1047,6 +1047,20 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
LL_WARNS() << "LLToolDragAndDrop::dropTextureAllFaces no texture item." << LL_ENDL;
return;
}
+ S32 num_faces = hit_obj->getNumTEs();
+ bool has_non_pbr_faces = false;
+ for (S32 face = 0; face < num_faces; face++)
+ {
+ if (hit_obj->getRenderMaterialID(face).isNull())
+ {
+ has_non_pbr_faces = true;
+ break;
+ }
+ }
+ if (!has_non_pbr_faces)
+ {
+ return;
+ }
LLUUID asset_id = item->getAssetUUID();
BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
if (!success)
@@ -1055,13 +1069,14 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
}
LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
add(LLStatViewer::EDIT_TEXTURE, 1);
- S32 num_faces = hit_obj->getNumTEs();
for( S32 face = 0; face < num_faces; face++ )
{
-
- // update viewer side image in anticipation of update from simulator
- hit_obj->setTEImage(face, image);
- dialog_refresh_all();
+ if (hit_obj->getRenderMaterialID(face).isNull())
+ {
+ // update viewer side image in anticipation of update from simulator
+ hit_obj->setTEImage(face, image);
+ dialog_refresh_all();
+ }
}
// send the update to the simulator
hit_obj->sendTEUpdate();
@@ -1167,6 +1182,10 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
LL_WARNS() << "LLToolDragAndDrop::dropTextureOneFace no texture item." << LL_ENDL;
return;
}
+ if (hit_obj->getRenderMaterialID(hit_face).notNull())
+ {
+ return;
+ }
LLUUID asset_id = item->getAssetUUID();
BOOL success = handleDropMaterialProtections(hit_obj, item, source, src_id);
if (!success)
@@ -2032,6 +2051,31 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject(
return ACCEPT_NO;
}
+ if (cargo_type == DAD_TEXTURE)
+ {
+ if ((mask & MASK_SHIFT))
+ {
+ S32 num_faces = obj->getNumTEs();
+ bool has_non_pbr_faces = false;
+ for (S32 face = 0; face < num_faces; face++)
+ {
+ if (obj->getRenderMaterialID(face).isNull())
+ {
+ has_non_pbr_faces = true;
+ break;
+ }
+ }
+ if (!has_non_pbr_faces)
+ {
+ return ACCEPT_NO;
+ }
+ }
+ else if (obj->getRenderMaterialID(face).notNull())
+ {
+ return ACCEPT_NO;
+ }
+ }
+
if(drop && (ACCEPT_YES_SINGLE <= rv))
{
if (cargo_type == DAD_TEXTURE)