浏览代码

Hide axes in the scene explorer

David Catuhe 6 年之前
父节点
当前提交
400e6dbb07

文件差异内容过多而无法显示
+ 11701 - 11695
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.js


+ 34 - 0
dist/preview release/babylon.max.js

@@ -66514,6 +66514,30 @@ var BABYLON;
                 this._zmesh.color = new BABYLON.Color3(0, 0, 1);
                 this.scene = scene;
             }
+            Object.defineProperty(AxesViewer.prototype, "xAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._xmesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(AxesViewer.prototype, "yAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._ymesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(AxesViewer.prototype, "zAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._zmesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
             /**
              * Force the viewer to update
              * @param position defines the position of the viewer
@@ -104614,6 +104638,16 @@ var BABYLON;
             mesh.position.copyFrom(oldPos);
             // Reverse parenting
             mesh.removeChild(box);
+            // Adjust scale to avoid undefined behavior when adding child
+            if (box.scaling.y === 0) {
+                box.scaling.y = BABYLON.Epsilon;
+            }
+            if (box.scaling.x === 0) {
+                box.scaling.x = BABYLON.Epsilon;
+            }
+            if (box.scaling.z === 0) {
+                box.scaling.z = BABYLON.Epsilon;
+            }
             box.addChild(mesh);
             box.visibility = 0;
             return box;

+ 34 - 0
dist/preview release/babylon.no-module.max.js

@@ -66481,6 +66481,30 @@ var BABYLON;
                 this._zmesh.color = new BABYLON.Color3(0, 0, 1);
                 this.scene = scene;
             }
+            Object.defineProperty(AxesViewer.prototype, "xAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._xmesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(AxesViewer.prototype, "yAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._ymesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(AxesViewer.prototype, "zAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._zmesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
             /**
              * Force the viewer to update
              * @param position defines the position of the viewer
@@ -104581,6 +104605,16 @@ var BABYLON;
             mesh.position.copyFrom(oldPos);
             // Reverse parenting
             mesh.removeChild(box);
+            // Adjust scale to avoid undefined behavior when adding child
+            if (box.scaling.y === 0) {
+                box.scaling.y = BABYLON.Epsilon;
+            }
+            if (box.scaling.x === 0) {
+                box.scaling.x = BABYLON.Epsilon;
+            }
+            if (box.scaling.z === 0) {
+                box.scaling.z = BABYLON.Epsilon;
+            }
             box.addChild(mesh);
             box.visibility = 0;
             return box;

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.worker.js


+ 34 - 0
dist/preview release/es6.js

@@ -66481,6 +66481,30 @@ var BABYLON;
                 this._zmesh.color = new BABYLON.Color3(0, 0, 1);
                 this.scene = scene;
             }
+            Object.defineProperty(AxesViewer.prototype, "xAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._xmesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(AxesViewer.prototype, "yAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._ymesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(AxesViewer.prototype, "zAxisMesh", {
+                /** Gets the mesh used to render x-axis */
+                get: function () {
+                    return this._zmesh;
+                },
+                enumerable: true,
+                configurable: true
+            });
             /**
              * Force the viewer to update
              * @param position defines the position of the viewer
@@ -104581,6 +104605,16 @@ var BABYLON;
             mesh.position.copyFrom(oldPos);
             // Reverse parenting
             mesh.removeChild(box);
+            // Adjust scale to avoid undefined behavior when adding child
+            if (box.scaling.y === 0) {
+                box.scaling.y = BABYLON.Epsilon;
+            }
+            if (box.scaling.x === 0) {
+                box.scaling.x = BABYLON.Epsilon;
+            }
+            if (box.scaling.z === 0) {
+                box.scaling.z = BABYLON.Epsilon;
+            }
             box.addChild(mesh);
             box.visibility = 0;
             return box;

+ 4 - 0
inspector/src/components/actionTabs/tabs/propertyGrids/meshes/axesViewerComponent.tsx

@@ -40,6 +40,10 @@ export class AxesViewerComponent extends React.Component<IAxisViewerComponentPro
         const y = new BABYLON.Vector3(0, 1, 0);
         const z = new BABYLON.Vector3(0, 0, 1);
 
+        viewer.xAxisMesh.metadata = { hidden: true };
+        viewer.yAxisMesh.metadata = { hidden: true };
+        viewer.zAxisMesh.metadata = { hidden: true };
+
         node.metadata.onBeforeRenderObserver = scene.onBeforeRenderObservable.add(() => {
             let matrix = node.getWorldMatrix();
             let extend = BABYLON.Tmp.Vector3[0];

+ 15 - 0
src/Debug/babylon.axesViewer.ts

@@ -25,6 +25,21 @@ module BABYLON.Debug {
          */
         public scaleLines = 1;
 
+        /** Gets the mesh used to render x-axis */
+        public get xAxisMesh(): Nullable<LinesMesh> {
+            return this._xmesh;
+        }
+
+        /** Gets the mesh used to render x-axis */
+        public get yAxisMesh(): Nullable<LinesMesh> {
+            return this._ymesh;
+        }
+
+        /** Gets the mesh used to render x-axis */
+        public get zAxisMesh(): Nullable<LinesMesh> {
+            return this._zmesh;
+        }
+
         /**
          * Creates a new AxesViewer
          * @param scene defines the hosting scene