From 2a0969d4d9ece293d1640a8a0d7e463efb26402b Mon Sep 17 00:00:00 2001 From: BurntRanch <69512353+BurntRanch@users.noreply.github.com> Date: Fri, 17 Jan 2025 18:09:23 +0300 Subject: [PATCH] Add customExtension support to the scene (#5954) Co-authored-by: Kim Kulling --- code/AssetLib/glTF2/glTF2Asset.inl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index bcc5b7ddb..c06b4afb4 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -2045,6 +2045,12 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) mDicts[i]->AttachToDocument(doc); } + // Read the "extensions" property, then add it to each scene's metadata. + CustomExtension customExtensions; + if (Value *extensionsObject = FindObject(doc, "extensions")) { + customExtensions = glTF2::ReadExtensions("extensions", *extensionsObject); + } + // Read the "scene" property, which specifies which scene to load // and recursively load everything referenced by it unsigned int sceneIndex = 0; @@ -2056,6 +2062,8 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) if (Value *scenesArray = FindArray(doc, "scenes")) { if (sceneIndex < scenesArray->Size()) { this->scene = scenes.Retrieve(sceneIndex); + + this->scene->customExtensions = customExtensions; } }