瀏覽代碼

Fix morphTarget creation in gltf loader

David Catuhe 6 年之前
父節點
當前提交
e205416654
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      dist/preview release/packagesSizeBaseLine.json
  2. 2 2
      loaders/src/glTF/2.0/glTFLoader.ts

+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"engineOnly":291219,"sceneOnly":501003,"minGridMaterial":628371,"minStandardMaterial":753196}
+{"engineOnly":291161,"sceneOnly":500945,"minGridMaterial":628313,"minStandardMaterial":753138}

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

@@ -852,10 +852,10 @@ export class GLTFLoader implements IGLTFLoader {
             throw new Error(`${context}: Primitives do not have the same number of targets`);
         }
 
-        babylonMesh.morphTargetManager = new MorphTargetManager();
+        babylonMesh.morphTargetManager = new MorphTargetManager(babylonMesh.getScene());
         for (let index = 0; index < primitive.targets.length; index++) {
             const weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;
-            babylonMesh.morphTargetManager.addTarget(new MorphTarget(`morphTarget${index}`, weight));
+            babylonMesh.morphTargetManager.addTarget(new MorphTarget(`morphTarget${index}`, weight, babylonMesh.getScene()));
             // TODO: tell the target whether it has positions, normals, tangents
         }
     }