Ejemplo n.º 1
0
        public override void OnPreTargetMembersGUI(GUISkin skin)
        {
            bool toggleDisableCollisions = false;

            GUILayout.BeginHorizontal();
            {
                GUI.ToolsLabel(skin);

                using (GUI.ToolButtonData.ColorBlock) {
                    toggleDisableCollisions = GUI.ToolButton(GUI.Symbols.DisableCollisionsTool, DisableCollisionsTool, "Disable collisions against other objects", skin);
                }
            }
            GUILayout.EndHorizontal();

            if (DisableCollisionsTool)
            {
                GetChild <DisableCollisionsTool>().OnInspectorGUI(skin);

                GUI.Separator();
            }

            if (!EditorApplication.isPlaying)
            {
                RouteGUI(skin);
            }

            if (toggleDisableCollisions)
            {
                DisableCollisionsTool = !DisableCollisionsTool;
            }
        }
Ejemplo n.º 2
0
        public override void OnPreTargetMembersGUI(GUISkin skin)
        {
            bool guiWasEnabled = UnityEngine.GUI.enabled;

            bool toggleSelectParent   = false;
            bool toggleFindGivenPoint = false;
            bool toggleSelectEdge     = false;
            bool togglePositionHandle = false;

            GUILayout.BeginHorizontal();
            {
                UnityEngine.GUI.enabled = true;
                GUI.ToolsLabel(skin);

                using (GUI.ToolButtonData.ColorBlock) {
                    toggleSelectParent = GUI.ToolButton(GUI.Symbols.SelectInSceneViewTool, SelectParent, "Select parent object by selecting object in scene view", skin);

                    UnityEngine.GUI.enabled = guiWasEnabled;

                    toggleFindGivenPoint = GUI.ToolButton(GUI.Symbols.SelectPointTool, FindTransformGivenPointOnSurface, "Find position and rotation given point and direction on an objects surface", skin);
                    toggleSelectEdge     = GUI.ToolButton(GUI.Symbols.SelectEdgeTool, FindTransformGivenEdge, "Find position and rotation given a triangle or principal edge", skin);
                    togglePositionHandle = GUI.ToolButton(GUI.Symbols.PositionHandleTool, TransformHandleActive, "Position/rotation handle", skin);
                }
            }
            GUILayout.EndHorizontal();

            if (toggleSelectParent)
            {
                SelectParent = !SelectParent;
            }
            if (toggleFindGivenPoint)
            {
                FindTransformGivenPointOnSurface = !FindTransformGivenPointOnSurface;
            }
            if (toggleSelectEdge)
            {
                FindTransformGivenEdge = !FindTransformGivenEdge;
            }
            if (togglePositionHandle)
            {
                TransformHandleActive = !TransformHandleActive;
            }

            GUI.Separator();
        }
Ejemplo n.º 3
0
        public override void OnPreTargetMembersGUI(GUISkin skin)
        {
            bool toggleShapeResizeTool   = false;
            bool toggleShapeCreate       = false;
            bool toggleDisableCollisions = false;
            bool toggleShapeVisualCreate = true;

            GUILayout.BeginHorizontal();
            {
                GUI.ToolsLabel(skin);

                using (GUI.ToolButtonData.ColorBlock) {
                    using (new EditorGUI.DisabledGroupScope(!Tools.ShapeResizeTool.SupportsShape(Shape)))
                        toggleShapeResizeTool = GUI.ToolButton(GUI.Symbols.ShapeResizeTool,
                                                               ShapeResizeTool,
                                                               "Shape resize tool",
                                                               skin,
                                                               24);

                    toggleShapeCreate = GUI.ToolButton(GUI.Symbols.ShapeCreateTool,
                                                       ShapeCreateTool,
                                                       "Create shape from visual objects",
                                                       skin);
                    toggleDisableCollisions = GUI.ToolButton(GUI.Symbols.DisableCollisionsTool,
                                                             DisableCollisionsTool,
                                                             "Disable collisions against other objects",
                                                             skin);

                    using (new EditorGUI.DisabledGroupScope(!Tools.ShapeVisualCreateTool.CanCreateVisual(Shape)))
                        toggleShapeVisualCreate = GUI.ToolButton(GUI.Symbols.ShapeVisualCreateTool,
                                                                 ShapeVisualCreateTool,
                                                                 "Create visual representation of the physical shape",
                                                                 skin,
                                                                 14);
                }
            }
            GUILayout.EndHorizontal();

            GUI.Separator();

            if (ShapeCreateTool)
            {
                GetChild <ShapeCreateTool>().OnInspectorGUI(skin);

                GUI.Separator();
            }
            if (DisableCollisionsTool)
            {
                GetChild <DisableCollisionsTool>().OnInspectorGUI(skin);

                GUI.Separator();
            }
            if (ShapeVisualCreateTool)
            {
                GetChild <ShapeVisualCreateTool>().OnInspectorGUI(skin);

                GUI.Separator();
            }

            if (toggleShapeResizeTool)
            {
                ShapeResizeTool = !ShapeResizeTool;
            }
            if (toggleShapeCreate)
            {
                ShapeCreateTool = !ShapeCreateTool;
            }
            if (toggleDisableCollisions)
            {
                DisableCollisionsTool = !DisableCollisionsTool;
            }
            if (toggleShapeVisualCreate)
            {
                ShapeVisualCreateTool = !ShapeVisualCreateTool;
            }
        }
Ejemplo n.º 4
0
        public override void OnPreTargetMembersGUI(GUISkin skin)
        {
            bool toggleFindTransformGivenPoint = false;
            bool toggleFindTransformGivenEdge  = false;
            bool toggleShapeCreate             = false;
            bool toggleConstraintCreate        = false;
            bool toggleDisableCollisions       = false;
            bool toggleRigidBodyVisualCreate   = false;

            GUILayout.BeginHorizontal();
            {
                GUI.ToolsLabel(skin);
                using (GUI.ToolButtonData.ColorBlock) {
                    toggleFindTransformGivenPoint = GUI.ToolButton(GUI.Symbols.SelectPointTool, FindTransformGivenPointTool, "Find rigid body transform given point on object.", skin);
                    toggleFindTransformGivenEdge  = GUI.ToolButton(GUI.Symbols.SelectEdgeTool, FindTransformGivenEdgeTool, "Find rigid body transform given edge on object.", skin);
                    toggleShapeCreate             = GUI.ToolButton(GUI.Symbols.ShapeCreateTool, ShapeCreateTool, "Create shape from visual objects", skin);
                    toggleConstraintCreate        = GUI.ToolButton(GUI.Symbols.ConstraintCreateTool, ConstraintCreateTool, "Create constraint to this rigid body", skin);
                    toggleDisableCollisions       = GUI.ToolButton(GUI.Symbols.DisableCollisionsTool, DisableCollisionsTool, "Disable collisions against other objects", skin);
                    bool createShapeVisualValid = Tools.RigidBodyVisualCreateTool.ValidForNewShapeVisuals(RigidBody);
                    using (new EditorGUI.DisabledGroupScope(!createShapeVisualValid))
                        toggleRigidBodyVisualCreate = GUI.ToolButton(GUI.Symbols.ShapeVisualCreateTool,
                                                                     RigidBodyVisualCreateTool,
                                                                     "Create visual representation of each physical shape in this body",
                                                                     skin,
                                                                     14);
                }
            }
            GUILayout.EndHorizontal();

            if (ShapeCreateTool)
            {
                GUI.Separator();

                GetChild <ShapeCreateTool>().OnInspectorGUI(skin);
            }
            if (ConstraintCreateTool)
            {
                GUI.Separator();

                GetChild <ConstraintCreateTool>().OnInspectorGUI(skin);
            }
            if (DisableCollisionsTool)
            {
                GUI.Separator();

                GetChild <DisableCollisionsTool>().OnInspectorGUI(skin);
            }
            if (RigidBodyVisualCreateTool)
            {
                GUI.Separator();

                GetChild <RigidBodyVisualCreateTool>().OnInspectorGUI(skin);
            }

            GUI.Separator();

            GUILayout.Label(GUI.MakeLabel("Mass properties", true), skin.label);
            using (new GUI.Indent(12))
                BaseEditor <MassProperties> .Update(RigidBody.MassProperties, RigidBody.MassProperties, skin);
            GUI.Separator();

            if (toggleFindTransformGivenPoint)
            {
                FindTransformGivenPointTool = !FindTransformGivenPointTool;
            }
            if (toggleFindTransformGivenEdge)
            {
                FindTransformGivenEdgeTool = !FindTransformGivenEdgeTool;
            }
            if (toggleShapeCreate)
            {
                ShapeCreateTool = !ShapeCreateTool;
            }
            if (toggleConstraintCreate)
            {
                ConstraintCreateTool = !ConstraintCreateTool;
            }
            if (toggleDisableCollisions)
            {
                DisableCollisionsTool = !DisableCollisionsTool;
            }
            if (toggleRigidBodyVisualCreate)
            {
                RigidBodyVisualCreateTool = !RigidBodyVisualCreateTool;
            }
        }