|
@@ -5332,9 +5332,11 @@ var BABYLON;
|
|
* Represent an Observer registered to a given Observable object.
|
|
* Represent an Observer registered to a given Observable object.
|
|
*/
|
|
*/
|
|
var Observer = (function () {
|
|
var Observer = (function () {
|
|
- function Observer(callback, mask) {
|
|
|
|
|
|
+ function Observer(callback, mask, scope) {
|
|
|
|
+ if (scope === void 0) { scope = null; }
|
|
this.callback = callback;
|
|
this.callback = callback;
|
|
this.mask = mask;
|
|
this.mask = mask;
|
|
|
|
+ this.scope = scope;
|
|
}
|
|
}
|
|
return Observer;
|
|
return Observer;
|
|
}());
|
|
}());
|
|
@@ -5357,14 +5359,16 @@ var BABYLON;
|
|
* @param callback the callback that will be executed for that Observer
|
|
* @param callback the callback that will be executed for that Observer
|
|
* @param mask the mask used to filter observers
|
|
* @param mask the mask used to filter observers
|
|
* @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
|
|
* @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.
|
|
|
|
+ * @param scope optional scope for the callback to be called from
|
|
*/
|
|
*/
|
|
- Observable.prototype.add = function (callback, mask, insertFirst) {
|
|
|
|
|
|
+ Observable.prototype.add = function (callback, mask, insertFirst, scope) {
|
|
if (mask === void 0) { mask = -1; }
|
|
if (mask === void 0) { mask = -1; }
|
|
if (insertFirst === void 0) { insertFirst = false; }
|
|
if (insertFirst === void 0) { insertFirst = false; }
|
|
|
|
+ if (scope === void 0) { scope = null; }
|
|
if (!callback) {
|
|
if (!callback) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- var observer = new Observer(callback, mask);
|
|
|
|
|
|
+ var observer = new Observer(callback, mask, scope);
|
|
if (insertFirst) {
|
|
if (insertFirst) {
|
|
this._observers.unshift(observer);
|
|
this._observers.unshift(observer);
|
|
}
|
|
}
|
|
@@ -5415,7 +5419,12 @@ var BABYLON;
|
|
for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {
|
|
for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {
|
|
var obs = _a[_i];
|
|
var obs = _a[_i];
|
|
if (obs.mask & mask) {
|
|
if (obs.mask & mask) {
|
|
- obs.callback(eventData, state);
|
|
|
|
|
|
+ if (obs.scope) {
|
|
|
|
+ obs.callback.apply(obs.scope, [eventData, state]);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ obs.callback(eventData, state);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (state.skipNextObservers) {
|
|
if (state.skipNextObservers) {
|
|
return false;
|
|
return false;
|
|
@@ -65598,6 +65607,8 @@ var BABYLON;
|
|
if (this.hasTangents) {
|
|
if (this.hasTangents) {
|
|
serializationObject.tangents = Array.prototype.slice.call(this.getTangents());
|
|
serializationObject.tangents = Array.prototype.slice.call(this.getTangents());
|
|
}
|
|
}
|
|
|
|
+ // Animations
|
|
|
|
+ BABYLON.Animation.AppendSerializedAnimations(this, serializationObject);
|
|
return serializationObject;
|
|
return serializationObject;
|
|
};
|
|
};
|
|
// Statics
|
|
// Statics
|
|
@@ -65610,6 +65621,13 @@ var BABYLON;
|
|
if (serializationObject.tangents) {
|
|
if (serializationObject.tangents) {
|
|
result.setTangents(serializationObject.tangents);
|
|
result.setTangents(serializationObject.tangents);
|
|
}
|
|
}
|
|
|
|
+ // Animations
|
|
|
|
+ if (serializationObject.animations) {
|
|
|
|
+ for (var animationIndex = 0; animationIndex < serializationObject.animations.length; animationIndex++) {
|
|
|
|
+ var parsedAnimation = serializationObject.animations[animationIndex];
|
|
|
|
+ result.animations.push(BABYLON.Animation.Parse(parsedAnimation));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return result;
|
|
return result;
|
|
};
|
|
};
|
|
MorphTarget.FromMesh = function (mesh, name, influence) {
|
|
MorphTarget.FromMesh = function (mesh, name, influence) {
|