David Catuhe 7 năm trước cách đây
mục cha
commit
ea26593f0c

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7169 - 7164
Playground/babylon.d.txt


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7168 - 7163
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.js


+ 19 - 4
dist/preview release/babylon.max.js

@@ -17679,6 +17679,7 @@ var BABYLON;
             this.animations = new Array();
             this._ranges = {};
             this._isEnabled = true;
+            this._isParentEnabled = true;
             this._isReady = true;
             /** @hidden */
             this._currentRenderId = -1;
@@ -17771,6 +17772,8 @@ var BABYLON;
                         }
                     }
                 }
+                // Enabled state
+                this._syncParentEnabledState();
             },
             enumerable: true,
             configurable: true
@@ -17987,13 +17990,19 @@ var BABYLON;
             if (checkAncestors === false) {
                 return this._isEnabled;
             }
-            if (this._isEnabled === false) {
+            if (!this._isEnabled) {
                 return false;
             }
-            if (this._parentNode !== undefined && this._parentNode !== null) {
-                return this._parentNode.isEnabled(checkAncestors);
+            return this._isParentEnabled;
+        };
+        /** @hidden */
+        Node.prototype._syncParentEnabledState = function () {
+            this._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;
+            if (this._children) {
+                this._children.forEach(function (c) {
+                    c._syncParentEnabledState(); // Force children to update accordingly
+                });
             }
-            return true;
         };
         /**
          * Set the enabled state of this node
@@ -18001,6 +18010,7 @@ var BABYLON;
          */
         Node.prototype.setEnabled = function (value) {
             this._isEnabled = value;
+            this._syncParentEnabledState();
         };
         /**
          * Is this node a descendant of the given node?
@@ -21757,6 +21767,11 @@ var BABYLON;
             }
             return ret;
         };
+        /** @hidden */
+        Light.prototype._syncParentEnabledState = function () {
+            _super.prototype._syncParentEnabledState.call(this);
+            this._resyncMeshes();
+        };
         /**
          * Set the enabled state of this node.
          * @param value - the new enabled state

+ 19 - 4
dist/preview release/babylon.no-module.max.js

@@ -17646,6 +17646,7 @@ var BABYLON;
             this.animations = new Array();
             this._ranges = {};
             this._isEnabled = true;
+            this._isParentEnabled = true;
             this._isReady = true;
             /** @hidden */
             this._currentRenderId = -1;
@@ -17738,6 +17739,8 @@ var BABYLON;
                         }
                     }
                 }
+                // Enabled state
+                this._syncParentEnabledState();
             },
             enumerable: true,
             configurable: true
@@ -17954,13 +17957,19 @@ var BABYLON;
             if (checkAncestors === false) {
                 return this._isEnabled;
             }
-            if (this._isEnabled === false) {
+            if (!this._isEnabled) {
                 return false;
             }
-            if (this._parentNode !== undefined && this._parentNode !== null) {
-                return this._parentNode.isEnabled(checkAncestors);
+            return this._isParentEnabled;
+        };
+        /** @hidden */
+        Node.prototype._syncParentEnabledState = function () {
+            this._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;
+            if (this._children) {
+                this._children.forEach(function (c) {
+                    c._syncParentEnabledState(); // Force children to update accordingly
+                });
             }
-            return true;
         };
         /**
          * Set the enabled state of this node
@@ -17968,6 +17977,7 @@ var BABYLON;
          */
         Node.prototype.setEnabled = function (value) {
             this._isEnabled = value;
+            this._syncParentEnabledState();
         };
         /**
          * Is this node a descendant of the given node?
@@ -21724,6 +21734,11 @@ var BABYLON;
             }
             return ret;
         };
+        /** @hidden */
+        Light.prototype._syncParentEnabledState = function () {
+            _super.prototype._syncParentEnabledState.call(this);
+            this._resyncMeshes();
+        };
         /**
          * Set the enabled state of this node.
          * @param value - the new enabled state

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/babylon.worker.js


+ 19 - 4
dist/preview release/es6.js

@@ -17646,6 +17646,7 @@ var BABYLON;
             this.animations = new Array();
             this._ranges = {};
             this._isEnabled = true;
+            this._isParentEnabled = true;
             this._isReady = true;
             /** @hidden */
             this._currentRenderId = -1;
@@ -17738,6 +17739,8 @@ var BABYLON;
                         }
                     }
                 }
+                // Enabled state
+                this._syncParentEnabledState();
             },
             enumerable: true,
             configurable: true
@@ -17954,13 +17957,19 @@ var BABYLON;
             if (checkAncestors === false) {
                 return this._isEnabled;
             }
-            if (this._isEnabled === false) {
+            if (!this._isEnabled) {
                 return false;
             }
-            if (this._parentNode !== undefined && this._parentNode !== null) {
-                return this._parentNode.isEnabled(checkAncestors);
+            return this._isParentEnabled;
+        };
+        /** @hidden */
+        Node.prototype._syncParentEnabledState = function () {
+            this._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;
+            if (this._children) {
+                this._children.forEach(function (c) {
+                    c._syncParentEnabledState(); // Force children to update accordingly
+                });
             }
-            return true;
         };
         /**
          * Set the enabled state of this node
@@ -17968,6 +17977,7 @@ var BABYLON;
          */
         Node.prototype.setEnabled = function (value) {
             this._isEnabled = value;
+            this._syncParentEnabledState();
         };
         /**
          * Is this node a descendant of the given node?
@@ -21724,6 +21734,11 @@ var BABYLON;
             }
             return ret;
         };
+        /** @hidden */
+        Light.prototype._syncParentEnabledState = function () {
+            _super.prototype._syncParentEnabledState.call(this);
+            this._resyncMeshes();
+        };
         /**
          * Set the enabled state of this node.
          * @param value - the new enabled state

+ 0 - 202
dist/preview release/viewer/babylon.viewer.d.ts

@@ -674,208 +674,6 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    /**
-        * BABYLON.Animation play mode enum - is the animation looping or playing once
-        */
-    export const enum AnimationPlayMode {
-            ONCE = 0,
-            LOOP = 1
-    }
-    /**
-        * An enum representing the current state of an animation object
-        */
-    export const enum AnimationState {
-            INIT = 0,
-            PLAYING = 1,
-            PAUSED = 2,
-            STOPPED = 3,
-            ENDED = 4
-    }
-    /**
-        * The different type of easing functions available
-        */
-    export const enum EasingFunction {
-            Linear = 0,
-            CircleEase = 1,
-            BackEase = 2,
-            BounceEase = 3,
-            CubicEase = 4,
-            ElasticEase = 5,
-            ExponentialEase = 6,
-            PowerEase = 7,
-            QuadraticEase = 8,
-            QuarticEase = 9,
-            QuinticEase = 10,
-            SineEase = 11
-    }
-    /**
-        * Defines a simple animation to be applied to a model (scale).
-        */
-    export interface ModelAnimationConfiguration {
-            /**
-                * Time of animation, in seconds
-                */
-            time: number;
-            /**
-                * Scale to apply
-                */
-            scaling?: BABYLON.Vector3;
-            /**
-                * Easing function to apply
-                * See SPECTRE.EasingFunction
-                */
-            easingFunction?: number;
-            /**
-                * An Easing mode to apply to the easing function
-                * See BABYLON.EasingFunction
-                */
-            easingMode?: number;
-    }
-    /**
-        * This interface can be implemented to define new types of ModelAnimation objects.
-        */
-    export interface IModelAnimation {
-            /**
-                * Current animation state (playing, stopped etc')
-                */
-            readonly state: AnimationState;
-            /**
-                * the name of the animation
-                */
-            readonly name: string;
-            /**
-                * Get the max numbers of frame available in the animation group
-                *
-                * In correlation to an arry, this would be ".length"
-                */
-            readonly frames: number;
-            /**
-                * Get the current frame playing right now.
-                * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
-                *
-                * In correlation to an array, this would be the current index
-                */
-            readonly currentFrame: number;
-            /**
-                * BABYLON.Animation's FPS value
-                */
-            readonly fps: number;
-            /**
-                * Get or set the animation's speed ration (Frame-to-fps)
-                */
-            speedRatio: number;
-            /**
-                * Gets or sets the aimation's play mode.
-                */
-            playMode: AnimationPlayMode;
-            /**
-                * Start the animation
-                */
-            start(): any;
-            /**
-                * Stop the animation.
-                * This will fail silently if the animation group is already stopped.
-                */
-            stop(): any;
-            /**
-                * Pause the animation
-                * This will fail silently if the animation is not currently playing
-                */
-            pause(): any;
-            /**
-                * Reset this animation
-                */
-            reset(): any;
-            /**
-                * Restart the animation
-                */
-            restart(): any;
-            /**
-                * Go to a specific
-                * @param frameNumber the frame number to go to
-                */
-            goToFrame(frameNumber: number): any;
-            /**
-                * Dispose this animation
-                */
-            dispose(): any;
-    }
-    /**
-        * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
-        * native GroupAnimation class.
-        */
-    export class GroupModelAnimation implements IModelAnimation {
-            /**
-                * Create a new GroupModelAnimation object using an BABYLON.AnimationGroup object
-                * @param _animationGroup The aniamtion group to base the class on
-                */
-            constructor(_animationGroup: BABYLON.AnimationGroup);
-            /**
-                * Get the animation's name
-                */
-            readonly name: string;
-            /**
-                * Get the current animation's state
-                */
-            readonly state: AnimationState;
-            /**
-             * Sets the speed ratio to use for all animations
-             */
-            speedRatio: number;
-            /**
-                * Get the max numbers of frame available in the animation group
-                *
-                * In correlation to an arry, this would be ".length"
-                */
-            readonly frames: number;
-            /**
-                * Get the current frame playing right now.
-                * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
-                *
-                * In correlation to an array, this would be the current index
-                */
-            readonly currentFrame: number;
-            /**
-                * Get the FPS value of this animation
-                */
-            readonly fps: number;
-            /**
-             * Set the play mode.
-             * If the animation is played, it will continue playing at least once more, depending on the new play mode set.
-             * If the animation is not set, the will be initialized and will wait for the user to start playing it.
-             */
-            playMode: AnimationPlayMode;
-            /**
-                * Reset the animation group
-                */
-            reset(): void;
-            /**
-                * Restart the animation group
-                */
-            restart(): void;
-            /**
-                *
-                * @param frameNumber Go to a specific frame in the animation
-                */
-            goToFrame(frameNumber: number): void;
-            /**
-                * Start playing the animation.
-                */
-            start(): void;
-            /**
-                * Pause the animation
-                */
-            pause(): void;
-            /**
-                * Stop the animation.
-                * This will fail silently if the animation group is already stopped.
-                */
-            stop(): void;
-            /**
-                * Dispose this animation object.
-                */
-            dispose(): void;
-    }
 }
 declare module BabylonViewer {
     /**

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 203
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -732,209 +732,7 @@ declare module 'babylonjs-viewer/model/viewerModel' {
 }
 
 declare module 'babylonjs-viewer/model/modelAnimation' {
-    import { AnimationGroup, Vector3 } from 'babylonjs';
-    /**
-        * Animation play mode enum - is the animation looping or playing once
-        */
-    export const enum AnimationPlayMode {
-            ONCE = 0,
-            LOOP = 1
-    }
-    /**
-        * An enum representing the current state of an animation object
-        */
-    export const enum AnimationState {
-            INIT = 0,
-            PLAYING = 1,
-            PAUSED = 2,
-            STOPPED = 3,
-            ENDED = 4
-    }
-    /**
-        * The different type of easing functions available
-        */
-    export const enum EasingFunction {
-            Linear = 0,
-            CircleEase = 1,
-            BackEase = 2,
-            BounceEase = 3,
-            CubicEase = 4,
-            ElasticEase = 5,
-            ExponentialEase = 6,
-            PowerEase = 7,
-            QuadraticEase = 8,
-            QuarticEase = 9,
-            QuinticEase = 10,
-            SineEase = 11
-    }
-    /**
-        * Defines a simple animation to be applied to a model (scale).
-        */
-    export interface ModelAnimationConfiguration {
-            /**
-                * Time of animation, in seconds
-                */
-            time: number;
-            /**
-                * Scale to apply
-                */
-            scaling?: Vector3;
-            /**
-                * Easing function to apply
-                * See SPECTRE.EasingFunction
-                */
-            easingFunction?: number;
-            /**
-                * An Easing mode to apply to the easing function
-                * See BABYLON.EasingFunction
-                */
-            easingMode?: number;
-    }
-    /**
-        * This interface can be implemented to define new types of ModelAnimation objects.
-        */
-    export interface IModelAnimation {
-            /**
-                * Current animation state (playing, stopped etc')
-                */
-            readonly state: AnimationState;
-            /**
-                * the name of the animation
-                */
-            readonly name: string;
-            /**
-                * Get the max numbers of frame available in the animation group
-                *
-                * In correlation to an arry, this would be ".length"
-                */
-            readonly frames: number;
-            /**
-                * Get the current frame playing right now.
-                * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
-                *
-                * In correlation to an array, this would be the current index
-                */
-            readonly currentFrame: number;
-            /**
-                * Animation's FPS value
-                */
-            readonly fps: number;
-            /**
-                * Get or set the animation's speed ration (Frame-to-fps)
-                */
-            speedRatio: number;
-            /**
-                * Gets or sets the aimation's play mode.
-                */
-            playMode: AnimationPlayMode;
-            /**
-                * Start the animation
-                */
-            start(): any;
-            /**
-                * Stop the animation.
-                * This will fail silently if the animation group is already stopped.
-                */
-            stop(): any;
-            /**
-                * Pause the animation
-                * This will fail silently if the animation is not currently playing
-                */
-            pause(): any;
-            /**
-                * Reset this animation
-                */
-            reset(): any;
-            /**
-                * Restart the animation
-                */
-            restart(): any;
-            /**
-                * Go to a specific
-                * @param frameNumber the frame number to go to
-                */
-            goToFrame(frameNumber: number): any;
-            /**
-                * Dispose this animation
-                */
-            dispose(): any;
-    }
-    /**
-        * The GroupModelAnimation is an implementation of the IModelAnimation interface using BABYLON's
-        * native GroupAnimation class.
-        */
-    export class GroupModelAnimation implements IModelAnimation {
-            /**
-                * Create a new GroupModelAnimation object using an AnimationGroup object
-                * @param _animationGroup The aniamtion group to base the class on
-                */
-            constructor(_animationGroup: AnimationGroup);
-            /**
-                * Get the animation's name
-                */
-            readonly name: string;
-            /**
-                * Get the current animation's state
-                */
-            readonly state: AnimationState;
-            /**
-             * Sets the speed ratio to use for all animations
-             */
-            speedRatio: number;
-            /**
-                * Get the max numbers of frame available in the animation group
-                *
-                * In correlation to an arry, this would be ".length"
-                */
-            readonly frames: number;
-            /**
-                * Get the current frame playing right now.
-                * This can be used to poll the frame currently playing (and, for exmaple, display a progress bar with the data)
-                *
-                * In correlation to an array, this would be the current index
-                */
-            readonly currentFrame: number;
-            /**
-                * Get the FPS value of this animation
-                */
-            readonly fps: number;
-            /**
-             * Set the play mode.
-             * If the animation is played, it will continue playing at least once more, depending on the new play mode set.
-             * If the animation is not set, the will be initialized and will wait for the user to start playing it.
-             */
-            playMode: AnimationPlayMode;
-            /**
-                * Reset the animation group
-                */
-            reset(): void;
-            /**
-                * Restart the animation group
-                */
-            restart(): void;
-            /**
-                *
-                * @param frameNumber Go to a specific frame in the animation
-                */
-            goToFrame(frameNumber: number): void;
-            /**
-                * Start playing the animation.
-                */
-            start(): void;
-            /**
-                * Pause the animation
-                */
-            pause(): void;
-            /**
-                * Stop the animation.
-                * This will fail silently if the animation group is already stopped.
-                */
-            stop(): void;
-            /**
-                * Dispose this animation object.
-                */
-            dispose(): void;
-    }
+    
 }
 
 declare module 'babylonjs-viewer/loader/plugins/loaderPlugin' {

+ 6 - 0
src/Lights/babylon.light.ts

@@ -377,6 +377,12 @@ module BABYLON {
             return ret;
         }
 
+        /** @hidden */
+        protected _syncParentEnabledState() {
+            super._syncParentEnabledState();
+            this._resyncMeshes();
+        }
+
         /**
          * Set the enabled state of this node.
          * @param value - the new enabled state

+ 18 - 5
src/babylon.node.ts

@@ -88,6 +88,7 @@
         public onReady: (node: Node) => void;
 
         private _isEnabled = true;
+        private _isParentEnabled = true;
         private _isReady = true;
         /** @hidden */
         public _currentRenderId = -1;
@@ -159,6 +160,9 @@
                     }
                 }
             }
+
+            // Enabled state
+            this._syncParentEnabledState();
         }
 
         public get parent(): Nullable<Node> {
@@ -419,15 +423,22 @@
                 return this._isEnabled;
             }
 
-            if (this._isEnabled === false) {
+            if (!this._isEnabled) {
                 return false;
             }
 
-            if (this._parentNode !== undefined && this._parentNode !== null) {
-                return this._parentNode.isEnabled(checkAncestors);
-            }
+            return this._isParentEnabled;
+        }
 
-            return true;
+        /** @hidden */
+        protected _syncParentEnabledState() {
+            this._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;
+
+            if (this._children) {
+                this._children.forEach(c => {
+                    c._syncParentEnabledState(); // Force children to update accordingly
+                });
+            }            
         }
 
         /**
@@ -436,6 +447,8 @@
          */
         public setEnabled(value: boolean): void {
             this._isEnabled = value;
+
+            this._syncParentEnabledState();
         }
 
         /**