Explorar el Código

Merge pull request #4142 from bghgary/loader-bug-fix

Fix bug with loading animations in glTF loader
David Catuhe hace 7 años
padre
commit
30811695a8
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      loaders/src/glTF/2.0/babylon.glTFLoader.ts

+ 4 - 1
loaders/src/glTF/2.0/babylon.glTFLoader.ts

@@ -930,7 +930,10 @@ module BABYLON.GLTF2 {
 
         private _loadAnimationChannelAsync(context: string, animationContext: string, animation: _ILoaderAnimation, channel: _ILoaderAnimationChannel, babylonAnimationGroup: AnimationGroup): Promise<void> {
             const targetNode = GLTFLoader._GetProperty(`${context}/target/node`, this._gltf.nodes, channel.target.node);
-            if (!targetNode._babylonMesh) {
+
+            // Ignore animations that have no animation targets.
+            if ((channel.target.path === AnimationChannelTargetPath.WEIGHTS && !targetNode._numMorphTargets) ||
+                (channel.target.path !== AnimationChannelTargetPath.WEIGHTS && !targetNode._babylonAnimationTargets)) {
                 return Promise.resolve();
             }