|
@@ -50587,6 +50587,10 @@ var BABYLON;
|
|
|
*/
|
|
|
this.isDone = false;
|
|
|
}
|
|
|
+ /** @hidden */
|
|
|
+ AnimationEvent.prototype._clone = function () {
|
|
|
+ return new AnimationEvent(this.frame, this.action, this.onlyOnce);
|
|
|
+ };
|
|
|
return AnimationEvent;
|
|
|
}());
|
|
|
BABYLON.AnimationEvent = AnimationEvent;
|
|
@@ -51989,6 +51993,8 @@ var BABYLON;
|
|
|
* @param host defines the initiating Animatable
|
|
|
*/
|
|
|
function RuntimeAnimation(target, animation, scene, host) {
|
|
|
+ var _this = this;
|
|
|
+ this._events = new Array();
|
|
|
/**
|
|
|
* The current frame of the runtime animation
|
|
|
*/
|
|
@@ -52038,6 +52044,13 @@ var BABYLON;
|
|
|
this._scene = scene;
|
|
|
this._host = host;
|
|
|
animation._runtimeAnimations.push(this);
|
|
|
+ // Cloning events locally
|
|
|
+ var events = animation.getEvents();
|
|
|
+ if (events && events.length > 0) {
|
|
|
+ events.forEach(function (e) {
|
|
|
+ _this._events.push(e._clone());
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
Object.defineProperty(RuntimeAnimation.prototype, "currentFrame", {
|
|
|
/**
|
|
@@ -52127,6 +52140,10 @@ var BABYLON;
|
|
|
this._currentFrame = 0;
|
|
|
this._blendingFactor = 0;
|
|
|
this._originalValue = new Array();
|
|
|
+ // Events
|
|
|
+ for (var index = 0; index < this._events.length; index++) {
|
|
|
+ this._events[index].isDone = false;
|
|
|
+ }
|
|
|
};
|
|
|
/**
|
|
|
* Specifies if the runtime animation is stopped
|
|
@@ -52422,7 +52439,7 @@ var BABYLON;
|
|
|
currentFrame = from + (to - from) * hostNormalizedFrame;
|
|
|
}
|
|
|
// Reset events if looping
|
|
|
- var events = this._animation.getEvents();
|
|
|
+ var events = this._events;
|
|
|
if (range > 0 && this.currentFrame > currentFrame ||
|
|
|
range < 0 && this.currentFrame < currentFrame) {
|
|
|
// Need to reset animation events
|