summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-05-04 22:46:24 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-05-04 22:46:39 +0300
commitf8f119e4a8b6d3c1f106f5e290d1da187fd9aa17 (patch)
tree7446b67edffa7458b3a0c03784925650d2edce59 /indra/newview/llselectmgr.cpp
parent7c1ccdc9a4df24e94ea7ae826446cb3ab5f36c7e (diff)
SL-18932 Canceling material selection only reverts override
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r--indra/newview/llselectmgr.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 045972b7a8..71dcc56197 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2188,8 +2188,8 @@ void LLSelectMgr::selectionRevertGLTFMaterials()
// Enqueue update to server
if (asset_id.notNull())
{
- // Restore overrides
- LLGLTFMaterialList::queueModify(objectp, te, nodep->mSavedGLTFOverrideMaterials[te]);
+ // Restore overrides and base material
+ LLGLTFMaterialList::queueApply(objectp, te, asset_id, nodep->mSavedGLTFOverrideMaterials[te]);
}
else
{
@@ -5797,7 +5797,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data
if (can_copy && can_transfer && node->getObject()->getVolume())
{
uuid_vec_t material_ids;
- gltf_materials_vec_t materials;
+ gltf_materials_vec_t override_materials;
LLVOVolume* vobjp = (LLVOVolume*)node->getObject();
for (int i = 0; i < vobjp->getNumTEs(); ++i)
{
@@ -5812,18 +5812,16 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data
if (old_override)
{
LLPointer<LLGLTFMaterial> mat = new LLGLTFMaterial(*old_override);
- materials.push_back(mat);
+ override_materials.push_back(mat);
}
else
{
- materials.push_back(nullptr);
+ override_materials.push_back(nullptr);
}
}
- node->saveGLTFMaterialIds(material_ids);
-
// processObjectProperties does not include overrides so this
// might need to be moved to LLGLTFMaterialOverrideDispatchHandler
- node->saveGLTFOverrideMaterials(materials);
+ node->saveGLTFMaterials(material_ids, override_materials);
}
}
@@ -6576,8 +6574,7 @@ LLSelectNode::LLSelectNode(const LLSelectNode& nodep)
}
saveTextures(nodep.mSavedTextures);
- saveGLTFMaterialIds(nodep.mSavedGLTFMaterialIds);
- saveGLTFOverrideMaterials(nodep.mSavedGLTFOverrideMaterials);
+ saveGLTFMaterials(nodep.mSavedGLTFMaterialIds, nodep.mSavedGLTFOverrideMaterials);
}
LLSelectNode::~LLSelectNode()
@@ -6711,28 +6708,21 @@ void LLSelectNode::saveTextures(const uuid_vec_t& textures)
}
}
-void LLSelectNode::saveGLTFMaterialIds(const uuid_vec_t& materials)
+void LLSelectNode::saveGLTFMaterials(const uuid_vec_t& materials, const gltf_materials_vec_t& override_materials)
{
if (mObject.notNull())
{
mSavedGLTFMaterialIds.clear();
+ mSavedGLTFOverrideMaterials.clear();
for (uuid_vec_t::const_iterator materials_it = materials.begin();
materials_it != materials.end(); ++materials_it)
{
mSavedGLTFMaterialIds.push_back(*materials_it);
}
- }
-}
-
-void LLSelectNode::saveGLTFOverrideMaterials(const gltf_materials_vec_t& materials)
-{
- if (mObject.notNull())
- {
- mSavedGLTFOverrideMaterials.clear();
- for (gltf_materials_vec_t::const_iterator mat_it = materials.begin();
- mat_it != materials.end(); ++mat_it)
+ for (gltf_materials_vec_t::const_iterator mat_it = override_materials.begin();
+ mat_it != override_materials.end(); ++mat_it)
{
mSavedGLTFOverrideMaterials.push_back(*mat_it);
}