summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-09-18 15:55:23 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-09-18 15:55:23 -0500
commit83fb74720f27b8a203bc7a143931ecc5b4770c01 (patch)
treebe129cc3487b3d0d777db1cce54d88f859c4ee47
parentdb480d11fe69e54fb0387c6624657673b2f414e9 (diff)
SL-20229 Cache GLTF updates that are received before the object they're applied to is loaded.
-rw-r--r--indra/newview/llgltfmateriallist.cpp53
1 files changed, 29 insertions, 24 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 655311f53d..0bdfcf05e7 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -337,6 +337,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
const LLHost& host = msg->getSender();
LLViewerRegion* region = LLWorld::instance().getRegion(host);
+ llassert(region);
if (region)
{
@@ -345,43 +346,47 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s
gObjectList.getUUIDFromLocal(id, local_id, host.getAddress(), host.getPort());
LLViewerObject* obj = gObjectList.findObject(id);
- if (obj)
- {
- if (gShowObjectUpdates)
- { // display a cyan blip for override updates when "Show Updates to Objects" enabled
- LLColor4 color(0.f, 1.f, 1.f, 1.f);
- gPipeline.addDebugBlip(obj->getPositionAgent(), color);
- }
+ // NOTE: obj may be null if the viewer hasn't heard about the object yet, cache update in any case
+
+ if (obj && gShowObjectUpdates)
+ { // display a cyan blip for override updates when "Show Updates to Objects" enabled
+ LLColor4 color(0.f, 1.f, 1.f, 1.f);
+ gPipeline.addDebugBlip(obj->getPositionAgent(), color);
+ }
- const LLSD& tes = data["te"];
- const LLSD& od = data["od"];
+ const LLSD& tes = data["te"];
+ const LLSD& od = data["od"];
- if (tes.isArray())
+ if (tes.isArray())
+ {
+ LLGLTFOverrideCacheEntry cache;
+ cache.mLocalId = local_id;
+ cache.mObjectId = id;
+ cache.mRegionHandle = region->getHandle();
+
+ for (int i = 0; i < tes.size(); ++i)
{
- LLGLTFOverrideCacheEntry cache;
- cache.mLocalId = local_id;
- cache.mObjectId = id;
- cache.mRegionHandle = region->getHandle();
+ LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership
+ mat->applyOverrideLLSD(od[i]);
- for (int i = 0; i < tes.size(); ++i)
- {
- S32 te = tes[i].asInteger();
- LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride will take ownership
- mat->applyOverrideLLSD(od[i]);
- obj->setTEGLTFMaterialOverride(te, mat);
+ S32 te = tes[i].asInteger();
- cache.mSides[te] = od[i];
- cache.mGLTFMaterial[te] = mat;
+ cache.mSides[te] = od[i];
+ cache.mGLTFMaterial[te] = mat;
+ if (obj)
+ {
+ obj->setTEGLTFMaterialOverride(te, mat);
if (obj->getTE(te) && obj->getTE(te)->isSelected())
{
handle_gltf_override_message.doSelectionCallbacks(id, te);
}
}
-
- region->cacheFullUpdateGLTFOverride(cache);
}
+
+ region->cacheFullUpdateGLTFOverride(cache);
}
+
}
}