|
@@ -10,17 +10,26 @@ var BABYLON;
|
|
function SwitchBooleanAction(triggerOptions, target, propertyPath, condition) {
|
|
function SwitchBooleanAction(triggerOptions, target, propertyPath, condition) {
|
|
_super.call(this, triggerOptions, condition);
|
|
_super.call(this, triggerOptions, condition);
|
|
this.propertyPath = propertyPath;
|
|
this.propertyPath = propertyPath;
|
|
- this._target = target;
|
|
|
|
|
|
+ this._target = this._effectiveTarget = target;
|
|
}
|
|
}
|
|
SwitchBooleanAction.prototype._prepare = function () {
|
|
SwitchBooleanAction.prototype._prepare = function () {
|
|
- this._target = this._getEffectiveTarget(this._target, this.propertyPath);
|
|
|
|
|
|
+ this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
|
|
this._property = this._getProperty(this.propertyPath);
|
|
this._property = this._getProperty(this.propertyPath);
|
|
};
|
|
};
|
|
SwitchBooleanAction.prototype.execute = function () {
|
|
SwitchBooleanAction.prototype.execute = function () {
|
|
- this._target[this._property] = !this._target[this._property];
|
|
|
|
|
|
+ this._effectiveTarget[this._property] = !this._effectiveTarget[this._property];
|
|
|
|
+ };
|
|
|
|
+ SwitchBooleanAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "SwitchBooleanAction",
|
|
|
|
+ properties: [
|
|
|
|
+ BABYLON.Action._GetTargetProperty(this._target),
|
|
|
|
+ { name: "propertyPath", value: this.propertyPath }
|
|
|
|
+ ]
|
|
|
|
+ }, parent);
|
|
};
|
|
};
|
|
return SwitchBooleanAction;
|
|
return SwitchBooleanAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.SwitchBooleanAction = SwitchBooleanAction;
|
|
BABYLON.SwitchBooleanAction = SwitchBooleanAction;
|
|
var SetStateAction = (function (_super) {
|
|
var SetStateAction = (function (_super) {
|
|
__extends(SetStateAction, _super);
|
|
__extends(SetStateAction, _super);
|
|
@@ -32,8 +41,17 @@ var BABYLON;
|
|
SetStateAction.prototype.execute = function () {
|
|
SetStateAction.prototype.execute = function () {
|
|
this._target.state = this.value;
|
|
this._target.state = this.value;
|
|
};
|
|
};
|
|
|
|
+ SetStateAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "SetStateAction",
|
|
|
|
+ properties: [
|
|
|
|
+ BABYLON.Action._GetTargetProperty(this._target),
|
|
|
|
+ { name: "value", value: this.value }
|
|
|
|
+ ]
|
|
|
|
+ }, parent);
|
|
|
|
+ };
|
|
return SetStateAction;
|
|
return SetStateAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.SetStateAction = SetStateAction;
|
|
BABYLON.SetStateAction = SetStateAction;
|
|
var SetValueAction = (function (_super) {
|
|
var SetValueAction = (function (_super) {
|
|
__extends(SetValueAction, _super);
|
|
__extends(SetValueAction, _super);
|
|
@@ -41,17 +59,27 @@ var BABYLON;
|
|
_super.call(this, triggerOptions, condition);
|
|
_super.call(this, triggerOptions, condition);
|
|
this.propertyPath = propertyPath;
|
|
this.propertyPath = propertyPath;
|
|
this.value = value;
|
|
this.value = value;
|
|
- this._target = target;
|
|
|
|
|
|
+ this._target = this._effectiveTarget = target;
|
|
}
|
|
}
|
|
SetValueAction.prototype._prepare = function () {
|
|
SetValueAction.prototype._prepare = function () {
|
|
- this._target = this._getEffectiveTarget(this._target, this.propertyPath);
|
|
|
|
|
|
+ this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
|
|
this._property = this._getProperty(this.propertyPath);
|
|
this._property = this._getProperty(this.propertyPath);
|
|
};
|
|
};
|
|
SetValueAction.prototype.execute = function () {
|
|
SetValueAction.prototype.execute = function () {
|
|
- this._target[this._property] = this.value;
|
|
|
|
|
|
+ this._effectiveTarget[this._property] = this.value;
|
|
|
|
+ };
|
|
|
|
+ SetValueAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "SetValueAction",
|
|
|
|
+ properties: [
|
|
|
|
+ BABYLON.Action._GetTargetProperty(this._target),
|
|
|
|
+ { name: "propertyPath", value: this.propertyPath },
|
|
|
|
+ { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) }
|
|
|
|
+ ]
|
|
|
|
+ }, parent);
|
|
};
|
|
};
|
|
return SetValueAction;
|
|
return SetValueAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.SetValueAction = SetValueAction;
|
|
BABYLON.SetValueAction = SetValueAction;
|
|
var IncrementValueAction = (function (_super) {
|
|
var IncrementValueAction = (function (_super) {
|
|
__extends(IncrementValueAction, _super);
|
|
__extends(IncrementValueAction, _super);
|
|
@@ -59,20 +87,30 @@ var BABYLON;
|
|
_super.call(this, triggerOptions, condition);
|
|
_super.call(this, triggerOptions, condition);
|
|
this.propertyPath = propertyPath;
|
|
this.propertyPath = propertyPath;
|
|
this.value = value;
|
|
this.value = value;
|
|
- this._target = target;
|
|
|
|
|
|
+ this._target = this._effectiveTarget = target;
|
|
}
|
|
}
|
|
IncrementValueAction.prototype._prepare = function () {
|
|
IncrementValueAction.prototype._prepare = function () {
|
|
- this._target = this._getEffectiveTarget(this._target, this.propertyPath);
|
|
|
|
|
|
+ this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
|
|
this._property = this._getProperty(this.propertyPath);
|
|
this._property = this._getProperty(this.propertyPath);
|
|
- if (typeof this._target[this._property] !== "number") {
|
|
|
|
|
|
+ if (typeof this._effectiveTarget[this._property] !== "number") {
|
|
BABYLON.Tools.Warn("Warning: IncrementValueAction can only be used with number values");
|
|
BABYLON.Tools.Warn("Warning: IncrementValueAction can only be used with number values");
|
|
}
|
|
}
|
|
};
|
|
};
|
|
IncrementValueAction.prototype.execute = function () {
|
|
IncrementValueAction.prototype.execute = function () {
|
|
- this._target[this._property] += this.value;
|
|
|
|
|
|
+ this._effectiveTarget[this._property] += this.value;
|
|
|
|
+ };
|
|
|
|
+ IncrementValueAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "IncrementValueAction",
|
|
|
|
+ properties: [
|
|
|
|
+ BABYLON.Action._GetTargetProperty(this._target),
|
|
|
|
+ { name: "propertyPath", value: this.propertyPath },
|
|
|
|
+ { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) }
|
|
|
|
+ ]
|
|
|
|
+ }, parent);
|
|
};
|
|
};
|
|
return IncrementValueAction;
|
|
return IncrementValueAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.IncrementValueAction = IncrementValueAction;
|
|
BABYLON.IncrementValueAction = IncrementValueAction;
|
|
var PlayAnimationAction = (function (_super) {
|
|
var PlayAnimationAction = (function (_super) {
|
|
__extends(PlayAnimationAction, _super);
|
|
__extends(PlayAnimationAction, _super);
|
|
@@ -89,8 +127,19 @@ var BABYLON;
|
|
var scene = this._actionManager.getScene();
|
|
var scene = this._actionManager.getScene();
|
|
scene.beginAnimation(this._target, this.from, this.to, this.loop);
|
|
scene.beginAnimation(this._target, this.from, this.to, this.loop);
|
|
};
|
|
};
|
|
|
|
+ PlayAnimationAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "PlayAnimationAction",
|
|
|
|
+ properties: [
|
|
|
|
+ BABYLON.Action._GetTargetProperty(this._target),
|
|
|
|
+ { name: "from", value: String(this.from) },
|
|
|
|
+ { name: "to", value: String(this.to) },
|
|
|
|
+ { name: "loop", value: BABYLON.Action._SerializeValueAsString(this.loop) || false }
|
|
|
|
+ ]
|
|
|
|
+ }, parent);
|
|
|
|
+ };
|
|
return PlayAnimationAction;
|
|
return PlayAnimationAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.PlayAnimationAction = PlayAnimationAction;
|
|
BABYLON.PlayAnimationAction = PlayAnimationAction;
|
|
var StopAnimationAction = (function (_super) {
|
|
var StopAnimationAction = (function (_super) {
|
|
__extends(StopAnimationAction, _super);
|
|
__extends(StopAnimationAction, _super);
|
|
@@ -104,8 +153,14 @@ var BABYLON;
|
|
var scene = this._actionManager.getScene();
|
|
var scene = this._actionManager.getScene();
|
|
scene.stopAnimation(this._target);
|
|
scene.stopAnimation(this._target);
|
|
};
|
|
};
|
|
|
|
+ StopAnimationAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "StopAnimationAction",
|
|
|
|
+ properties: [BABYLON.Action._GetTargetProperty(this._target)]
|
|
|
|
+ }, parent);
|
|
|
|
+ };
|
|
return StopAnimationAction;
|
|
return StopAnimationAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.StopAnimationAction = StopAnimationAction;
|
|
BABYLON.StopAnimationAction = StopAnimationAction;
|
|
var DoNothingAction = (function (_super) {
|
|
var DoNothingAction = (function (_super) {
|
|
__extends(DoNothingAction, _super);
|
|
__extends(DoNothingAction, _super);
|
|
@@ -115,8 +170,14 @@ var BABYLON;
|
|
}
|
|
}
|
|
DoNothingAction.prototype.execute = function () {
|
|
DoNothingAction.prototype.execute = function () {
|
|
};
|
|
};
|
|
|
|
+ DoNothingAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "DoNothingAction",
|
|
|
|
+ properties: []
|
|
|
|
+ }, parent);
|
|
|
|
+ };
|
|
return DoNothingAction;
|
|
return DoNothingAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.DoNothingAction = DoNothingAction;
|
|
BABYLON.DoNothingAction = DoNothingAction;
|
|
var CombineAction = (function (_super) {
|
|
var CombineAction = (function (_super) {
|
|
__extends(CombineAction, _super);
|
|
__extends(CombineAction, _super);
|
|
@@ -135,8 +196,19 @@ var BABYLON;
|
|
this.children[index].execute(evt);
|
|
this.children[index].execute(evt);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ CombineAction.prototype.serialize = function (parent) {
|
|
|
|
+ var serializationObject = _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "CombineAction",
|
|
|
|
+ properties: [],
|
|
|
|
+ combine: []
|
|
|
|
+ }, parent);
|
|
|
|
+ for (var i = 0; i < this.children.length; i++) {
|
|
|
|
+ serializationObject.combine.push(this.children[i].serialize(null));
|
|
|
|
+ }
|
|
|
|
+ return serializationObject;
|
|
|
|
+ };
|
|
return CombineAction;
|
|
return CombineAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.CombineAction = CombineAction;
|
|
BABYLON.CombineAction = CombineAction;
|
|
var ExecuteCodeAction = (function (_super) {
|
|
var ExecuteCodeAction = (function (_super) {
|
|
__extends(ExecuteCodeAction, _super);
|
|
__extends(ExecuteCodeAction, _super);
|
|
@@ -148,7 +220,7 @@ var BABYLON;
|
|
this.func(evt);
|
|
this.func(evt);
|
|
};
|
|
};
|
|
return ExecuteCodeAction;
|
|
return ExecuteCodeAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.ExecuteCodeAction = ExecuteCodeAction;
|
|
BABYLON.ExecuteCodeAction = ExecuteCodeAction;
|
|
var SetParentAction = (function (_super) {
|
|
var SetParentAction = (function (_super) {
|
|
__extends(SetParentAction, _super);
|
|
__extends(SetParentAction, _super);
|
|
@@ -168,8 +240,17 @@ var BABYLON;
|
|
this._target.position = BABYLON.Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);
|
|
this._target.position = BABYLON.Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);
|
|
this._target.parent = this._parent;
|
|
this._target.parent = this._parent;
|
|
};
|
|
};
|
|
|
|
+ SetParentAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "SetParentAction",
|
|
|
|
+ properties: [
|
|
|
|
+ BABYLON.Action._GetTargetProperty(this._target),
|
|
|
|
+ BABYLON.Action._GetTargetProperty(this._parent),
|
|
|
|
+ ]
|
|
|
|
+ }, parent);
|
|
|
|
+ };
|
|
return SetParentAction;
|
|
return SetParentAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.SetParentAction = SetParentAction;
|
|
BABYLON.SetParentAction = SetParentAction;
|
|
var PlaySoundAction = (function (_super) {
|
|
var PlaySoundAction = (function (_super) {
|
|
__extends(PlaySoundAction, _super);
|
|
__extends(PlaySoundAction, _super);
|
|
@@ -183,8 +264,14 @@ var BABYLON;
|
|
if (this._sound !== undefined)
|
|
if (this._sound !== undefined)
|
|
this._sound.play();
|
|
this._sound.play();
|
|
};
|
|
};
|
|
|
|
+ PlaySoundAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "PlaySoundAction",
|
|
|
|
+ properties: [{ name: "sound", value: this._sound.name }]
|
|
|
|
+ }, parent);
|
|
|
|
+ };
|
|
return PlaySoundAction;
|
|
return PlaySoundAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.PlaySoundAction = PlaySoundAction;
|
|
BABYLON.PlaySoundAction = PlaySoundAction;
|
|
var StopSoundAction = (function (_super) {
|
|
var StopSoundAction = (function (_super) {
|
|
__extends(StopSoundAction, _super);
|
|
__extends(StopSoundAction, _super);
|
|
@@ -198,7 +285,13 @@ var BABYLON;
|
|
if (this._sound !== undefined)
|
|
if (this._sound !== undefined)
|
|
this._sound.stop();
|
|
this._sound.stop();
|
|
};
|
|
};
|
|
|
|
+ StopSoundAction.prototype.serialize = function (parent) {
|
|
|
|
+ return _super.prototype._serialize.call(this, {
|
|
|
|
+ name: "StopSoundAction",
|
|
|
|
+ properties: [{ name: "sound", value: this._sound.name }]
|
|
|
|
+ }, parent);
|
|
|
|
+ };
|
|
return StopSoundAction;
|
|
return StopSoundAction;
|
|
- })(BABYLON.Action);
|
|
|
|
|
|
+ }(BABYLON.Action));
|
|
BABYLON.StopSoundAction = StopSoundAction;
|
|
BABYLON.StopSoundAction = StopSoundAction;
|
|
})(BABYLON || (BABYLON = {}));
|
|
})(BABYLON || (BABYLON = {}));
|