소스 검색

Add new function getParticleSystemByID

Temechon 9 년 전
부모
커밋
2d7ccdc438
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