浏览代码

Fix animation range clone bug

David Catuhe 7 年之前
父节点
当前提交
606f15d362
共有 2 个文件被更改,包括 17 次插入1 次删除
  1. 16 0
      src/Mesh/babylon.mesh.ts
  2. 1 1
      src/babylon.node.ts

+ 16 - 0
src/Mesh/babylon.mesh.ts

@@ -220,6 +220,22 @@
                 // Source mesh
                 this._source = source;
 
+                // Animation ranges
+                if (this._source._ranges) {
+                    const ranges = this._source._ranges;
+                    for (var name in ranges) {
+                        if (!ranges.hasOwnProperty(name)) {
+                            continue;
+                        }
+
+                        if (!ranges[name]) {
+                            continue;
+                        }
+
+                        this.createAnimationRange(name, ranges[name]!.from, ranges[name]!.to);
+                    }
+                }
+
                 // Metadata
                 if (source.metadata && source.metadata.clone) {
                     this.metadata = source.metadata.clone();

+ 1 - 1
src/babylon.node.ts

@@ -80,7 +80,7 @@
          * Gets a list of Animations associated with the node
          */
         public animations = new Array<Animation>();
-        private _ranges: { [name: string]: Nullable<AnimationRange> } = {};
+        protected _ranges: { [name: string]: Nullable<AnimationRange> } = {};
 
         /**
          * Callback raised when the node is ready to be used