瀏覽代碼

Add missing properties #2649

Quentin Rillet 8 年之前
父節點
當前提交
5fc3b77253

File diff suppressed because it is too large
+ 263 - 263
dist/preview release/inspector/babylon.inspector.bundle.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


+ 1 - 14
inspector/src/adapters/CameraAdapter.ts

@@ -24,20 +24,7 @@ module INSPECTOR {
         
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties() : Array<PropertyLine> {
-           let propertiesLines : Array<PropertyLine> = [];
-           let camToDisplay = [];
-           // The if is there to work with the min version of babylon
-            if (this._obj instanceof BABYLON.ArcRotateCamera) {
-                camToDisplay =  PROPERTIES['ArcRotateCamera'].properties;
-            } else if (this._obj instanceof BABYLON.FreeCamera) {
-                camToDisplay =  PROPERTIES['FreeCamera'].properties; 
-            }
-                
-            for (let dirty of camToDisplay) {
-                let infos = new Property(dirty, this._obj);
-                propertiesLines.push(new PropertyLine(infos));
-            }
-            return propertiesLines; 
+            return Helpers.GetAllLinesProperties(this._obj);
         }
         
         public getTools() : Array<AbstractTreeTool> {

+ 1 - 92
inspector/src/adapters/GUIAdapter.ts

@@ -24,98 +24,7 @@ module INSPECTOR {
 
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties(): Array<PropertyLine> {
-            let propertiesLines: Array<PropertyLine> = [];
-
-            for (let dirty of PROPERTIES['Control'].properties) {
-                let infos = new Property(dirty, this._obj);
-                propertiesLines.push(new PropertyLine(infos));
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Button){
-                for (let dirty of PROPERTIES['Button'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.ColorPicker){
-                for (let dirty of PROPERTIES['ColorPicker'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Checkbox){
-                for (let dirty of PROPERTIES['Checkbox'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Ellipse){
-                for (let dirty of PROPERTIES['Ellipse'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Image){
-                for (let dirty of PROPERTIES['Image'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Line){
-                for (let dirty of PROPERTIES['Line'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.RadioButton){
-                for (let dirty of PROPERTIES['RadioButton'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Rectangle){
-                for (let dirty of PROPERTIES['Rectangle'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Slider){
-                for (let dirty of PROPERTIES['Slider'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.StackPanel){
-                for (let dirty of PROPERTIES['StackPanel'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.TextBlock){
-                for (let dirty of PROPERTIES['TextBlock'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            if(this._obj instanceof BABYLON.GUI.Container){
-                for (let dirty of PROPERTIES['Container'].properties) {
-                    let infos = new Property(dirty, this._obj);
-                    propertiesLines.push(new PropertyLine(infos));
-                }
-            }
-
-            return propertiesLines;
+            return Helpers.GetAllLinesProperties(this._obj);
         }
 
         public getTools(): Array<AbstractTreeTool> {

+ 1 - 16
inspector/src/adapters/LightAdapter.ts

@@ -3,15 +3,6 @@ module INSPECTOR {
     export class LightAdapter 
         extends Adapter 
         implements IToolVisible{
-
-        private static _PROPERTIES = [
-            'position',
-            'diffuse', 
-            'intensity', 
-            'radius', 
-            'range', 
-            'specular'
-        ];
         
         constructor(obj:BABYLON.Light) {
             super(obj);
@@ -33,13 +24,7 @@ module INSPECTOR {
         
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties() : Array<PropertyLine> {
-           let propertiesLines : Array<PropertyLine> = [];
-                
-            for (let dirty of LightAdapter._PROPERTIES) {
-                let infos = new Property(dirty, this._obj);
-                propertiesLines.push(new PropertyLine(infos));
-            }
-            return propertiesLines; 
+            return Helpers.GetAllLinesProperties(this._obj);
         }
         
         public getTools() : Array<AbstractTreeTool> {

+ 1 - 14
inspector/src/adapters/MaterialAdapter.ts

@@ -23,20 +23,7 @@ module INSPECTOR {
         
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties() : Array<PropertyLine> {
-            let propertiesLines : Array<PropertyLine> = [];
-            let propToDisplay = [];
-            // The if is there to work with the min version of babylon
-            if (this._obj instanceof BABYLON.StandardMaterial) {
-                propToDisplay =  PROPERTIES['StandardMaterial'].properties;
-            } else if (this._obj instanceof BABYLON.PBRMaterial) {
-                propToDisplay =  PROPERTIES['PBRMaterial'].properties;
-            }
-
-            for (let dirty of propToDisplay) {
-                let infos = new Property(dirty, this._obj);
-                propertiesLines.push(new PropertyLine(infos));
-            }
-            return propertiesLines; 
+            return Helpers.GetAllLinesProperties(this._obj);
         }
         
         /** No tools for a material adapter */

+ 1 - 7
inspector/src/adapters/MeshAdapter.ts

@@ -27,13 +27,7 @@ module INSPECTOR {
 
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties(): Array<PropertyLine> {
-            let propertiesLines: Array<PropertyLine> = [];
-
-            for (let dirty of PROPERTIES['Mesh'].properties) {
-                let infos = new Property(dirty, this._obj);
-                propertiesLines.push(new PropertyLine(infos));
-            }
-            return propertiesLines;
+            return Helpers.GetAllLinesProperties(this._obj);
         }
 
         public getTools(): Array<AbstractTreeTool> {

+ 1 - 7
inspector/src/adapters/PhysicsImpostorAdapter.ts

@@ -29,13 +29,7 @@ module INSPECTOR {
 
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties(): Array<PropertyLine> {
-            let propertiesLines: Array<PropertyLine> = [];
-
-            for (let dirty of PROPERTIES['PhysicsImpostor'].properties) {
-                let infos = new Property(dirty, this._obj);
-                propertiesLines.push(new PropertyLine(infos));
-            }
-            return propertiesLines;
+            return Helpers.GetAllLinesProperties(this._obj);
         }
 
         public getTools(): Array<AbstractTreeTool> {

+ 1 - 12
inspector/src/adapters/SoundAdapter.ts

@@ -24,18 +24,7 @@ module INSPECTOR {
 
         /** Returns the list of properties to be displayed for this adapter */
         public getProperties(): Array<PropertyLine> {
-            let propertiesLines: Array<PropertyLine> = [];
-            let camToDisplay = [];
-            // The if is there to work with the min version of babylon
-
-            let soundProperties = PROPERTIES['Sound'].properties;
-
-
-            for (let dirty of soundProperties) {
-                let infos = new Property(dirty, this._obj);
-                propertiesLines.push(new PropertyLine(infos));
-            }
-            return propertiesLines;
+            return Helpers.GetAllLinesProperties(this._obj);
         }
 
         public getTools(): Array<AbstractTreeTool> {

+ 19 - 0
inspector/src/helpers/Helpers.ts

@@ -163,5 +163,24 @@ module INSPECTOR {
             }
             return name.indexOf("###") === 0 && name.lastIndexOf("###") === (name.length - 3);
         }
+
+        /**
+         * Return an array of PropertyLine for an obj
+         * @param obj 
+         */
+        public static GetAllLinesProperties(obj: any): Array<PropertyLine> {
+            let propertiesLines: Array<PropertyLine> = [];
+            
+            for (let prop in obj) {
+                /**
+                 * No private and no function
+                 */
+                if(prop.substring(0, 1) !== '_' && typeof obj[prop] !== 'function') {
+                    let infos = new Property(prop, obj);
+                    propertiesLines.push(new PropertyLine(infos));
+                }
+            }
+            return propertiesLines;
+        }
     }
 }