#3189 Pasted PBR materials disappearing
parent
d915cf17df
commit
0ad55a33a0
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue