Browse Source

Add customExtension support to the scene (#5954)

Co-authored-by: Kim Kulling <[email protected]>
BurntRanch 7 months ago
parent
commit
2a0969d4d9
1 changed files with 8 additions and 0 deletions
  1. 8 0
      code/AssetLib/glTF2/glTF2Asset.inl

+ 8 - 0
code/AssetLib/glTF2/glTF2Asset.inl

@@ -2045,6 +2045,12 @@ inline void Asset::Load(const std::string &pFile, bool isBinary)
         mDicts[i]->AttachToDocument(doc);
         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
     // Read the "scene" property, which specifies which scene to load
     // and recursively load everything referenced by it
     // and recursively load everything referenced by it
     unsigned int sceneIndex = 0;
     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 (Value *scenesArray = FindArray(doc, "scenes")) {
         if (sceneIndex < scenesArray->Size()) {
         if (sceneIndex < scenesArray->Size()) {
             this->scene = scenes.Retrieve(sceneIndex);
             this->scene = scenes.Retrieve(sceneIndex);
+
+            this->scene->customExtensions = customExtensions;
         }
         }
     }
     }