瀏覽代碼

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

Temechon 10 年之前
父節點
當前提交
47d6ab115f
共有 2 個文件被更改,包括 6 次插入3 次删除
  1. 3 1
      src/Animations/babylon.animation.js
  2. 3 2
      src/Animations/babylon.animation.ts

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