Browse Source

Fix issue with aniamtiongroup and gltf laoder

David Catuhe 7 năm trước cách đây
mục cha
commit
04ad4832ab

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 4164 - 4161
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 8 - 8
dist/preview release/babylon.js


+ 11 - 2
dist/preview release/babylon.max.js

@@ -47863,8 +47863,11 @@ var BABYLON;
          * Start all animations on given targets
          * @param loop defines if animations must loop
          * @param speedRatio defines the ratio to apply to animation speed (1 by default)
+         * @param from defines the from key (optional)
+         * @param from defines the to key (optional)
+         * @returns the current animation group
          */
-        AnimationGroup.prototype.start = function (loop, speedRatio) {
+        AnimationGroup.prototype.start = function (loop, speedRatio, from, to) {
             var _this = this;
             if (loop === void 0) { loop = false; }
             if (speedRatio === void 0) { speedRatio = 1; }
@@ -47873,7 +47876,13 @@ var BABYLON;
             }
             var _loop_1 = function () {
                 var targetedAnimation = this_1._targetedAnimations[index];
-                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], this_1._from, this_1._to, loop, speedRatio, function () {
+                if (!targetedAnimation.target.animations) {
+                    targetedAnimation.target.animations = [];
+                }
+                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
+                    targetedAnimation.target.animations.push(targetedAnimation.animation);
+                }
+                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 8 - 8
dist/preview release/babylon.worker.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 6606 - 6603
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 11 - 11
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 11 - 2
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -47863,8 +47863,11 @@ var BABYLON;
          * Start all animations on given targets
          * @param loop defines if animations must loop
          * @param speedRatio defines the ratio to apply to animation speed (1 by default)
+         * @param from defines the from key (optional)
+         * @param from defines the to key (optional)
+         * @returns the current animation group
          */
-        AnimationGroup.prototype.start = function (loop, speedRatio) {
+        AnimationGroup.prototype.start = function (loop, speedRatio, from, to) {
             var _this = this;
             if (loop === void 0) { loop = false; }
             if (speedRatio === void 0) { speedRatio = 1; }
@@ -47873,7 +47876,13 @@ var BABYLON;
             }
             var _loop_1 = function () {
                 var targetedAnimation = this_1._targetedAnimations[index];
-                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], this_1._from, this_1._to, loop, speedRatio, function () {
+                if (!targetedAnimation.target.animations) {
+                    targetedAnimation.target.animations = [];
+                }
+                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
+                    targetedAnimation.target.animations.push(targetedAnimation.animation);
+                }
+                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };

+ 11 - 2
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -47817,8 +47817,11 @@ var BABYLON;
          * Start all animations on given targets
          * @param loop defines if animations must loop
          * @param speedRatio defines the ratio to apply to animation speed (1 by default)
+         * @param from defines the from key (optional)
+         * @param from defines the to key (optional)
+         * @returns the current animation group
          */
-        AnimationGroup.prototype.start = function (loop, speedRatio) {
+        AnimationGroup.prototype.start = function (loop, speedRatio, from, to) {
             var _this = this;
             if (loop === void 0) { loop = false; }
             if (speedRatio === void 0) { speedRatio = 1; }
@@ -47827,7 +47830,13 @@ var BABYLON;
             }
             var _loop_1 = function () {
                 var targetedAnimation = this_1._targetedAnimations[index];
-                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], this_1._from, this_1._to, loop, speedRatio, function () {
+                if (!targetedAnimation.target.animations) {
+                    targetedAnimation.target.animations = [];
+                }
+                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
+                    targetedAnimation.target.animations.push(targetedAnimation.animation);
+                }
+                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };

+ 11 - 2
dist/preview release/es6.js

@@ -47817,8 +47817,11 @@ var BABYLON;
          * Start all animations on given targets
          * @param loop defines if animations must loop
          * @param speedRatio defines the ratio to apply to animation speed (1 by default)
+         * @param from defines the from key (optional)
+         * @param from defines the to key (optional)
+         * @returns the current animation group
          */
-        AnimationGroup.prototype.start = function (loop, speedRatio) {
+        AnimationGroup.prototype.start = function (loop, speedRatio, from, to) {
             var _this = this;
             if (loop === void 0) { loop = false; }
             if (speedRatio === void 0) { speedRatio = 1; }
@@ -47827,7 +47830,13 @@ var BABYLON;
             }
             var _loop_1 = function () {
                 var targetedAnimation = this_1._targetedAnimations[index];
-                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], this_1._from, this_1._to, loop, speedRatio, function () {
+                if (!targetedAnimation.target.animations) {
+                    targetedAnimation.target.animations = [];
+                }
+                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
+                    targetedAnimation.target.animations.push(targetedAnimation.animation);
+                }
+                this_1._animatables.push(this_1._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this_1._from, to !== undefined ? to : this_1._to, loop, speedRatio, function () {
                     _this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             };

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 35 - 35
dist/preview release/viewer/babylon.viewer.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 88 - 63
dist/preview release/viewer/babylon.viewer.max.js


+ 12 - 2
src/Animations/babylon.animationGroup.ts

@@ -144,15 +144,25 @@ module BABYLON {
          * Start all animations on given targets
          * @param loop defines if animations must loop
          * @param speedRatio defines the ratio to apply to animation speed (1 by default)
+         * @param from defines the from key (optional)
+         * @param from defines the to key (optional)
+         * @returns the current animation group
          */
-        public start(loop = false, speedRatio = 1): AnimationGroup {
+        public start(loop = false, speedRatio = 1, from?: number, to?: number): AnimationGroup {
             if (this._isStarted || this._targetedAnimations.length === 0) {
                 return this;
             }
 
             for (var index = 0; index < this._targetedAnimations.length; index++) {
                 let targetedAnimation = this._targetedAnimations[index];
-                this._animatables.push(this._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], this._from, this._to, loop, speedRatio, () => {
+                if (!targetedAnimation.target.animations) {
+                    targetedAnimation.target.animations = [];
+                }
+                if (targetedAnimation.target.animations.indexOf(targetedAnimation.animation) === -1) {
+                    targetedAnimation.target.animations.push(targetedAnimation.animation);
+                }
+                
+                this._animatables.push(this._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this._from, to !== undefined ? to : this._to, loop, speedRatio, () => {
                     this.onAnimationEndObservable.notifyObservers(targetedAnimation);
                 }));
             }