Browse Source

Merge pull request #1842 from sebavan/Development

Add get highlight layer by name.
David Catuhe 8 years ago
parent
commit
c88a99c2be
2 changed files with 16 additions and 1 deletions
  1. 1 1
      src/Layer/babylon.highlightlayer.ts
  2. 15 0
      src/babylon.scene.ts

+ 1 - 1
src/Layer/babylon.highlightlayer.ts

@@ -248,7 +248,7 @@ module BABYLON {
          * @param scene The scene to use the layer in
          * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
          */
-        constructor(name: string, scene: Scene, options?: IHighlightLayerOptions) {
+        constructor(public name: string, scene: Scene, options?: IHighlightLayerOptions) {
             this._scene = scene || Engine.LastCreatedScene;
             var engine = scene.getEngine();
             this._engine = engine;

+ 15 - 0
src/babylon.scene.ts

@@ -1897,6 +1897,21 @@
         }
 
         /**
+         * Return a the first highlight layer of the scene with a given name.
+         * @param name The name of the highlight layer to look for.
+         * @return The highlight layer if found otherwise null. 
+         */
+        public getHighlightLayerByName(name: string): HighlightLayer {
+            for (var index = 0; index < this.highlightLayers.length; index++) {
+                if (this.highlightLayers[index].name === name) {
+                    return this.highlightLayers[index];
+                }
+            }
+
+            return null;
+        }
+
+        /**
          * Return a unique id as a string which can serve as an identifier for the scene
          */
         public get uid(): string {