Browse Source

Add weight support for animation groups

David Catuhe 7 years ago
parent
commit
f971936725

File diff suppressed because it is too large
+ 18011 - 17998
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 9 - 9
dist/preview release/babylon.js


+ 26 - 1
dist/preview release/babylon.max.js

@@ -50865,8 +50865,33 @@ var BABYLON;
             return this;
             return this;
         };
         };
         /**
         /**
+         * Set animation weight for all animatables
+         * @param weight defines the weight to use
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.weight = weight;
+            }
+            return this;
+        };
+        /**
+         * Synchronize and normalize all animatables with a source animatable
+         * @param root defines the root animatable to synchronize with
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.syncAllAnimationsWith = function (root) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.syncWith(root);
+            }
+            return this;
+        };
+        /**
          * Goes to a specific frame in this animation group
          * Goes to a specific frame in this animation group
-         *
          * @param frame the frame number to go to
          * @param frame the frame number to go to
          * @return the animationGroup
          * @return the animationGroup
          */
          */

+ 26 - 1
dist/preview release/babylon.no-module.max.js

@@ -50832,8 +50832,33 @@ var BABYLON;
             return this;
             return this;
         };
         };
         /**
         /**
+         * Set animation weight for all animatables
+         * @param weight defines the weight to use
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.weight = weight;
+            }
+            return this;
+        };
+        /**
+         * Synchronize and normalize all animatables with a source animatable
+         * @param root defines the root animatable to synchronize with
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.syncAllAnimationsWith = function (root) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.syncWith(root);
+            }
+            return this;
+        };
+        /**
          * Goes to a specific frame in this animation group
          * Goes to a specific frame in this animation group
-         *
          * @param frame the frame number to go to
          * @param frame the frame number to go to
          * @return the animationGroup
          * @return the animationGroup
          */
          */

File diff suppressed because it is too large
+ 9 - 9
dist/preview release/babylon.worker.js


+ 26 - 1
dist/preview release/es6.js

@@ -50832,8 +50832,33 @@ var BABYLON;
             return this;
             return this;
         };
         };
         /**
         /**
+         * Set animation weight for all animatables
+         * @param weight defines the weight to use
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.weight = weight;
+            }
+            return this;
+        };
+        /**
+         * Synchronize and normalize all animatables with a source animatable
+         * @param root defines the root animatable to synchronize with
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.syncAllAnimationsWith = function (root) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.syncWith(root);
+            }
+            return this;
+        };
+        /**
          * Goes to a specific frame in this animation group
          * Goes to a specific frame in this animation group
-         *
          * @param frame the frame number to go to
          * @param frame the frame number to go to
          * @return the animationGroup
          * @return the animationGroup
          */
          */

File diff suppressed because it is too large
+ 6 - 6
dist/preview release/viewer/babylon.viewer.js


+ 26 - 1
dist/preview release/viewer/babylon.viewer.max.js

@@ -50953,8 +50953,33 @@ var BABYLON;
             return this;
             return this;
         };
         };
         /**
         /**
+         * Set animation weight for all animatables
+         * @param weight defines the weight to use
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.setWeightForAllAnimatables = function (weight) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.weight = weight;
+            }
+            return this;
+        };
+        /**
+         * Synchronize and normalize all animatables with a source animatable
+         * @param root defines the root animatable to synchronize with
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        AnimationGroup.prototype.syncAllAnimationsWith = function (root) {
+            for (var index = 0; index < this._animatables.length; index++) {
+                var animatable = this._animatables[index];
+                animatable.syncWith(root);
+            }
+            return this;
+        };
+        /**
          * Goes to a specific frame in this animation group
          * Goes to a specific frame in this animation group
-         *
          * @param frame the frame number to go to
          * @param frame the frame number to go to
          * @return the animationGroup
          * @return the animationGroup
          */
          */

+ 1 - 1
src/Animations/babylon.animatable.ts

@@ -76,7 +76,7 @@
 
 
         // Methods
         // Methods
         /**
         /**
-         * Synchronize and normalize current Animatable with a source Animatable.
+         * Synchronize and normalize current Animatable with a source Animatable
          * This is useful when using animation weights and when animations are not of the same length
          * This is useful when using animation weights and when animations are not of the same length
          * @param root defines the root Animatable to synchronize with
          * @param root defines the root Animatable to synchronize with
          * @returns the current Animatable
          * @returns the current Animatable

+ 30 - 1
src/Animations/babylon.animationGroup.ts

@@ -262,8 +262,37 @@ module BABYLON {
         }
         }
 
 
         /**
         /**
+         * Set animation weight for all animatables
+         * @param weight defines the weight to use
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        public setWeightForAllAnimatables(weight: number): AnimationGroup {
+            for (var index = 0; index < this._animatables.length; index++) {
+                let animatable = this._animatables[index];
+                animatable.weight = weight;
+            }
+
+            return this;
+        }
+
+        /**
+         * Synchronize and normalize all animatables with a source animatable
+         * @param root defines the root animatable to synchronize with
+         * @return the animationGroup
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-weights
+         */
+        public syncAllAnimationsWith(root: Animatable): AnimationGroup {
+            for (var index = 0; index < this._animatables.length; index++) {
+                let animatable = this._animatables[index];
+                animatable.syncWith(root);
+            }
+
+            return this;
+        }
+
+        /**
          * Goes to a specific frame in this animation group
          * Goes to a specific frame in this animation group
-         * 
          * @param frame the frame number to go to
          * @param frame the frame number to go to
          * @return the animationGroup
          * @return the animationGroup
          */
          */