|
@@ -20040,6 +20040,17 @@ var BABYLON;
|
|
animatable.reset();
|
|
animatable.reset();
|
|
return animatable;
|
|
return animatable;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Begin a new animation on a given node
|
|
|
|
+ * @param {BABYLON.Node} node defines the root node where the animation will take place
|
|
|
|
+ * @param {BABYLON.Animation[]} defines the list of animations to start
|
|
|
|
+ * @param {number} from defines the initial value
|
|
|
|
+ * @param {number} to defines the final value
|
|
|
|
+ * @param {boolean} loop defines if you want animation to loop (off by default)
|
|
|
|
+ * @param {number} speedRatio defines the speed ratio to apply to all animations
|
|
|
|
+ * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)
|
|
|
|
+ * @returns the list of created animatables
|
|
|
|
+ */
|
|
Scene.prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd) {
|
|
Scene.prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd) {
|
|
if (speedRatio === undefined) {
|
|
if (speedRatio === undefined) {
|
|
speedRatio = 1.0;
|
|
speedRatio = 1.0;
|
|
@@ -20047,6 +20058,27 @@ var BABYLON;
|
|
var animatable = new BABYLON.Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations);
|
|
var animatable = new BABYLON.Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations);
|
|
return animatable;
|
|
return animatable;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Begin a new animation on a given node and its hierarchy
|
|
|
|
+ * @param {BABYLON.Node} node defines the root node where the animation will take place
|
|
|
|
+ * @param {boolean} directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.
|
|
|
|
+ * @param {BABYLON.Animation[]} defines the list of animations to start
|
|
|
|
+ * @param {number} from defines the initial value
|
|
|
|
+ * @param {number} to defines the final value
|
|
|
|
+ * @param {boolean} loop defines if you want animation to loop (off by default)
|
|
|
|
+ * @param {number} speedRatio defines the speed ratio to apply to all animations
|
|
|
|
+ * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)
|
|
|
|
+ * @returns the list of animatables created for all nodes
|
|
|
|
+ */
|
|
|
|
+ Scene.prototype.beginDirectHierarchyAnimation = function (target, directDescendantsOnly, animations, from, to, loop, speedRatio, onAnimationEnd) {
|
|
|
|
+ var children = target.getDescendants(directDescendantsOnly);
|
|
|
|
+ var result = [];
|
|
|
|
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
|
|
|
+ var child = children_1[_i];
|
|
|
|
+ result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd));
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ };
|
|
Scene.prototype.getAnimatableByTarget = function (target) {
|
|
Scene.prototype.getAnimatableByTarget = function (target) {
|
|
for (var index = 0; index < this._activeAnimatables.length; index++) {
|
|
for (var index = 0; index < this._activeAnimatables.length; index++) {
|
|
if (this._activeAnimatables[index].target === target) {
|
|
if (this._activeAnimatables[index].target === target) {
|
|
@@ -41776,6 +41808,20 @@ var BABYLON;
|
|
animation.setEasingFunction(easingFunction);
|
|
animation.setEasingFunction(easingFunction);
|
|
return animation;
|
|
return animation;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Create and start an animation on a node
|
|
|
|
+ * @param {string} name defines the name of the global animation that will be run on all nodes
|
|
|
|
+ * @param {BABYLON.Node} node defines the root node where the animation will take place
|
|
|
|
+ * @param {string} targetProperty defines property to animate
|
|
|
|
+ * @param {number} framePerSecond defines the number of frame per second yo use
|
|
|
|
+ * @param {number} totalFrame defines the number of frames in total
|
|
|
|
+ * @param {any} from defines the initial value
|
|
|
|
+ * @param {any} to defines the final value
|
|
|
|
+ * @param {number} loopMode defines which loop mode you want to use (off by default)
|
|
|
|
+ * @param {BABYLON.EasingFunction} easingFunction defines the easing function to use (linear by default)
|
|
|
|
+ * @param onAnimationEnd defines the callback to call when animation end
|
|
|
|
+ * @returns the animatable created for this animation
|
|
|
|
+ */
|
|
Animation.CreateAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
|
|
Animation.CreateAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
|
|
var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
|
|
var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
|
|
if (!animation) {
|
|
if (!animation) {
|
|
@@ -41783,6 +41829,30 @@ var BABYLON;
|
|
}
|
|
}
|
|
return node.getScene().beginDirectAnimation(node, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
|
|
return node.getScene().beginDirectAnimation(node, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Create and start an animation on a node and its descendants
|
|
|
|
+ * @param {string} name defines the name of the global animation that will be run on all nodes
|
|
|
|
+ * @param {BABYLON.Node} node defines the root node where the animation will take place
|
|
|
|
+ * @param {boolean} directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.
|
|
|
|
+ * @param {string} targetProperty defines property to animate
|
|
|
|
+ * @param {number} framePerSecond defines the number of frame per second yo use
|
|
|
|
+ * @param {number} totalFrame defines the number of frames in total
|
|
|
|
+ * @param {any} from defines the initial value
|
|
|
|
+ * @param {any} to defines the final value
|
|
|
|
+ * @param {number} loopMode defines which loop mode you want to use (off by default)
|
|
|
|
+ * @param {BABYLON.EasingFunction} easingFunction defines the easing function to use (linear by default)
|
|
|
|
+ * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)
|
|
|
|
+ * @returns the list of animatables created for all nodes
|
|
|
|
+ * @example https://www.babylonjs-playground.com/#MH0VLI
|
|
|
|
+ */
|
|
|
|
+ Animation.CreateAndStartHierarchyAnimation = function (name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
|
|
|
|
+ var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
|
|
|
|
+ if (!animation) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ var scene = node.getScene();
|
|
|
|
+ return scene.beginDirectHierarchyAnimation(node, directDescendantsOnly, [animation], 0, totalFrame, (animation.loopMode === 1), 1.0, onAnimationEnd);
|
|
|
|
+ };
|
|
Animation.CreateMergeAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
|
|
Animation.CreateMergeAndStartAnimation = function (name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {
|
|
var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
|
|
var animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);
|
|
if (!animation) {
|
|
if (!animation) {
|
|
@@ -77434,6 +77504,7 @@ var BABYLON;
|
|
BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
|
|
BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
|
|
var AssetsManager = /** @class */ (function () {
|
|
var AssetsManager = /** @class */ (function () {
|
|
function AssetsManager(scene) {
|
|
function AssetsManager(scene) {
|
|
|
|
+ this._isLoading = false;
|
|
this.tasks = new Array();
|
|
this.tasks = new Array();
|
|
this.waitingTasksCount = 0;
|
|
this.waitingTasksCount = 0;
|
|
//Observables
|
|
//Observables
|
|
@@ -77507,6 +77578,7 @@ var BABYLON;
|
|
BABYLON.Tools.Error("Error running tasks-done callbacks.");
|
|
BABYLON.Tools.Error("Error running tasks-done callbacks.");
|
|
console.log(e);
|
|
console.log(e);
|
|
}
|
|
}
|
|
|
|
+ this._isLoading = false;
|
|
this._scene.getEngine().hideLoadingUI();
|
|
this._scene.getEngine().hideLoadingUI();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -77538,16 +77610,22 @@ var BABYLON;
|
|
task.run(this._scene, done, error);
|
|
task.run(this._scene, done, error);
|
|
};
|
|
};
|
|
AssetsManager.prototype.reset = function () {
|
|
AssetsManager.prototype.reset = function () {
|
|
|
|
+ this._isLoading = false;
|
|
this.tasks = new Array();
|
|
this.tasks = new Array();
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
AssetsManager.prototype.load = function () {
|
|
AssetsManager.prototype.load = function () {
|
|
|
|
+ if (this._isLoading) {
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+ this._isLoading = true;
|
|
this.waitingTasksCount = this.tasks.length;
|
|
this.waitingTasksCount = this.tasks.length;
|
|
if (this.waitingTasksCount === 0) {
|
|
if (this.waitingTasksCount === 0) {
|
|
if (this.onFinish) {
|
|
if (this.onFinish) {
|
|
this.onFinish(this.tasks);
|
|
this.onFinish(this.tasks);
|
|
}
|
|
}
|
|
this.onTasksDoneObservable.notifyObservers(this.tasks);
|
|
this.onTasksDoneObservable.notifyObservers(this.tasks);
|
|
|
|
+ this._isLoading = false;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
if (this.useDefaultLoadingScreen) {
|
|
if (this.useDefaultLoadingScreen) {
|