From 99179c232f2b63bdc6d7364f225b9c34a4f4d0b8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 29 Jun 2022 21:43:24 -0500 Subject: SL-17685 Add missing files --- indra/newview/llgltfmateriallist.h | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 indra/newview/llgltfmateriallist.h (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h new file mode 100644 index 0000000000..c22134c468 --- /dev/null +++ b/indra/newview/llgltfmateriallist.h @@ -0,0 +1,48 @@ +/** + * @file llgltfmateriallist.h + * + * $LicenseInfo:firstyear=2022&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2022, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#pragma once + +#include "llgltfmaterial.h" +#include "llpointer.h" + +#include + +class LLGLTFMaterialList +{ +public: + LLGLTFMaterialList() {} + + typedef std::unordered_map > List; + List mList; + + LLGLTFMaterial* getMaterial(const LLUUID& id); + +}; + +extern LLGLTFMaterialList gGLTFMaterialList; + + -- cgit v1.2.3 From 4bb419031c130402a5589ff698e28e230a0c123a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 19 Aug 2022 01:45:47 +0300 Subject: SL-17653 Basic local gltf materials --- indra/newview/llgltfmateriallist.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index c22134c468..49760504e6 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -41,6 +41,9 @@ public: LLGLTFMaterial* getMaterial(const LLUUID& id); + void addMaterial(const LLUUID& id, LLGLTFMaterial* material); + void removeMaterial(const LLUUID& id); + }; extern LLGLTFMaterialList gGLTFMaterialList; -- cgit v1.2.3 From 7a3ed9dadc116e73349ec6fcd37eb3aee5916676 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 14 Oct 2022 14:33:18 -0700 Subject: Added stub handler for GLTF LargeGenericMessage as part of work on SL-18105 SL-17697 and SL-17698 --- indra/newview/llgltfmateriallist.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 49760504e6..4aed4b009d 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -44,6 +44,8 @@ public: void addMaterial(const LLUUID& id, LLGLTFMaterial* material); void removeMaterial(const LLUUID& id); + static void registerCallbacks(); + }; extern LLGLTFMaterialList gGLTFMaterialList; -- cgit v1.2.3 From 58472180696401155159414c20a307cf97f7df44 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 19 Oct 2022 00:08:27 +0300 Subject: SL-18391 Basic GLTF lifetime management --- indra/newview/llgltfmateriallist.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 4aed4b009d..4b905e32c9 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -26,26 +26,33 @@ #pragma once +#include "llfetchedgltfmaterial.h" #include "llgltfmaterial.h" #include "llpointer.h" #include +class LLFetchedGLTFMaterial; + class LLGLTFMaterialList { public: LLGLTFMaterialList() {} - typedef std::unordered_map > List; - List mList; LLGLTFMaterial* getMaterial(const LLUUID& id); - void addMaterial(const LLUUID& id, LLGLTFMaterial* material); + void addMaterial(const LLUUID& id, LLFetchedGLTFMaterial* material); void removeMaterial(const LLUUID& id); + void flushMaterials(); + static void registerCallbacks(); +private: + typedef std::unordered_map > uuid_mat_map_t; + uuid_mat_map_t mList; + LLUUID mLastUpdateKey; }; extern LLGLTFMaterialList gGLTFMaterialList; -- cgit v1.2.3 From b9b8fa1f5f4959517de1013e0bf610cedecb2426 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Tue, 18 Oct 2022 16:46:43 -0700 Subject: Fix ror mac build error in SL-18391 lifetime management --- indra/newview/llgltfmateriallist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 4b905e32c9..be2d21e90d 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -49,7 +49,7 @@ public: static void registerCallbacks(); private: - typedef std::unordered_map > uuid_mat_map_t; + typedef std::map > uuid_mat_map_t; uuid_mat_map_t mList; LLUUID mLastUpdateKey; -- cgit v1.2.3 From 9e5c0877c5bc94adace4376ffc9c0c902031f38b Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Tue, 18 Oct 2022 16:53:25 -0700 Subject: include the right header now that uuid_mat_map_t is std::map for SL-18391 --- indra/newview/llgltfmateriallist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index be2d21e90d..3d97baf5f8 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -30,7 +30,7 @@ #include "llgltfmaterial.h" #include "llpointer.h" -#include +#include class LLFetchedGLTFMaterial; -- cgit v1.2.3 From f575c139300a6c53fa13dd0d7cbfbaa739e2b4b0 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Tue, 18 Oct 2022 21:01:38 -0700 Subject: Better fix for mac/xcode compatibility problem in SL-18391. Keep using unordered_map --- indra/newview/llgltfmateriallist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 3d97baf5f8..4b905e32c9 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -30,7 +30,7 @@ #include "llgltfmaterial.h" #include "llpointer.h" -#include +#include class LLFetchedGLTFMaterial; @@ -49,7 +49,7 @@ public: static void registerCallbacks(); private: - typedef std::map > uuid_mat_map_t; + typedef std::unordered_map > uuid_mat_map_t; uuid_mat_map_t mList; LLUUID mLastUpdateKey; -- cgit v1.2.3 From 5c86ec6a6130bef9348d6155c6a7404914c20418 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 24 Oct 2022 16:26:42 -0500 Subject: SL-18105 Add mechanism for applying overrides that were received before associated ViewerObject was ready to receive them. --- indra/newview/llgltfmateriallist.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 4b905e32c9..ee32dc8825 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -48,10 +48,20 @@ public: void flushMaterials(); static void registerCallbacks(); + + // save an override update for later (for example, if an override arrived for an unknown object) + void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); + + void applyQueuedOverrides(LLViewerObject* obj); + private: typedef std::unordered_map > uuid_mat_map_t; uuid_mat_map_t mList; + typedef std::vector > override_list_t; + typedef std::unordered_map queued_override_map_t; + queued_override_map_t mQueuedOverrides; + LLUUID mLastUpdateKey; }; -- cgit v1.2.3 From 8f47657d646c06dbba8d44497c0f81fd00730cc8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 26 Oct 2022 16:08:28 -0500 Subject: SL-18443 Allow nulling out of override data and implement new override message protocol. --- indra/newview/llgltfmateriallist.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index ee32dc8825..f770f6ecc8 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -49,6 +49,13 @@ public: static void registerCallbacks(); + // apply given override data via given cap url + // cap_url -- should be gAgent.getRegionCapability("ModifyMaterialParams") + // overrides -- LLSD map in the format + // "object_id": LLUUID - object to be modified + // "side": integer - index of face to be modified + // "gltf_json" : string - GLTF compliant json of override data (optional, if omitted any existing override data will be cleared) + static void modifyMaterialCoro(std::string cap_url, LLSD overrides); // save an override update for later (for example, if an override arrived for an unknown object) void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); -- cgit v1.2.3 From 6d0fcc0e616ff58f4a83bc3730374c5509ee959a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 28 Oct 2022 19:58:27 +0300 Subject: SL-17699 Blank material Id for material picker --- indra/newview/llgltfmateriallist.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index f770f6ecc8..b74e0b3ec2 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -37,6 +37,8 @@ class LLFetchedGLTFMaterial; class LLGLTFMaterialList { public: + static const LLUUID BLANK_MATERIAL_ASSET_ID; + LLGLTFMaterialList() {} -- cgit v1.2.3 From 094a8876d6e030b5dc618ea28250e15022030c78 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 31 Oct 2022 20:12:53 +0200 Subject: SL-18446 Material override arrival filtering --- indra/newview/llgltfmateriallist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index b74e0b3ec2..bfdd9e5e32 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -57,7 +57,7 @@ public: // "object_id": LLUUID - object to be modified // "side": integer - index of face to be modified // "gltf_json" : string - GLTF compliant json of override data (optional, if omitted any existing override data will be cleared) - static void modifyMaterialCoro(std::string cap_url, LLSD overrides); + static void modifyMaterialCoro(std::string cap_url, LLSD overrides, void(*done_callback)(bool)); // save an override update for later (for example, if an override arrived for an unknown object) void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); -- cgit v1.2.3 From 40d01ba39388c5400e2582145e77295c51f33fc3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 8 Nov 2022 12:20:59 -0600 Subject: SL-18585 Batch updates to ModifyMaterialParams capability. --- indra/newview/llgltfmateriallist.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index bfdd9e5e32..e035d2108d 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -51,6 +51,12 @@ public: static void registerCallbacks(); + // save an override update that we want to send to the simulator for later + static void queueModifyMaterial(const LLUUID& id, S32 side, const LLGLTFMaterial& mat); + + // flush pending material updates to the simulator + static void flushModifyMaterialQueue(void(*done_callback)(bool)); + // apply given override data via given cap url // cap_url -- should be gAgent.getRegionCapability("ModifyMaterialParams") // overrides -- LLSD map in the format @@ -58,11 +64,11 @@ public: // "side": integer - index of face to be modified // "gltf_json" : string - GLTF compliant json of override data (optional, if omitted any existing override data will be cleared) static void modifyMaterialCoro(std::string cap_url, LLSD overrides, void(*done_callback)(bool)); - // save an override update for later (for example, if an override arrived for an unknown object) + + // save an override update that we got from the simulator for later (for example, if an override arrived for an unknown object) void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); void applyQueuedOverrides(LLViewerObject* obj); - private: typedef std::unordered_map > uuid_mat_map_t; uuid_mat_map_t mList; @@ -72,6 +78,21 @@ private: queued_override_map_t mQueuedOverrides; LLUUID mLastUpdateKey; + + struct ModifyMaterialData + { + LLUUID object_id; + S32 side = -1; + LLGLTFMaterial override_data; + LLUUID asset_id; + + bool has_override = false; + bool has_asset_id = false; + }; + + typedef std::list modify_queue_t; + static modify_queue_t sModifyQueue; + }; extern LLGLTFMaterialList gGLTFMaterialList; -- cgit v1.2.3 From a83a4811b51472b5f760861b6a8acde5fc3bd43b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 9 Nov 2022 22:45:20 +0200 Subject: SL-18518 Move json to material work to background thread --- indra/newview/llgltfmateriallist.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index e035d2108d..2dae11d2ca 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -26,6 +26,8 @@ #pragma once +#include "llassettype.h" +#include "llextendedstatus.h" #include "llfetchedgltfmaterial.h" #include "llgltfmaterial.h" #include "llpointer.h" @@ -69,6 +71,15 @@ public: void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); void applyQueuedOverrides(LLViewerObject* obj); + +protected: + static void onAssetLoadComplete( + const LLUUID& asset_uuid, + LLAssetType::EType type, + void* user_data, + S32 status, + LLExtStat ext_status); + private: typedef std::unordered_map > uuid_mat_map_t; uuid_mat_map_t mList; -- cgit v1.2.3 From 1ed8f7cd0ca41ab655aaeeaf141eb4ef20f16bd0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 9 Nov 2022 17:10:31 -0600 Subject: SL-18602 Fix for applying material asset not removing overrides on drag-and-drop --- indra/newview/llgltfmateriallist.h | 52 +++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index e035d2108d..9e8b3cf8e3 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -51,25 +51,45 @@ public: static void registerCallbacks(); - // save an override update that we want to send to the simulator for later - static void queueModifyMaterial(const LLUUID& id, S32 side, const LLGLTFMaterial& mat); + // Queue an override update that we want to send to the simulator. Call "flushUpdates" to flush pending updates. + // id - ID of object to modify + // side - TexureEntry index to modify, or -1 for all sides + // 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 queueApplyMaterialAsset below + static void queueModifyMaterial(const LLUUID& id, 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 + // 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 + // + // NOTE: implicitly removes any override data if present + static void queueApplyMaterialAsset(const LLUUID& object_id, S32 side, const LLUUID& asset_id); // flush pending material updates to the simulator - static void flushModifyMaterialQueue(void(*done_callback)(bool)); + static void flushUpdates(void(*done_callback)(bool) = nullptr); // apply given override data via given cap url // cap_url -- should be gAgent.getRegionCapability("ModifyMaterialParams") - // overrides -- LLSD map in the format - // "object_id": LLUUID - object to be modified - // "side": integer - index of face to be modified - // "gltf_json" : string - GLTF compliant json of override data (optional, if omitted any existing override data will be cleared) + // overrides -- LLSD map (or array of maps) in the format: + // object_id UUID(required) id of object + // side integer(required) TE index of face to set, or -1 for all faces + // gltf_json string(optional) override data to set, empty string nulls out override data, omissions of this parameter keeps existing data + // asset_id UUID(optional) id of material asset to set, omission of this parameter keeps existing material asset id + // + // NOTE: if you're calling this from outside of flushUpdates, you're probably doing it wrong. Use the "queue"/"flush" API above. + // If the queue/flush API is insufficient, extend it. static void modifyMaterialCoro(std::string cap_url, LLSD overrides, void(*done_callback)(bool)); - - // save an override update that we got from the simulator for later (for example, if an override arrived for an unknown object) - void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); void applyQueuedOverrides(LLViewerObject* obj); + private: + friend class LLGLTFMaterialOverrideDispatchHandler; + // save an override update that we got from the simulator for later (for example, if an override arrived for an unknown object) + // NOTE: this is NOT for applying overrides from the UI, see queueModifyMaterial above + void queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data); + typedef std::unordered_map > uuid_mat_map_t; uuid_mat_map_t mList; @@ -84,15 +104,23 @@ private: LLUUID object_id; S32 side = -1; LLGLTFMaterial override_data; - LLUUID asset_id; bool has_override = false; - bool has_asset_id = false; }; typedef std::list modify_queue_t; static modify_queue_t sModifyQueue; + struct ApplyMaterialAssetData + { + LLUUID object_id; + S32 side = -1; + LLUUID asset_id; + }; + + typedef std::list apply_queue_t; + static apply_queue_t sApplyQueue; + }; extern LLGLTFMaterialList gGLTFMaterialList; -- cgit v1.2.3 From 76de36c40520445d7ad77f85cd6c601942b97032 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 10 Nov 2022 13:21:06 -0600 Subject: SL-18602 Integrate queueModify/queueApply/queueUpdate into all the places that used to post to ModifyMaterialParams directly. --- indra/newview/llgltfmateriallist.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 9f64f89961..c4eabc8ef7 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -53,13 +53,13 @@ public: static void registerCallbacks(); - // Queue an override update that we want to send to the simulator. Call "flushUpdates" to flush pending updates. + // Queue an modification of a material that we want to send to the simulator. Call "flushUpdates" to flush pending updates. // id - ID of object to modify // side - TexureEntry index to modify, or -1 for all sides // 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 queueApplyMaterialAsset below - static void queueModifyMaterial(const LLUUID& id, S32 side, const LLGLTFMaterial* mat); + static void queueModify(const LLUUID& id, 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 @@ -67,23 +67,26 @@ public: // asset_id - ID of material asset to apply, or LLUUID::null to disassociate current material asset // // NOTE: implicitly removes any override data if present - static void queueApplyMaterialAsset(const LLUUID& object_id, S32 side, const LLUUID& asset_id); + static void queueApply(const LLUUID& object_id, S32 side, const LLUUID& asset_id); // flush pending material updates to the simulator - static void flushUpdates(void(*done_callback)(bool) = nullptr); + // Automatically called once per frame, but may be called explicitly + // for cases that care about the done_callback forwarded to LLCoros::instance().launch + static void flushUpdates(void(*done_callback)(bool) = nullptr); - // apply given override data via given cap url - // cap_url -- should be gAgent.getRegionCapability("ModifyMaterialParams") + // Queue an explicit LLSD ModifyMaterialParams update apply given override data // overrides -- LLSD map (or array of maps) in the format: // object_id UUID(required) id of object // side integer(required) TE index of face to set, or -1 for all faces // gltf_json string(optional) override data to set, empty string nulls out override data, omissions of this parameter keeps existing data // asset_id UUID(optional) id of material asset to set, omission of this parameter keeps existing material asset id // - // NOTE: if you're calling this from outside of flushUpdates, you're probably doing it wrong. Use the "queue"/"flush" API above. + // NOTE: Unless you already have a gltf_json string you want to send, strongly prefer using queueModify // If the queue/flush API is insufficient, extend it. - static void modifyMaterialCoro(std::string cap_url, LLSD overrides, void(*done_callback)(bool)); + static void queueUpdate(const LLSD& data); + // Called by batch builder to give LLGLTMaterialList an opportunity to apply + // any override data that arrived before the object was ready to receive it void applyQueuedOverrides(LLViewerObject* obj); private: @@ -92,6 +95,7 @@ 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)); protected: static void onAssetLoadComplete( @@ -132,6 +136,8 @@ protected: typedef std::list apply_queue_t; static apply_queue_t sApplyQueue; + // data to be flushed to ModifyMaterialParams capability + static LLSD sUpdates; }; extern LLGLTFMaterialList gGLTFMaterialList; -- cgit v1.2.3 From 1971839517519657fc895c9cb12c47317dde6b39 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 11 Nov 2022 10:00:37 -0800 Subject: Basic solution for SL-18458 vocache implementation for material overrides --- indra/newview/llgltfmateriallist.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index c4eabc8ef7..805b477248 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -89,6 +89,11 @@ public: // any override data that arrived before the object was ready to receive it void applyQueuedOverrides(LLViewerObject* obj); + // takes both the parsed message and its raw text to avoid unnecessary re serialization + static void writeCacheOverrides(LLSD const & message, std::string const & llsdRaw); + + static void loadCacheOverrides(std::string const & message_raw); + private: friend class LLGLTFMaterialOverrideDispatchHandler; // save an override update that we got from the simulator for later (for example, if an override arrived for an unknown object) -- cgit v1.2.3 From 32984b56ea8fa4f4357379a40627b5e9267d7543 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 24 Nov 2022 12:16:59 +0200 Subject: SL-18701 llsd is not thread safe, parse it before using --- indra/newview/llgltfmateriallist.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 805b477248..0f0edf7414 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -35,6 +35,7 @@ #include class LLFetchedGLTFMaterial; +class LLGLTFOverrideCacheEntry; class LLGLTFMaterialList { @@ -89,10 +90,7 @@ public: // any override data that arrived before the object was ready to receive it void applyQueuedOverrides(LLViewerObject* obj); - // takes both the parsed message and its raw text to avoid unnecessary re serialization - static void writeCacheOverrides(LLSD const & message, std::string const & llsdRaw); - - static void loadCacheOverrides(std::string const & message_raw); + static void loadCacheOverrides(const LLGLTFOverrideCacheEntry& override); private: friend class LLGLTFMaterialOverrideDispatchHandler; -- cgit v1.2.3 From a989eba0808b2e5fda5494ff3b109784aa79984e Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Mon, 21 Nov 2022 16:09:07 -0800 Subject: SL-18732: Fix flickering of control values when changing GLTF texture transforms in build floater --- indra/newview/llgltfmateriallist.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 0f0edf7414..5a184f5e94 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -74,6 +74,8 @@ public: // Automatically called once per frame, but may be called explicitly // for cases that care about the done_callback forwarded to LLCoros::instance().launch static void flushUpdates(void(*done_callback)(bool) = nullptr); + + static void addUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); // Queue an explicit LLSD ModifyMaterialParams update apply given override data // overrides -- LLSD map (or array of maps) in the format: -- cgit v1.2.3 From bfcb07270ed7036c87a4ece7fa1f5416123fff85 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 29 Nov 2022 15:20:44 -0800 Subject: SL-18732: Review feedback --- indra/newview/llgltfmateriallist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 5a184f5e94..abbb755599 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -75,7 +75,7 @@ public: // for cases that care about the done_callback forwarded to LLCoros::instance().launch static void flushUpdates(void(*done_callback)(bool) = nullptr); - static void addUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); + static void addSelectionUpdateCallback(void(*update_callback)(const LLUUID& object_id, S32 side)); // Queue an explicit LLSD ModifyMaterialParams update apply given override data // overrides -- LLSD map (or array of maps) in the format: -- cgit v1.2.3 From 693925ef23ef41e3927a9654a7f423d0e24ce19a Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 13 Dec 2022 10:41:21 -0800 Subject: SL-18820: Fix applying material clearing transform overrides. Loosen some asserts to allow non-default transform overrides. --- indra/newview/llgltfmateriallist.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index abbb755599..70540e5e01 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -59,7 +59,7 @@ public: // side - TexureEntry index to modify, or -1 for all sides // 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 queueApplyMaterialAsset below + // 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); // Queue an application of a material asset we want to send to the simulator. Call "flushUpdates" to flush pending updates. @@ -67,8 +67,8 @@ public: // 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 // - // NOTE: implicitly removes any override data if present - static void queueApply(const LLUUID& object_id, S32 side, const LLUUID& asset_id); + // NOTE: Implicitly clears most override data if present + static void queueApply(const LLViewerObject* obj, S32 side, const LLUUID& asset_id); // flush pending material updates to the simulator // Automatically called once per frame, but may be called explicitly @@ -136,6 +136,7 @@ protected: LLUUID object_id; S32 side = -1; LLUUID asset_id; + LLPointer override_data; }; typedef std::list apply_queue_t; -- cgit v1.2.3 From a3f43b4b73cc8fbd48a0574ebd74bbe660f8af50 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 23 Jan 2023 19:17:46 +0200 Subject: SL-19014 Sanitize the override data sent for faces without GLTF materials --- indra/newview/llgltfmateriallist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llgltfmateriallist.h') 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 -- cgit v1.2.3 From 2aaa15fef15243e6b38f46426d8ebb355ccfb807 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 24 Jan 2023 17:48:18 -0800 Subject: SL-19012: Fix new material IDs sometimes not applying when set via LSL --- indra/newview/llgltfmateriallist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 5ce0e324f5..85e60aa17f 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -45,7 +45,7 @@ public: LLGLTFMaterialList() {} - LLGLTFMaterial* getMaterial(const LLUUID& id); + LLFetchedGLTFMaterial* getMaterial(const LLUUID& id); void addMaterial(const LLUUID& id, LLFetchedGLTFMaterial* material); void removeMaterial(const LLUUID& id); -- cgit v1.2.3 From f8f119e4a8b6d3c1f106f5e290d1da187fd9aa17 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 4 May 2023 22:46:24 +0300 Subject: SL-18932 Canceling material selection only reverts override --- indra/newview/llgltfmateriallist.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 85e60aa17f..ce8781baba 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -70,6 +70,13 @@ 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. + // 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 + // mat - override material, if null, will clear most override data + static void queueApply(const LLViewerObject* obj, S32 side, const LLUUID& asset_id, const LLGLTFMaterial* mat); + // flush pending material updates to the simulator // Automatically called once per frame, but may be called explicitly // for cases that care about the done_callback forwarded to LLCoros::instance().launch -- cgit v1.2.3 From 455bbcf742691b709353aa3c3e35a76d0ff38ee4 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 29 Aug 2023 16:42:55 -0500 Subject: SL-20229 Add GenericStreamingMessage and use it to receive GLTF material overrides --- indra/newview/llgltfmateriallist.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index ce8781baba..7317214019 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -101,6 +101,9 @@ public: static void loadCacheOverrides(const LLGLTFOverrideCacheEntry& override); + // Apply an override update with the given data + void applyOverrideMessage(LLMessageSystem* msg, const std::string& data); + private: friend class LLGLTFMaterialOverrideDispatchHandler; // save an override update that we got from the simulator for later (for example, if an override arrived for an unknown object) -- cgit v1.2.3 From 983a3c7207bcb233fb5a1cfdfbed8b9a3f992a73 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 9 Jan 2024 15:52:33 -0600 Subject: SL-20780 Clean up some dead code. --- indra/newview/llgltfmateriallist.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llgltfmateriallist.h') diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index 7317214019..f1c4ce20f9 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -52,8 +52,6 @@ public: void flushMaterials(); - static void registerCallbacks(); - // Queue an modification of a material that we want to send to the simulator. Call "flushUpdates" to flush pending updates. // id - ID of object to modify // side - TexureEntry index to modify, or -1 for all sides @@ -99,8 +97,6 @@ public: // any override data that arrived before the object was ready to receive it void applyQueuedOverrides(LLViewerObject* obj); - static void loadCacheOverrides(const LLGLTFOverrideCacheEntry& override); - // Apply an override update with the given data void applyOverrideMessage(LLMessageSystem* msg, const std::string& data); -- cgit v1.2.3