summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-01-23 13:25:21 -0600
committerDave Parks <davep@lindenlab.com>2023-01-23 13:25:21 -0600
commit68b86228b3884af54962a201117194c67795c6b4 (patch)
treee5f10f49202cc0fd772cd910075ad828abc491e3
parent3b891301c448a1f1bf04512b1259c74ed54e573f (diff)
parent51d89480fe8c648bd5bf532e9f0f9788299034c2 (diff)
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
-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
{