Browse Source

Merge pull request #4456 from TrevorDev/spriteIsVisible

sprite isVisible
David Catuhe 7 years ago
parent
commit
954f954ec9

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

@@ -30,6 +30,7 @@
 - Gizmo and gizmoManager class used to manipulate meshes in a scene, position, rotation, scale gizmos ([TrevorDev](https://github.com/TrevorDev))
 - Added a new `mesh.ignoreNonUniformScaling` to turn off non uniform scaling compensation ([Deltakosh](https://github.com/deltakosh))
 - AssetsManager tasks will only run when their state is INIT. It is now possible to remove a task from the assets manager ([RaananW](https://github.com/RaananW))
+- Sprite isVisible field ([TrevorDev](https://github.com/TrevorDev))
 - Added support for `minScaleX`, `minScaleY`, `maxScaleX`, `maxScaleY` for particles ([Deltakosh](https://github.com/deltakosh))
 
 ### glTF Loader

+ 4 - 0
src/Sprites/babylon.sprite.ts

@@ -22,6 +22,10 @@
         private _manager: SpriteManager;
         private _time = 0;
         private _onAnimationEnd: () => void;
+        /**
+         * Gets or sets a boolean indicating if the sprite is visible (renderable). Default is true
+         */
+        public isVisible = true;
 
         public get size(): number {
             return this.width;

+ 1 - 1
src/Sprites/babylon.spriteManager.ts

@@ -207,7 +207,7 @@
             var offset = 0;
             for (var index = 0; index < max; index++) {
                 var sprite = this.sprites[index];
-                if (!sprite) {
+                if (!sprite || !sprite.isVisible) {
                     continue;
                 }