瀏覽代碼

Merge pull request #5901 from bghgary/loader-fix

Load nothing instead of error if scene is undefined in glTF loader
David Catuhe 6 年之前
父節點
當前提交
d26a700e4b
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      loaders/src/glTF/2.0/glTFLoader.ts

+ 2 - 2
loaders/src/glTF/2.0/glTFLoader.ts

@@ -257,8 +257,8 @@ export class GLTFLoader implements IGLTFLoader {
             if (nodes) {
                 promises.push(this.loadSceneAsync("/nodes", { nodes: nodes, index: -1 }));
             }
-            else {
-                const scene = ArrayItem.Get(`/scene`, this.gltf.scenes, this.gltf.scene || 0);
+            else if (this.gltf.scene != undefined) {
+                const scene = ArrayItem.Get(`/scene`, this.gltf.scenes, this.gltf.scene);
                 promises.push(this.loadSceneAsync(`/scenes/${scene.index}`, scene));
             }