summaryrefslogtreecommitdiff
path: root/indra/newview/llgltfmateriallist.cpp
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/newview/llgltfmateriallist.cpp
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/newview/llgltfmateriallist.cpp')
-rw-r--r--indra/newview/llgltfmateriallist.cpp25
1 files changed, 17 insertions, 8 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;