Przeglądaj źródła

Adding markAsDirty on actions

David Catuhe 9 lat temu
rodzic
commit
6d857752e4

+ 8 - 0
src/Actions/babylon.directActions.ts

@@ -69,6 +69,10 @@
 
         public execute(): void {
             this._effectiveTarget[this._property] = this.value;
+
+            if (this._target.markAsDirty) {
+                this._target.markAsDirty(this._property);
+            }
         }
         
         public serialize(parent: any): any {
@@ -104,6 +108,10 @@
 
         public execute(): void {
             this._effectiveTarget[this._property] += this.value;
+
+            if (this._target.markAsDirty) {
+                this._target.markAsDirty(this._property);
+            }
         }
         
         public serialize(parent: any): any {

+ 8 - 9
src/Animations/babylon.animation.ts

@@ -468,16 +468,15 @@
                 destination = this._target;
             }
 
-            if (!this._originalBlendValue) {
-                if (destination[path].clone) {
-                    this._originalBlendValue = destination[path].clone();
-                } else {
-                    this._originalBlendValue = destination[path];
-                }
-            }
-
             // Blending
             if (this.enableBlending && this._blendingFactor <= 1.0) {
+                if (!this._originalBlendValue) {
+                    if (destination[path].clone) {
+                        this._originalBlendValue = destination[path].clone();
+                    } else {
+                        this._originalBlendValue = destination[path];
+                    }
+                }
 
                 if (this._originalBlendValue.prototype) { // Complex value
                     
@@ -498,7 +497,7 @@
             }
 
             if (this._target.markAsDirty) {
-                this._target.markAsDirty(this.targetProperty, this._originalBlendValue);
+                this._target.markAsDirty(this.targetProperty);
             }
         }