Explorar el Código

Merge pull request #6629 from aWeirdo/patch-29

Update scene.ts
David Catuhe hace 6 años
padre
commit
7e459dae6c
Se han modificado 2 ficheros con 16 adiciones y 0 borrados
  1. 1 0
      dist/preview release/what's new.md
  2. 15 0
      src/scene.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -29,6 +29,7 @@
 - Effect renderer to render one or multiple shader effects to a texture ([TrevorDev](https://github.com/TrevorDev))
 - Added url parameters to web request modifiers ([PierreLeBlond](https://github.com/PierreLeBlond))
 - Added `VRExperienceHelper.exitVROnDoubleTap` ([Deltakosh](https://github.com/deltakosh/))
+- Added `Scene.getTextureByUniqueID` ([aWeirdo](https://github.com/aWeirdo/))
 
 ### Engine
 - Morph targets now can morph UV channel as well ([Deltakosh](https://github.com/deltakosh/))

+ 15 - 0
src/scene.ts

@@ -2487,6 +2487,21 @@ export class Scene extends AbstractScene implements IAnimatable {
     }
 
     /**
+     * Get a texture using its unique id
+     * @param uniqueId defines the texture's unique id
+     * @return the texture or null if none found.
+     */
+    public getTextureByUniqueID(uniqueId: number): Nullable<BaseTexture> {
+        for (var index = 0; index < this.textures.length; index++) {
+            if (this.textures[index].uniqueId === uniqueId) {
+                return this.textures[index];
+            }
+        }
+
+        return null;
+    }
+
+    /**
      * Gets a camera using its id
      * @param id defines the id to look for
      * @returns the camera or null if not found