Преглед изворни кода

Merge pull request #856 from Temechon/master

New method getParticleSystemByID
Temechon пре 9 година
родитељ
комит
0640803028
2 измењених фајлова са 29 додато и 0 уклоњено
  1. 13 0
      src/babylon.scene.js
  2. 16 0
      src/babylon.scene.ts

+ 13 - 0
src/babylon.scene.js

@@ -892,6 +892,19 @@ var BABYLON;
             return null;
         };
         /**
+         * get a particle system by id
+         * @param id {number} the particle system id
+         * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
+         */
+        Scene.prototype.getParticleSystemByID = function (id) {
+            for (var index = 0; index < this.particleSystems.length; index++) {
+                if (this.particleSystems[index].id === id) {
+                    return this.particleSystems[index];
+                }
+            }
+            return null;
+        };
+        /**
          * get a geometry using its ID
          * @param {string} the geometry's id
          * @return {BABYLON.Geometry|null} the geometry or null if none found.

+ 16 - 0
src/babylon.scene.ts

@@ -1146,6 +1146,22 @@
             return null;
         }
 
+
+        /**
+         * get a particle system by id
+         * @param id {number} the particle system id
+         * @return {BABYLON.ParticleSystem|null} the corresponding system or null if none found.
+         */
+        public getParticleSystemByID(id: string): ParticleSystem {
+            for (var index = 0; index < this.particleSystems.length; index++) {
+                if (this.particleSystems[index].id === id) {
+                    return this.particleSystems[index];
+                }
+            }
+
+            return null;
+        }
+
         /**
          * get a geometry using its ID
          * @param {string} the geometry's id