예제 #1
0
        public static void OnObjectListsGUI(CustomTargetTool context)
        {
            if (context == null)
            {
                return;
            }

            RigidBodyTool.OnRigidBodyListGUI(context.CollectComponentsInChildred <RigidBody>().ToArray(), context);

            GUI.Separator();

            RigidBodyTool.OnConstraintListGUI(context.CollectComponentsInChildred <Constraint>().ToArray(), context);

            GUI.Separator();

            RigidBodyTool.OnShapeListGUI(context.CollectComponentsInChildred <Shape>().ToArray(), context);
        }
예제 #2
0
        public static void OnObjectListsGUI(CustomTargetTool context)
        {
            if (context == null)
            {
                return;
            }

            InspectorGUI.ToolArrayGUI(context,
                                      context.CollectComponentsInChildred <RigidBody>().ToArray(),
                                      "Rigid Bodies");

            InspectorGUI.ToolArrayGUI(context,
                                      context.CollectComponentsInChildred <Constraint>().ToArray(),
                                      "Constraints");

            InspectorGUI.ToolArrayGUI(context,
                                      context.CollectComponentsInChildred <Shape>().ToArray(),
                                      "Shapes");
        }
예제 #3
0
        public static void OnRigidBodyListGUI(RigidBody[] rigidBodies, CustomTargetTool context)
        {
            var skin = InspectorEditor.Skin;

            if (!GUI.Foldout(EditorData.Instance.GetData(context.Targets[0], "Rigid Bodies"),
                             GUI.MakeLabel("Rigid Bodies", true), skin))
            {
                context.RemoveEditors(rigidBodies);
                return;
            }

            if (rigidBodies.Length == 0)
            {
                using (new GUI.Indent(12))
                    GUILayout.Label(GUI.MakeLabel("Empty", true), skin.label);
                return;
            }

            using (new GUI.Indent(12)) {
                foreach (var rb in rigidBodies)
                {
                    GUI.Separator();

                    if (!GUI.Foldout(EditorData.Instance.GetData(context.Targets[0], rb.GetInstanceID().ToString()),
                                     GUI.MakeLabel("[" + GUI.AddColorTag("RigidBody", Color.Lerp(Color.blue, Color.white, 0.35f)) + "] " + rb.name),
                                     skin))
                    {
                        context.RemoveEditor(rb);
                        continue;
                    }

                    GUI.Separator();

                    using (new GUI.Indent(12)) {
                        var editor = context.GetOrCreateEditor(rb);
                        editor.OnInspectorGUI();
                    }
                }
            }
        }
예제 #4
0
        public static void OnShapeListGUI(Shape[] shapes, CustomTargetTool context)
        {
            var skin = InspectorEditor.Skin;

            if (!GUI.Foldout(EditorData.Instance.GetData(context.Targets[0], "Shapes"), GUI.MakeLabel("Shapes", true), skin))
            {
                context.RemoveEditors(shapes);
                return;
            }

            if (shapes.Length == 0)
            {
                using (new GUI.Indent(12))
                    GUILayout.Label(GUI.MakeLabel("Empty", true), skin.label);
                return;
            }

            using (new GUI.Indent(12)) {
                foreach (var shape in shapes)
                {
                    GUI.Separator();
                    if (!GUI.Foldout(EditorData.Instance.GetData(context.Targets[0],
                                                                 shape.GetInstanceID().ToString()),
                                     GUI.MakeLabel("[" + GUI.AddColorTag(shape.GetType().Name, Color.Lerp(Color.green, Color.black, 0.4f)) + "] " + shape.name),
                                     skin))
                    {
                        context.RemoveEditor(shape);
                        continue;
                    }

                    GUI.Separator();
                    using (new GUI.Indent(12)) {
                        var editor = context.GetOrCreateEditor(shape);
                        using (new GUILayout.VerticalScope())
                            editor.OnInspectorGUI();
                    }
                }
            }
        }
예제 #5
0
        public static void OnConstraintListGUI(Constraint[] constraints, CustomTargetTool context)
        {
            var skin = InspectorEditor.Skin;

            if (!GUI.Foldout(EditorData.Instance.GetData(context.Targets[0], "Constraints"),
                             GUI.MakeLabel("Constraints", true), skin))
            {
                context.RemoveEditors(constraints);
                return;
            }

            if (constraints.Length == 0)
            {
                using (new GUI.Indent(12))
                    GUILayout.Label(GUI.MakeLabel("Empty", true), skin.label);
                return;
            }

            using (new GUI.Indent(12)) {
                foreach (var constraint in constraints)
                {
                    GUI.Separator();
                    if (!GUI.Foldout(EditorData.Instance.GetData(context.Targets[0], constraint.GetInstanceID().ToString()),
                                     GUI.MakeLabel("[" + GUI.AddColorTag(constraint.Type.ToString(), Color.Lerp(Color.magenta, Color.black, 0.4f)) + "] " + constraint.name),
                                     skin))
                    {
                        context.RemoveEditor(constraint);
                        continue;
                    }

                    GUI.Separator();
                    using (new GUI.Indent(12)) {
                        var editor = context.GetOrCreateEditor(constraint);
                        editor.OnInspectorGUI();
                    }
                }
            }
        }