summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorcosmic-linden <111533034+cosmic-linden@users.noreply.github.com>2023-01-23 10:44:18 -0800
committerGitHub <noreply@github.com>2023-01-23 10:44:18 -0800
commit51d89480fe8c648bd5bf532e9f0f9788299034c2 (patch)
treecb37d733ecbe763895a5c81191befc2a85b240ba /indra
parent8bad6ccde406566cd6859db69c45c06eb6001386 (diff)
parenta3f43b4b73cc8fbd48a0574ebd74bbe660f8af50 (diff)
Merge pull request #55 from secondlife/andreyk/SL-19014
SL-19014 Sanitize the override data sent for faces without GLTF materials
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llgltfmateriallist.cpp25
-rw-r--r--indra/newview/llgltfmateriallist.h2
-rw-r--r--indra/newview/llmaterialeditor.cpp2
-rw-r--r--indra/newview/llpanelface.cpp2
-rw-r--r--indra/newview/llselectmgr.cpp2
5 files changed, 21 insertions, 12 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 9399342a61..4cf1562042 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -392,15 +392,18 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj)
}
}
-void LLGLTFMaterialList::queueModify(const LLUUID& id, S32 side, const LLGLTFMaterial* mat)
+void LLGLTFMaterialList::queueModify(const LLViewerObject* obj, S32 side, const LLGLTFMaterial* mat)
{
- if (mat == nullptr)
+ if (obj && obj->getRenderMaterialID(side).notNull())
{
- sModifyQueue.push_back({ id, side, LLGLTFMaterial(), false });
- }
- else
- {
- sModifyQueue.push_back({ id, side, *mat, true});
+ if (mat == nullptr)
+ {
+ sModifyQueue.push_back({ obj->getID(), side, LLGLTFMaterial(), false });
+ }
+ else
+ {
+ sModifyQueue.push_back({ obj->getID(), side, *mat, true });
+ }
}
}
@@ -437,8 +440,14 @@ void LLGLTFMaterialList::flushUpdates(void(*done_callback)(bool))
S32 i = data.size();
- for (auto& e : sModifyQueue)
+ for (ModifyMaterialData& e : sModifyQueue)
{
+#ifdef SHOW_ASSERT
+ // validate object has a material id
+ LLViewerObject* obj = gObjectList.findObject(e.object_id);
+ llassert(obj && obj->getRenderMaterialID(e.side).notNull());
+#endif
+
data[i]["object_id"] = e.object_id;
data[i]["side"] = e.side;
diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h
index 70540e5e01..5ce0e324f5 100644
--- a/indra/newview/llgltfmateriallist.h
+++ b/indra/newview/llgltfmateriallist.h
@@ -60,7 +60,7 @@ public:
// mat - material to apply as override, or nullptr to remove existing overrides and revert to asset
//
// NOTE: do not use to revert to asset when applying a new asset id, use queueApply below
- static void queueModify(const LLUUID& id, S32 side, const LLGLTFMaterial* mat);
+ static void queueModify(const LLViewerObject* obj, S32 side, const LLGLTFMaterial* mat);
// Queue an application of a material asset we want to send to the simulator. Call "flushUpdates" to flush pending updates.
// object_id - ID of object to apply material asset to
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index dabc7d16ea..a36ddeb532 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -2674,7 +2674,7 @@ public:
{
mSuccess = true;
}
- LLGLTFMaterialList::queueModify(objectp->getID(), te, material);
+ LLGLTFMaterialList::queueModify(objectp, te, material);
}
return true;
}
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index cf02f3c4e4..cb09ec9fbf 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -152,7 +152,7 @@ void LLPanelFace::updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*
new_override = *tep->getGLTFMaterialOverride();
}
mFunc(&new_override);
- LLGLTFMaterialList::queueModify(object->getID(), face, &new_override);
+ LLGLTFMaterialList::queueModify(object, face, &new_override);
return true;
}
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 2b6578c272..1f604f3cba 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2219,7 +2219,7 @@ void LLSelectMgr::selectionRevertGLTFMaterials()
&& asset_id.notNull())
{
// Restore overrides
- LLGLTFMaterialList::queueModify(objectp->getID(), te, nodep->mSavedGLTFOverrideMaterials[te]);
+ LLGLTFMaterialList::queueModify(objectp, te, nodep->mSavedGLTFOverrideMaterials[te]);
}
else
{