Pārlūkot izejas kodu

Fix morphTarget creation in gltf loader

David Catuhe 6 gadi atpakaļ
vecāks
revīzija
e205416654

+ 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
         }
     }