Browse Source

Fix particle helper test

David Catuhe 7 years ago
parent
commit
6643eeac6d

File diff suppressed because it is too large
+ 8663 - 8581
Playground/babylon.d.txt


File diff suppressed because it is too large
+ 1579 - 1580
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.js


+ 77 - 6
dist/preview release/babylon.max.js

@@ -51475,7 +51475,28 @@ var BABYLON;
      * Class used to store an actual running animation
      */
     var Animatable = /** @class */ (function () {
-        function Animatable(scene, target, fromFrame, toFrame, loopAnimation, speedRatio, onAnimationEnd, animations) {
+        /**
+         * Creates a new Animatable
+         * @param scene defines the hosting scene
+         * @param target defines the target object
+         * @param fromFrame defines the starting frame number (default is 0)
+         * @param toFrame defines the ending frame number (default is 100)
+         * @param loopAnimation defines if the animation must loop (default is false)
+         * @param speedRatio defines the factor to apply to animation speed (default is 1)
+         * @param onAnimationEnd defines a callback to call when animation ends if it is not looping
+         * @param animations defines a group of animation to add to the new Animatable
+         */
+        function Animatable(scene, 
+        /** defines the target object */
+        target, 
+        /** defines the starting frame number (default is 0) */
+        fromFrame, 
+        /** defines the ending frame number (default is 100) */
+        toFrame, 
+        /** defines if the animation must loop (default is false)  */
+        loopAnimation, speedRatio, 
+        /** defines a callback to call when animation ends if it is not looping */
+        onAnimationEnd, animations) {
             if (fromFrame === void 0) { fromFrame = 0; }
             if (toFrame === void 0) { toFrame = 100; }
             if (loopAnimation === void 0) { loopAnimation = false; }
@@ -51589,15 +51610,29 @@ var BABYLON;
             }
             return this;
         };
+        /**
+         * Gets the list of runtime animations
+         * @returns an array of RuntimeAnimation
+         */
         Animatable.prototype.getAnimations = function () {
             return this._runtimeAnimations;
         };
+        /**
+         * Adds more animations to the current animatable
+         * @param target defines the target of the animations
+         * @param animations defines the new animations to add
+         */
         Animatable.prototype.appendAnimations = function (target, animations) {
             for (var index = 0; index < animations.length; index++) {
                 var animation = animations[index];
                 this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation, this._scene, this));
             }
         };
+        /**
+         * Gets the source animation for a specific property
+         * @param property defines the propertyu to look for
+         * @returns null or the source animation for the given property
+         */
         Animatable.prototype.getAnimationByTargetProperty = function (property) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51607,6 +51642,11 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Gets the runtime animation for a specific property
+         * @param property defines the propertyu to look for
+         * @returns null or the runtime animation for the given property
+         */
         Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51616,6 +51656,9 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Resets the animatable to its original state
+         */
         Animatable.prototype.reset = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51624,6 +51667,11 @@ var BABYLON;
             this._localDelayOffset = null;
             this._pausedDelay = null;
         };
+        /**
+         * Allows the animatable to blend with current running animations
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
+         * @param blendingSpeed defines the blending speed to use
+         */
         Animatable.prototype.enableBlending = function (blendingSpeed) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51631,12 +51679,20 @@ var BABYLON;
                 runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;
             }
         };
+        /**
+         * Disable animation blending
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
+         */
         Animatable.prototype.disableBlending = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
                 runtimeAnimations[index].animation.enableBlending = false;
             }
         };
+        /**
+         * Jump directly to a given frame
+         * @param frame defines the frame to jump to
+         */
         Animatable.prototype.goToFrame = function (frame) {
             var runtimeAnimations = this._runtimeAnimations;
             if (runtimeAnimations[0]) {
@@ -51653,12 +51709,18 @@ var BABYLON;
                 runtimeAnimations[index].goToFrame(frame);
             }
         };
+        /**
+         * Pause the animation
+         */
         Animatable.prototype.pause = function () {
             if (this._paused) {
                 return;
             }
             this._paused = true;
         };
+        /**
+         * Restart the animation
+         */
         Animatable.prototype.restart = function () {
             this._paused = false;
         };
@@ -51668,6 +51730,10 @@ var BABYLON;
             }
             this.onAnimationEndObservable.notifyObservers(this);
         };
+        /**
+         * Stop and delete the current animation
+         * @param animationName defines a string used to only stop some of the runtime animations instead of all
+         */
         Animatable.prototype.stop = function (animationName) {
             if (animationName) {
                 var idx = this._scene._activeAnimatables.indexOf(this);
@@ -103288,6 +103354,7 @@ var BABYLON;
             if (gpu === void 0) { gpu = false; }
             var result = new ParticleSystemSet();
             var rootUrl = BABYLON.ParticleHelper.BaseAssetsUrl + "/textures/";
+            scene = scene || BABYLON.Engine.LastCreatedScene;
             for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {
                 var system = _a[_i];
                 result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
@@ -103329,20 +103396,24 @@ var BABYLON;
          * @returns the ParticleSystemSet created
          */
         ParticleHelper.CreateAsync = function (type, scene, gpu) {
-            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (gpu === void 0) { gpu = false; }
+            if (!scene) {
+                scene = BABYLON.Engine.LastCreatedScene;
+                ;
+            }
+            var token = {};
+            scene._addPendingData(token);
             return new Promise(function (resolve, reject) {
-                if (!scene) {
-                    scene = BABYLON.Engine.LastCreatedScene;
-                    ;
-                }
                 if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
+                    scene._removePendingData(token);
                     return reject("Particle system with GPU is not supported.");
                 }
                 BABYLON.Tools.LoadFile(ParticleHelper.BaseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                    scene._removePendingData(token);
                     var newData = JSON.parse(data.toString());
                     return resolve(BABYLON.ParticleSystemSet.Parse(newData, scene, gpu));
                 }, undefined, undefined, undefined, function (req, exception) {
+                    scene._removePendingData(token);
                     return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
                 });
             });

+ 77 - 6
dist/preview release/babylon.no-module.max.js

@@ -51442,7 +51442,28 @@ var BABYLON;
      * Class used to store an actual running animation
      */
     var Animatable = /** @class */ (function () {
-        function Animatable(scene, target, fromFrame, toFrame, loopAnimation, speedRatio, onAnimationEnd, animations) {
+        /**
+         * Creates a new Animatable
+         * @param scene defines the hosting scene
+         * @param target defines the target object
+         * @param fromFrame defines the starting frame number (default is 0)
+         * @param toFrame defines the ending frame number (default is 100)
+         * @param loopAnimation defines if the animation must loop (default is false)
+         * @param speedRatio defines the factor to apply to animation speed (default is 1)
+         * @param onAnimationEnd defines a callback to call when animation ends if it is not looping
+         * @param animations defines a group of animation to add to the new Animatable
+         */
+        function Animatable(scene, 
+        /** defines the target object */
+        target, 
+        /** defines the starting frame number (default is 0) */
+        fromFrame, 
+        /** defines the ending frame number (default is 100) */
+        toFrame, 
+        /** defines if the animation must loop (default is false)  */
+        loopAnimation, speedRatio, 
+        /** defines a callback to call when animation ends if it is not looping */
+        onAnimationEnd, animations) {
             if (fromFrame === void 0) { fromFrame = 0; }
             if (toFrame === void 0) { toFrame = 100; }
             if (loopAnimation === void 0) { loopAnimation = false; }
@@ -51556,15 +51577,29 @@ var BABYLON;
             }
             return this;
         };
+        /**
+         * Gets the list of runtime animations
+         * @returns an array of RuntimeAnimation
+         */
         Animatable.prototype.getAnimations = function () {
             return this._runtimeAnimations;
         };
+        /**
+         * Adds more animations to the current animatable
+         * @param target defines the target of the animations
+         * @param animations defines the new animations to add
+         */
         Animatable.prototype.appendAnimations = function (target, animations) {
             for (var index = 0; index < animations.length; index++) {
                 var animation = animations[index];
                 this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation, this._scene, this));
             }
         };
+        /**
+         * Gets the source animation for a specific property
+         * @param property defines the propertyu to look for
+         * @returns null or the source animation for the given property
+         */
         Animatable.prototype.getAnimationByTargetProperty = function (property) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51574,6 +51609,11 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Gets the runtime animation for a specific property
+         * @param property defines the propertyu to look for
+         * @returns null or the runtime animation for the given property
+         */
         Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51583,6 +51623,9 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Resets the animatable to its original state
+         */
         Animatable.prototype.reset = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51591,6 +51634,11 @@ var BABYLON;
             this._localDelayOffset = null;
             this._pausedDelay = null;
         };
+        /**
+         * Allows the animatable to blend with current running animations
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
+         * @param blendingSpeed defines the blending speed to use
+         */
         Animatable.prototype.enableBlending = function (blendingSpeed) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51598,12 +51646,20 @@ var BABYLON;
                 runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;
             }
         };
+        /**
+         * Disable animation blending
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
+         */
         Animatable.prototype.disableBlending = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
                 runtimeAnimations[index].animation.enableBlending = false;
             }
         };
+        /**
+         * Jump directly to a given frame
+         * @param frame defines the frame to jump to
+         */
         Animatable.prototype.goToFrame = function (frame) {
             var runtimeAnimations = this._runtimeAnimations;
             if (runtimeAnimations[0]) {
@@ -51620,12 +51676,18 @@ var BABYLON;
                 runtimeAnimations[index].goToFrame(frame);
             }
         };
+        /**
+         * Pause the animation
+         */
         Animatable.prototype.pause = function () {
             if (this._paused) {
                 return;
             }
             this._paused = true;
         };
+        /**
+         * Restart the animation
+         */
         Animatable.prototype.restart = function () {
             this._paused = false;
         };
@@ -51635,6 +51697,10 @@ var BABYLON;
             }
             this.onAnimationEndObservable.notifyObservers(this);
         };
+        /**
+         * Stop and delete the current animation
+         * @param animationName defines a string used to only stop some of the runtime animations instead of all
+         */
         Animatable.prototype.stop = function (animationName) {
             if (animationName) {
                 var idx = this._scene._activeAnimatables.indexOf(this);
@@ -103255,6 +103321,7 @@ var BABYLON;
             if (gpu === void 0) { gpu = false; }
             var result = new ParticleSystemSet();
             var rootUrl = BABYLON.ParticleHelper.BaseAssetsUrl + "/textures/";
+            scene = scene || BABYLON.Engine.LastCreatedScene;
             for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {
                 var system = _a[_i];
                 result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
@@ -103296,20 +103363,24 @@ var BABYLON;
          * @returns the ParticleSystemSet created
          */
         ParticleHelper.CreateAsync = function (type, scene, gpu) {
-            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (gpu === void 0) { gpu = false; }
+            if (!scene) {
+                scene = BABYLON.Engine.LastCreatedScene;
+                ;
+            }
+            var token = {};
+            scene._addPendingData(token);
             return new Promise(function (resolve, reject) {
-                if (!scene) {
-                    scene = BABYLON.Engine.LastCreatedScene;
-                    ;
-                }
                 if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
+                    scene._removePendingData(token);
                     return reject("Particle system with GPU is not supported.");
                 }
                 BABYLON.Tools.LoadFile(ParticleHelper.BaseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                    scene._removePendingData(token);
                     var newData = JSON.parse(data.toString());
                     return resolve(BABYLON.ParticleSystemSet.Parse(newData, scene, gpu));
                 }, undefined, undefined, undefined, function (req, exception) {
+                    scene._removePendingData(token);
                     return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
                 });
             });

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/babylon.worker.js


+ 77 - 6
dist/preview release/es6.js

@@ -51442,7 +51442,28 @@ var BABYLON;
      * Class used to store an actual running animation
      */
     var Animatable = /** @class */ (function () {
-        function Animatable(scene, target, fromFrame, toFrame, loopAnimation, speedRatio, onAnimationEnd, animations) {
+        /**
+         * Creates a new Animatable
+         * @param scene defines the hosting scene
+         * @param target defines the target object
+         * @param fromFrame defines the starting frame number (default is 0)
+         * @param toFrame defines the ending frame number (default is 100)
+         * @param loopAnimation defines if the animation must loop (default is false)
+         * @param speedRatio defines the factor to apply to animation speed (default is 1)
+         * @param onAnimationEnd defines a callback to call when animation ends if it is not looping
+         * @param animations defines a group of animation to add to the new Animatable
+         */
+        function Animatable(scene, 
+        /** defines the target object */
+        target, 
+        /** defines the starting frame number (default is 0) */
+        fromFrame, 
+        /** defines the ending frame number (default is 100) */
+        toFrame, 
+        /** defines if the animation must loop (default is false)  */
+        loopAnimation, speedRatio, 
+        /** defines a callback to call when animation ends if it is not looping */
+        onAnimationEnd, animations) {
             if (fromFrame === void 0) { fromFrame = 0; }
             if (toFrame === void 0) { toFrame = 100; }
             if (loopAnimation === void 0) { loopAnimation = false; }
@@ -51556,15 +51577,29 @@ var BABYLON;
             }
             return this;
         };
+        /**
+         * Gets the list of runtime animations
+         * @returns an array of RuntimeAnimation
+         */
         Animatable.prototype.getAnimations = function () {
             return this._runtimeAnimations;
         };
+        /**
+         * Adds more animations to the current animatable
+         * @param target defines the target of the animations
+         * @param animations defines the new animations to add
+         */
         Animatable.prototype.appendAnimations = function (target, animations) {
             for (var index = 0; index < animations.length; index++) {
                 var animation = animations[index];
                 this._runtimeAnimations.push(new BABYLON.RuntimeAnimation(target, animation, this._scene, this));
             }
         };
+        /**
+         * Gets the source animation for a specific property
+         * @param property defines the propertyu to look for
+         * @returns null or the source animation for the given property
+         */
         Animatable.prototype.getAnimationByTargetProperty = function (property) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51574,6 +51609,11 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Gets the runtime animation for a specific property
+         * @param property defines the propertyu to look for
+         * @returns null or the runtime animation for the given property
+         */
         Animatable.prototype.getRuntimeAnimationByTargetProperty = function (property) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51583,6 +51623,9 @@ var BABYLON;
             }
             return null;
         };
+        /**
+         * Resets the animatable to its original state
+         */
         Animatable.prototype.reset = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51591,6 +51634,11 @@ var BABYLON;
             this._localDelayOffset = null;
             this._pausedDelay = null;
         };
+        /**
+         * Allows the animatable to blend with current running animations
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
+         * @param blendingSpeed defines the blending speed to use
+         */
         Animatable.prototype.enableBlending = function (blendingSpeed) {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
@@ -51598,12 +51646,20 @@ var BABYLON;
                 runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;
             }
         };
+        /**
+         * Disable animation blending
+         * @see http://doc.babylonjs.com/babylon101/animations#animation-blending
+         */
         Animatable.prototype.disableBlending = function () {
             var runtimeAnimations = this._runtimeAnimations;
             for (var index = 0; index < runtimeAnimations.length; index++) {
                 runtimeAnimations[index].animation.enableBlending = false;
             }
         };
+        /**
+         * Jump directly to a given frame
+         * @param frame defines the frame to jump to
+         */
         Animatable.prototype.goToFrame = function (frame) {
             var runtimeAnimations = this._runtimeAnimations;
             if (runtimeAnimations[0]) {
@@ -51620,12 +51676,18 @@ var BABYLON;
                 runtimeAnimations[index].goToFrame(frame);
             }
         };
+        /**
+         * Pause the animation
+         */
         Animatable.prototype.pause = function () {
             if (this._paused) {
                 return;
             }
             this._paused = true;
         };
+        /**
+         * Restart the animation
+         */
         Animatable.prototype.restart = function () {
             this._paused = false;
         };
@@ -51635,6 +51697,10 @@ var BABYLON;
             }
             this.onAnimationEndObservable.notifyObservers(this);
         };
+        /**
+         * Stop and delete the current animation
+         * @param animationName defines a string used to only stop some of the runtime animations instead of all
+         */
         Animatable.prototype.stop = function (animationName) {
             if (animationName) {
                 var idx = this._scene._activeAnimatables.indexOf(this);
@@ -103255,6 +103321,7 @@ var BABYLON;
             if (gpu === void 0) { gpu = false; }
             var result = new ParticleSystemSet();
             var rootUrl = BABYLON.ParticleHelper.BaseAssetsUrl + "/textures/";
+            scene = scene || BABYLON.Engine.LastCreatedScene;
             for (var _i = 0, _a = data.systems; _i < _a.length; _i++) {
                 var system = _a[_i];
                 result.systems.push(gpu ? BABYLON.GPUParticleSystem.Parse(system, scene, rootUrl) : BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
@@ -103296,20 +103363,24 @@ var BABYLON;
          * @returns the ParticleSystemSet created
          */
         ParticleHelper.CreateAsync = function (type, scene, gpu) {
-            if (scene === void 0) { scene = BABYLON.Engine.LastCreatedScene; }
             if (gpu === void 0) { gpu = false; }
+            if (!scene) {
+                scene = BABYLON.Engine.LastCreatedScene;
+                ;
+            }
+            var token = {};
+            scene._addPendingData(token);
             return new Promise(function (resolve, reject) {
-                if (!scene) {
-                    scene = BABYLON.Engine.LastCreatedScene;
-                    ;
-                }
                 if (gpu && !BABYLON.GPUParticleSystem.IsSupported) {
+                    scene._removePendingData(token);
                     return reject("Particle system with GPU is not supported.");
                 }
                 BABYLON.Tools.LoadFile(ParticleHelper.BaseAssetsUrl + "/systems/" + type + ".json", function (data, response) {
+                    scene._removePendingData(token);
                     var newData = JSON.parse(data.toString());
                     return resolve(BABYLON.ParticleSystemSet.Parse(newData, scene, gpu));
                 }, undefined, undefined, undefined, function (req, exception) {
+                    scene._removePendingData(token);
                     return reject("An error occured while the creation of your particle system. Check if your type '" + type + "' exists.");
                 });
             });

File diff suppressed because it is too large
+ 3 - 3
dist/preview release/gui/babylon.gui.js


File diff suppressed because it is too large
+ 5 - 5
dist/preview release/gui/babylon.gui.min.js


+ 2 - 2
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 4329,
+  "errors": 4295,
   "babylon.typedoc.json": {
-    "errors": 4329,
+    "errors": 4295,
     "AbstractScene": {
       "Property": {
         "effectLayers": {

+ 1 - 0
dist/preview release/viewer/babylon.viewer.d.ts

@@ -1212,6 +1212,7 @@ declare module BabylonViewer {
             updateParams(params: {
                     [key: string]: string | number | boolean | object;
             }, append?: boolean): void;
+            redraw(): void;
             /**
                 * Get the template'S configuration
                 */

File diff suppressed because it is too large
+ 3 - 3
dist/preview release/viewer/babylon.viewer.js


File diff suppressed because it is too large
+ 84 - 9
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 0
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -1212,6 +1212,7 @@ declare module 'babylonjs-viewer/templating/templateManager' {
             updateParams(params: {
                     [key: string]: string | number | boolean | object;
             }, append?: boolean): void;
+            redraw(): void;
             /**
                 * Get the template'S configuration
                 */

+ 12 - 5
src/Particles/babylon.particleHelper.ts

@@ -15,21 +15,28 @@ module BABYLON {
          * @param gpu If the system will use gpu
          * @returns the ParticleSystemSet created
          */
-        public static CreateAsync(type: string, scene: Nullable<Scene> = Engine.LastCreatedScene, gpu: boolean = false): Promise<ParticleSystemSet> {
+        public static CreateAsync(type: string, scene: Nullable<Scene>, gpu: boolean = false): Promise<ParticleSystemSet> {
             
-            return new Promise((resolve, reject) => {
-                if (!scene) {
-                    scene = Engine.LastCreatedScene;;
-                }
+            if (!scene) {
+                scene = Engine.LastCreatedScene;;
+            }
 
+            let token = {};
+
+            scene!._addPendingData(token);
+
+            return new Promise((resolve, reject) => {
                 if (gpu && !GPUParticleSystem.IsSupported) {
+                    scene!._removePendingData(token);
                     return reject("Particle system with GPU is not supported.");
                 }
 
                 Tools.LoadFile(`${ParticleHelper.BaseAssetsUrl}/systems/${type}.json`, (data, response) => {
+                    scene!._removePendingData(token);
                     const newData = JSON.parse(data.toString());
                     return resolve(ParticleSystemSet.Parse(newData, scene!, gpu));
                 }, undefined, undefined, undefined, (req, exception) => {
+                    scene!._removePendingData(token);
                     return reject(`An error occured while the creation of your particle system. Check if your type '${type}' exists.`);
                 });
 

+ 2 - 0
src/Particles/babylon.particleSystemSet.ts

@@ -116,6 +116,8 @@ module BABYLON {
             var result = new ParticleSystemSet();
             var rootUrl = ParticleHelper.BaseAssetsUrl + "/textures/";
 
+            scene = scene || Engine.LastCreatedScene;
+
             for (var system of data.systems) {
                 result.systems.push(gpu ? GPUParticleSystem.Parse(system, scene, rootUrl) : ParticleSystem.Parse(system, scene, rootUrl));
             }