Prechádzať zdrojové kódy

Added a few observables to actions

David Catuhe 8 rokov pred
rodič
commit
f39fa91d68

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 4804 - 4802
dist/preview release/babylon.d.ts


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 12 - 12
dist/preview release/babylon.js


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

@@ -38767,6 +38767,7 @@ var BABYLON;
     var Action = (function () {
         function Action(triggerOptions, condition) {
             this.triggerOptions = triggerOptions;
+            this.onBeforeExecuteObservable = new BABYLON.Observable();
             if (triggerOptions.parameter) {
                 this.trigger = triggerOptions.trigger;
                 this._triggerParameter = triggerOptions.parameter;
@@ -38802,6 +38803,7 @@ var BABYLON;
                     condition._currentResult = true;
                 }
             }
+            this.onBeforeExecuteObservable.notifyObservers(this);
             this._nextActiveAction.execute(evt);
             this.skipToNextActiveAction();
         };
@@ -39524,6 +39526,7 @@ var BABYLON;
             _this.duration = duration;
             _this.stopOtherAnimations = stopOtherAnimations;
             _this.onInterpolationDone = onInterpolationDone;
+            _this.onInterpolationDoneObservable = new BABYLON.Observable();
             _this._target = _this._effectiveTarget = target;
             return _this;
         }
@@ -39532,6 +39535,7 @@ var BABYLON;
             this._property = this._getProperty(this.propertyPath);
         };
         InterpolateValueAction.prototype.execute = function () {
+            var _this = this;
             var scene = this._actionManager.getScene();
             var keys = [
                 {
@@ -39567,7 +39571,13 @@ var BABYLON;
             if (this.stopOtherAnimations) {
                 scene.stopAnimation(this._effectiveTarget);
             }
-            scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, this.onInterpolationDone);
+            var wrapper = function () {
+                _this.onInterpolationDoneObservable.notifyObservers(_this);
+                if (_this.onInterpolationDone) {
+                    _this.onInterpolationDone();
+                }
+            };
+            scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, wrapper);
         };
         InterpolateValueAction.prototype.serialize = function (parent) {
             return _super.prototype._serialize.call(this, {

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 4804 - 4802
dist/preview release/babylon.module.d.ts


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 12 - 12
dist/preview release/babylon.worker.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 6782 - 6780
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 12 - 12
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


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

@@ -38767,6 +38767,7 @@ var BABYLON;
     var Action = (function () {
         function Action(triggerOptions, condition) {
             this.triggerOptions = triggerOptions;
+            this.onBeforeExecuteObservable = new BABYLON.Observable();
             if (triggerOptions.parameter) {
                 this.trigger = triggerOptions.trigger;
                 this._triggerParameter = triggerOptions.parameter;
@@ -38802,6 +38803,7 @@ var BABYLON;
                     condition._currentResult = true;
                 }
             }
+            this.onBeforeExecuteObservable.notifyObservers(this);
             this._nextActiveAction.execute(evt);
             this.skipToNextActiveAction();
         };
@@ -39524,6 +39526,7 @@ var BABYLON;
             _this.duration = duration;
             _this.stopOtherAnimations = stopOtherAnimations;
             _this.onInterpolationDone = onInterpolationDone;
+            _this.onInterpolationDoneObservable = new BABYLON.Observable();
             _this._target = _this._effectiveTarget = target;
             return _this;
         }
@@ -39532,6 +39535,7 @@ var BABYLON;
             this._property = this._getProperty(this.propertyPath);
         };
         InterpolateValueAction.prototype.execute = function () {
+            var _this = this;
             var scene = this._actionManager.getScene();
             var keys = [
                 {
@@ -39567,7 +39571,13 @@ var BABYLON;
             if (this.stopOtherAnimations) {
                 scene.stopAnimation(this._effectiveTarget);
             }
-            scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, this.onInterpolationDone);
+            var wrapper = function () {
+                _this.onInterpolationDoneObservable.notifyObservers(_this);
+                if (_this.onInterpolationDone) {
+                    _this.onInterpolationDone();
+                }
+            };
+            scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, wrapper);
         };
         InterpolateValueAction.prototype.serialize = function (parent) {
             return _super.prototype._serialize.call(this, {

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 6782 - 6780
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 4 - 1
src/Actions/babylon.action.ts

@@ -8,6 +8,8 @@
         private _condition: Condition;
         private _triggerParameter: any;
 
+        public onBeforeExecuteObservable = new Observable<Action>();
+
         constructor(public triggerOptions: any, condition?: Condition) {
 
             if (triggerOptions.parameter) {
@@ -50,7 +52,8 @@
                     condition._currentResult = true;
                 }
             }
-
+            
+            this.onBeforeExecuteObservable.notifyObservers(this);
             this._nextActiveAction.execute(evt);
 
             this.skipToNextActiveAction();

+ 10 - 1
src/Actions/babylon.interpolateValueAction.ts

@@ -4,6 +4,8 @@
         private _effectiveTarget: any;
         private _property: string;
 
+        public onInterpolationDoneObservable = new Observable<InterpolateValueAction>();
+
         constructor(triggerOptions: any, target: any, public propertyPath: string, public value: any, public duration: number = 1000, condition?: Condition, public stopOtherAnimations?: boolean, public onInterpolationDone?: () => void) {
             super(triggerOptions, condition);
 
@@ -52,7 +54,14 @@
                 scene.stopAnimation(this._effectiveTarget);
             }
 
-            scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, this.onInterpolationDone);
+            let wrapper = ()=> {
+                this.onInterpolationDoneObservable.notifyObservers(this);
+                if (this.onInterpolationDone) {
+                    this.onInterpolationDone();
+                }
+            }
+
+            scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, wrapper);
         }
         
         public serialize(parent: any): any {