summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2025-03-12 20:07:53 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-03-13 01:04:13 +0200
commit0ad55a33a06c9d1878199ff1ce3e253a65832dd3 (patch)
tree65afdf348e9b1092f86063a7fa099a87b990a2f9
parentd915cf17dfb4ddd79830f3ff9fea004ba9d2b61c (diff)
#3189 Pasted PBR materials disappearing
-rw-r--r--indra/newview/llgltfmateriallist.cpp16
-rw-r--r--indra/newview/llgltfmateriallist.h2
-rw-r--r--indra/newview/llpanelface.cpp11
3 files changed, 20 insertions, 9 deletions
diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp
index 25438eae5e..d8b3f996aa 100644
--- a/indra/newview/llgltfmateriallist.cpp
+++ b/indra/newview/llgltfmateriallist.cpp
@@ -353,6 +353,18 @@ void LLGLTFMaterialList::queueApply(const LLViewerObject* obj, S32 side, const L
}
}
+void LLGLTFMaterialList::queueApply(const LLViewerObject* obj, S32 side, const LLUUID& asset_id, const std::string &override_json)
+{
+ if (asset_id.isNull() || override_json.empty())
+ {
+ queueApply(obj, side, asset_id);
+ }
+ else
+ {
+ sApplyQueue.push_back({ obj->getID(), side, asset_id, nullptr, override_json });
+ }
+}
+
void LLGLTFMaterialList::queueApply(const LLViewerObject* obj, S32 side, const LLUUID& asset_id, const LLGLTFMaterial* material_override)
{
if (asset_id.isNull() || material_override == nullptr)
@@ -456,6 +468,10 @@ void LLGLTFMaterialList::flushUpdatesOnce(std::shared_ptr<CallbackHolder> callba
{
data[i]["gltf_json"] = e.override_data->asJSON();
}
+ if (!e.override_json.empty())
+ {
+ data[i]["gltf_json"] = e.override_json;
+ }
else
{
// Clear all overrides
diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h
index e79da3592a..97d173d3a7 100644
--- a/indra/newview/llgltfmateriallist.h
+++ b/indra/newview/llgltfmateriallist.h
@@ -67,6 +67,7 @@ public:
//
// NOTE: Implicitly clears most override data if present
static void queueApply(const LLViewerObject* obj, S32 side, const LLUUID& asset_id);
+ static void queueApply(const LLViewerObject* obj, S32 side, const LLUUID& asset_id, const std::string& override_json);
// Queue an application of a material asset we want to send to the simulator.
// Call "flushUpdates" to flush pending updates immediately.
@@ -160,6 +161,7 @@ protected:
S32 side = -1;
LLUUID asset_id;
LLPointer<LLGLTFMaterial> override_data;
+ std::string override_json;
};
typedef std::list<ApplyMaterialAssetData> apply_queue_t;
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 692bd9cc41..f491cccaf8 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -4464,21 +4464,14 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te)
tep->setGLTFRenderMaterial(nullptr);
tep->setGLTFMaterialOverride(nullptr);
- LLSD override_data;
- override_data["object_id"] = objectp->getID();
- override_data["side"] = te;
if (te_data["te"].has("pbr_override"))
{
- override_data["gltf_json"] = te_data["te"]["pbr_override"];
+ LLGLTFMaterialList::queueApply(objectp, te, te_data["te"]["pbr"].asUUID(), te_data["te"]["pbr_override"]);
}
else
{
- override_data["gltf_json"] = "";
+ LLGLTFMaterialList::queueApply(objectp, te, te_data["te"]["pbr"].asUUID());
}
-
- override_data["asset_id"] = te_data["te"]["pbr"].asUUID();
-
- LLGLTFMaterialList::queueUpdate(override_data);
}
else
{