summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lltooldraganddrop.cpp96
1 files changed, 58 insertions, 38 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index bfa9386cd4..2a17882ff1 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1077,51 +1077,71 @@ void set_texture_to_material(LLViewerObject* hit_obj,
LLGLTFMaterial::TextureInfo drop_channel)
{
LLTextureEntry* te = hit_obj->getTE(hit_face);
- if (te)
+ if (!te)
{
- LLPointer<LLGLTFMaterial> material = te->getGLTFMaterialOverride();
+ return;
+ }
- // make a copy to not invalidate existing
- // material for multiple objects
- if (material.isNull())
- {
- // Start with a material override which does not make any changes
- material = new LLGLTFMaterial();
- }
- else
- {
- material = new LLGLTFMaterial(*material);
- }
+ const LLUUID base_mat_id = hit_obj->getRenderMaterialID(hit_face);
+ if (base_mat_id.isNull())
+ {
+ return;
+ }
- switch (drop_channel)
- {
- case LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR:
- default:
- {
- material->setBaseColorId(asset_id);
- }
- break;
+ if (hit_obj->isInventoryDirty() && hit_obj->hasInventoryListeners())
+ {
+ hit_obj->requestInventory();
+ return;
+ }
- case LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS:
- {
- material->setOcclusionRoughnessMetallicId(asset_id);
- }
- break;
+ LLViewerInventoryItem* mat_item = hit_obj->getInventoryItemByAsset(base_mat_id);
+ if (mat_item && !mat_item->getPermissions().allowModifyBy(gAgentID))
+ {
+ return;
+ }
- case LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE:
- {
- material->setEmissiveId(asset_id);
- }
- break;
+ LLPointer<LLGLTFMaterial> material = te->getGLTFMaterialOverride();
- case LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL:
- {
- material->setNormalId(asset_id);
- }
- break;
- }
- LLGLTFMaterialList::queueModify(hit_obj, hit_face, material);
+ // make a copy to not invalidate existing
+ // material for multiple objects
+ if (material.isNull())
+ {
+ // Start with a material override which does not make any changes
+ material = new LLGLTFMaterial();
+ }
+ else
+ {
+ material = new LLGLTFMaterial(*material);
+ }
+
+ switch (drop_channel)
+ {
+ case LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR:
+ default:
+ {
+ material->setBaseColorId(asset_id);
+ }
+ break;
+
+ case LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS:
+ {
+ material->setOcclusionRoughnessMetallicId(asset_id);
+ }
+ break;
+
+ case LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE:
+ {
+ material->setEmissiveId(asset_id);
+ }
+ break;
+
+ case LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL:
+ {
+ material->setNormalId(asset_id);
+ }
+ break;
}
+ LLGLTFMaterialList::queueModify(hit_obj, hit_face, material);
}
void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,