Browse Source

Fix bug when an animation was cloned before setting its keys.

Temechon 10 năm trước cách đây
mục cha
commit
47d6ab115f

+ 3 - 1
src/Animations/babylon.animation.js

@@ -96,7 +96,9 @@ var BABYLON;
         };
         Animation.prototype.clone = function () {
             var clone = new Animation(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
-            clone.setKeys(this._keys);
+            if (this._keys) {
+                clone.setKeys(this._keys);
+            }
             return clone;
         };
         Animation.prototype.setKeys = function (values) {

+ 3 - 2
src/Animations/babylon.animation.ts

@@ -122,8 +122,9 @@
 
         public clone(): Animation {
             var clone = new Animation(this.name, this.targetPropertyPath.join("."), this.framePerSecond, this.dataType, this.loopMode);
-
-            clone.setKeys(this._keys);
+            if (this._keys) {
+                clone.setKeys(this._keys);
+            }
 
             return clone;
         }