From e3a7ad3d35d1bf51544829b698525e7dcac5a8c8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 18 Jul 2024 00:01:10 +0300 Subject: viewer#2027 Cannot apply PBR Materials on larger linksets Split updates into batches that respect server update limit --- indra/newview/llgltfmateriallist.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 982538f106..e79da3592a 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -58,7 +58,9 @@ public: // NOTE: do not use to revert to asset when applying a new asset id, use queueApply below 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. + // Queue an application of a material asset we want to send to the simulator. + // Call "flushUpdates" to flush pending updates immediately. + // Will be flushed automatically if queue is full. // object_id - ID of object to apply material asset to // side - TextureEntry index to apply material to, or -1 for all sides // asset_id - ID of material asset to apply, or LLUUID::null to disassociate current material asset @@ -66,7 +68,9 @@ public: // NOTE: Implicitly clears most override data if present static void queueApply(const LLViewerObject* obj, S32 side, const LLUUID& asset_id); - // Queue an application of a material asset we want to send to the simulator. Call "flushUpdates" to flush pending updates. + // Queue an application of a material asset we want to send to the simulator. + // Call "flushUpdates" to flush pending updates immediately. + // Will be flushed automatically if queue is full. // object_id - ID of object to apply material asset to // side - TextureEntry index to apply material to, or -1 for all sides // asset_id - ID of material asset to apply, or LLUUID::null to disassociate current material asset @@ -104,7 +108,22 @@ private: // NOTE: this is NOT for applying overrides from the UI, see queueModifyMaterial above void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); - static void modifyMaterialCoro(std::string cap_url, LLSD overrides, void(*done_callback)(bool)); + + class CallbackHolder + { + public: + CallbackHolder(void(*done_callback)(bool)) + : mCallback(done_callback) + {} + ~CallbackHolder() + { + if (mCallback) mCallback(mSuccess); + } + std::function mCallback = nullptr; + bool mSuccess = true; + }; + static void flushUpdatesOnce(std::shared_ptr callback_holder); + static void modifyMaterialCoro(std::string cap_url, LLSD overrides, std::shared_ptr callback_holder); protected: static void onAssetLoadComplete( -- cgit v1.2.3