Example #1
0
        private void OnShapeListGUI(GUISkin skin)
        {
            if (!GUI.Foldout(EditorData.Instance.GetData(RigidBody, "Shapes"), GUI.MakeLabel("Shapes", true), skin))
            {
                return;
            }

            Shape[] shapes = RigidBody.GetComponentsInChildren <Shape>();
            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(RigidBody,
                                                                 shape.GetInstanceID().ToString()),
                                     GUI.MakeLabel("[" + GUI.AddColorTag(shape.GetType().Name, Color.Lerp(Color.green, Color.black, 0.4f)) + "] " + shape.name),
                                     skin))
                    {
                        continue;
                    }

                    GUI.Separator();
                    using (new GUI.Indent(12)) {
                        Undo.RecordObjects(shape.GetUndoCollection(), "Shape");

                        shape.enabled = GUI.Toggle(GUI.MakeLabel("Enable"), shape.enabled, skin.button, skin.label);
                        if (shape is AGXUnity.Collide.Mesh)
                        {
                            GUI.Separator();

                            var newMeshSource = GUI.ShapeMeshSourceGUI((shape as AGXUnity.Collide.Mesh).SourceObjects.FirstOrDefault(), skin);
                            if (newMeshSource != null)
                            {
                                (shape as AGXUnity.Collide.Mesh).SetSourceObject(newMeshSource);
                            }
                        }
                        GUI.Separator();
                        BaseEditor <Shape> .Update(shape, shape, skin);
                    }
                }
            }
        }
Example #2
0
        public override void OnPostTargetMembersGUI()
        {
            var skin = InspectorEditor.Skin;

            GUI.Separator();

            GUIStyle dragDropFieldStyle = new GUIStyle(skin.textArea);

            dragDropFieldStyle.alignment = TextAnchor.MiddleCenter;
            dragDropFieldStyle.richText  = true;

            Rect dropArea = new Rect();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(GUI.MakeLabel("Assign Shape Material [" + GUI.AddColorTag("drop area", Color.Lerp(Color.green, Color.black, 0.4f)) + "]",
                                              false,
                                              "Assigns dropped shape material to all shapes in this rigid body."),
                                dragDropFieldStyle,
                                GUILayout.Height(22));
                dropArea = GUILayoutUtility.GetLastRect();

                bool resetMaterials = GUILayout.Button(GUI.MakeLabel("Reset",
                                                                     false,
                                                                     "Reset shapes material to null."),
                                                       skin.button,
                                                       GUILayout.Width(42)) &&
                                      EditorUtility.DisplayDialog("Reset shape materials", "Reset all shapes material to default [null]?", "OK", "Cancel");
                if (resetMaterials)
                {
                    AssignShapeMaterialToAllShapes(null);
                }
            }
            GUILayout.EndHorizontal();

            GUI.HandleDragDrop <ShapeMaterial>(dropArea, Event.current, (shapeMaterial) => { AssignShapeMaterialToAllShapes(shapeMaterial); });

            GUI.Separator();

            OnShapeListGUI(RigidBody.GetComponentsInChildren <Shape>(), this);

            GUI.Separator();

            OnConstraintListGUI(m_constraints.ToArray(), this);
        }
Example #3
0
        private void HandleConstraintControllerGUI(ElementaryConstraintController controller, GUISkin skin)
        {
            var    controllerType    = controller.GetControllerType();
            var    controllerTypeTag = controllerType.ToString().Substring(0, 1);
            string dimString         = "[" + GUI.AddColorTag(controllerTypeTag,
                                                             controllerType == Constraint.ControllerType.Rotational ?
                                                             Color.Lerp(UnityEngine.GUI.color, Color.red, 0.75f) :
                                                             Color.Lerp(UnityEngine.GUI.color, Color.green, 0.75f)) + "] ";

            if (GUI.Foldout(Selected(SelectedFoldout.Controller,
                                     controllerTypeTag + ConstraintUtils.FindName(controller)),
                            GUI.MakeLabel(dimString + ConstraintUtils.FindName(controller), true),
                            skin,
                            OnFoldoutStateChange))
            {
                using (new GUI.Indent(12)) {
                    controller.Enable = GUI.Toggle(GUI.MakeLabel("Enable", controller.Enable), controller.Enable, skin.button, skin.label);
                    BaseEditor <ElementaryConstraint> .Update(controller, controller, skin);
                }
            }
        }
Example #4
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();
                    }
                }
            }
        }
Example #5
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();
                    }
                }
            }
        }
Example #6
0
        public static void OnRigidBodyListGUI(RigidBody[] rigidBodies, UnityEngine.Object context, GUISkin skin)
        {
            if (!GUI.Foldout(EditorData.Instance.GetData(context, "Rigid Bodies"), GUI.MakeLabel("Rigid Bodies", true), skin))
            {
                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, rb.GetInstanceID().ToString()),
                                     GUI.MakeLabel("[" + GUI.AddColorTag("RigidBody", Color.Lerp(Color.blue, Color.white, 0.35f)) + "] " + rb.name),
                                     skin))
                    {
                        continue;
                    }

                    GUI.Separator();
                    var rbTool = new RigidBodyTool(rb)
                    {
                        ToolsActive = false
                    };
                    using (new GUI.Indent(12)) {
                        rbTool.OnPreTargetMembersGUI(skin);
                        BaseEditor <RigidBody> .Update(rb, rb, skin);
                    }
                }
            }
        }
Example #7
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();
                    }
                }
            }
        }
Example #8
0
        public static void OnConstraintListGUI(Constraint[] constraints, UnityEngine.Object context, GUISkin skin)
        {
            if (!GUI.Foldout(EditorData.Instance.GetData(context, "Constraints"), GUI.MakeLabel("Constraints", true), skin))
            {
                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, constraint.GetInstanceID().ToString()),
                                     GUI.MakeLabel("[" + GUI.AddColorTag(constraint.Type.ToString(), Color.Lerp(Color.magenta, Color.black, 0.4f)) + "] " + constraint.name),
                                     skin))
                    {
                        continue;
                    }

                    GUI.Separator();
                    var constraintTool = new ConstraintTool(constraint)
                    {
                        OnFoldoutStateChange = state => EditorUtility.SetDirty(context)
                    };
                    using (new GUI.Indent(12)) {
                        constraintTool.OnPreTargetMembersGUI(skin);
                    }
                }
            }
        }
Example #9
0
        private void OnConstraintListGUI(GUISkin skin)
        {
            if (m_constraints.Count == 0)
            {
                return;
            }

            GUI.Separator();

            if (!GUI.Foldout(EditorData.Instance.GetData(RigidBody, "Constraints"), GUI.MakeLabel("Constraints", true), skin))
            {
                return;
            }

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

                    GUI.Separator();
                    var constraintTool = new ConstraintTool(constraint)
                    {
                        OnFoldoutStateChange = state => EditorUtility.SetDirty(RigidBody)
                    };
                    using (new GUI.Indent(12)) {
                        constraintTool.OnPreTargetMembersGUI(skin);
                    }
                }
            }
        }
Example #10
0
        protected override string GetNodeTypeString(RouteNode node)
        {
            var cableNode = node as CableRouteNode;

            return(GUI.AddColorTag(cableNode.Type.ToString().SplitCamelCase(), GetColor(cableNode)));
        }
Example #11
0
        public override void OnPostTargetMembersGUI()
        {
            var skin = InspectorEditor.Skin;

            GUI.Separator();

            Simulation.DisplayStatistics = GUI.Toggle(GUI.MakeLabel("Display Statistics"), Simulation.DisplayStatistics, skin.button, skin.label);
            if (Simulation.DisplayStatistics)
            {
                using (new GUI.Indent(12))
                    Simulation.DisplayMemoryAllocations = GUI.Toggle(GUI.MakeLabel("Display Memory Allocations"), Simulation.DisplayMemoryAllocations, skin.button, skin.label);
            }

            GUI.Separator();

            using (new GUILayout.HorizontalScope()) {
                EditorGUI.BeginDisabledGroup(!Application.isPlaying);
                if (GUILayout.Button(GUI.MakeLabel("Save current step as (.agx)...",
                                                   false,
                                                   "Save scene in native file format when the editor is in play mode."), skin.button))
                {
                    string result = EditorUtility.SaveFilePanel("Save scene as .agx", "Assets",
                                                                UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name,
                                                                "agx");
                    if (result != string.Empty)
                    {
                        var success = Simulation.SaveToNativeFile(result);
                        if (success)
                        {
                            Debug.Log(GUI.AddColorTag("Successfully wrote simulation to file: ", Color.green) + result);
                        }
                    }
                }

                if (GUILayout.Button(GUI.MakeLabel("Open in AGX native viewer",
                                                   false,
                                                   "Creates Lua file, saves current scene to an .agx file and executes luaagx.exe."), skin.button))
                {
                    Simulation.OpenInNativeViewer();
                }
                EditorGUI.EndDisabledGroup();
            }

            GUI.Separator();

            Simulation.SavePreFirstStep = GUI.Toggle(GUI.MakeLabel("Dump initial (.agx):"),
                                                     Simulation.SavePreFirstStep,
                                                     skin.button,
                                                     skin.label);
            EditorGUI.BeginDisabledGroup(!Simulation.SavePreFirstStep);
            {
                using (new GUILayout.HorizontalScope()) {
                    GUILayout.Space(26);
                    Simulation.SavePreFirstStepPath = GUILayout.TextField(Simulation.SavePreFirstStepPath, skin.textField);
                    if (GUILayout.Button(GUI.MakeLabel("...", false, "Open file panel"),
                                         skin.button,
                                         GUILayout.Width(28)))
                    {
                        string result = EditorUtility.SaveFilePanel("Path to initial dump (including file name and extension)",
                                                                    SaveInitialPath,
                                                                    UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name, "agx");
                        if (result != string.Empty)
                        {
                            SaveInitialPath = result;
                            var fileInfo = new System.IO.FileInfo(SaveInitialPath);
                            if (fileInfo.Extension == ".agx" || fileInfo.Extension == ".aagx")
                            {
                                Simulation.SavePreFirstStepPath = SaveInitialPath;
                            }
                            else
                            {
                                Debug.Log("Unknown file extension: " + fileInfo.Extension);
                            }
                        }
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
        }
Example #12
0
        public override void OnPreTargetMembersGUI()
        {
            var skin           = InspectorEditor.Skin;
            var constraints    = GetTargets <Constraint>().ToArray();
            var refConstraint  = constraints[0];
            var differentTypes = false;

            for (int i = 1; i < constraints.Length; ++i)
            {
                differentTypes = differentTypes || refConstraint.Type != constraints[i].Type;
            }

            GUILayout.Label(GUI.MakeLabel((differentTypes ?
                                           "Constraints" :
                                           refConstraint.Type.ToString() + (IsMultiSelect ? "s" : string.Empty)),
                                          24,
                                          true),
                            GUI.Align(skin.label, TextAnchor.MiddleCenter));

            GUI.Separator();

            // Render AttachmentPair GUI.
            ConstraintAttachmentFrameTool.OnPreTargetMembersGUI();

            Undo.RecordObjects(constraints, "ConstraintTool");

            UnityEngine.GUI.changed = false;

            EditorGUI.showMixedValue = constraints.Any(constraint => refConstraint.CollisionsState != constraint.CollisionsState);
            var collisionsState = ConstraintCollisionsStateGUI(refConstraint.CollisionsState, skin);

            EditorGUI.showMixedValue = false;

            if (UnityEngine.GUI.changed)
            {
                foreach (var constraint in constraints)
                {
                    constraint.CollisionsState = collisionsState;
                }
                UnityEngine.GUI.changed = false;
            }

            EditorGUI.showMixedValue = constraints.Any(constraint => refConstraint.SolveType != constraint.SolveType);
            var solveType = ConstraintSolveTypeGUI(refConstraint.SolveType, skin);

            EditorGUI.showMixedValue = false;

            if (UnityEngine.GUI.changed)
            {
                foreach (var constraint in constraints)
                {
                    constraint.SolveType = solveType;
                }
                UnityEngine.GUI.changed = false;
            }

            GUI.Separator();

            EditorGUI.showMixedValue = constraints.Any(constraint => refConstraint.ConnectedFrameNativeSyncEnabled != constraint.ConnectedFrameNativeSyncEnabled);
            var frameNativeSync = ConstraintConnectedFrameSyncGUI(refConstraint.ConnectedFrameNativeSyncEnabled, skin);

            EditorGUI.showMixedValue = false;

            if (UnityEngine.GUI.changed)
            {
                foreach (var constraint in constraints)
                {
                    constraint.ConnectedFrameNativeSyncEnabled = frameNativeSync;
                }
                UnityEngine.GUI.changed = false;
            }

            if (differentTypes)
            {
                GUI.WarningLabel("Constraints are of different types.\nRow data editing not supported.", skin);
                return;
            }

            Func <string, EditorDataEntry> selected = (id) =>
            {
                return(EditorData.Instance.GetData(refConstraint, id, entry => entry.Bool = false));
            };

            var constraintsParser = (from constraint
                                     in constraints
                                     select ConstraintUtils.ConstraintRowParser.Create(constraint)).ToArray();
            var allElementaryConstraints = constraints.SelectMany(constraint => constraint.GetOrdinaryElementaryConstraints()).ToArray();

            Undo.RecordObjects(allElementaryConstraints, "ConstraintTool");

            var ecRowDataWrappers = InvokeWrapper.FindFieldsAndProperties <ElementaryConstraintRowData>();

            GUI.Separator();
            foreach (ConstraintUtils.ConstraintRowParser.RowType rowType in Enum.GetValues(typeof(ConstraintUtils.ConstraintRowParser.RowType)))
            {
                if (!GUI.Foldout(selected("ec_" + rowType.ToString()),
                                 GUI.MakeLabel(rowType.ToString() + " properties", true),
                                 skin))
                {
                    GUI.Separator();
                    continue;
                }

                using (new GUI.Indent(12)) {
                    var refTransOrRotRowData = constraintsParser[0][rowType];
                    foreach (var wrapper in ecRowDataWrappers)
                    {
                        if (!InspectorEditor.ShouldBeShownInInspector(wrapper.Member))
                        {
                            continue;
                        }
                        using (new GUILayout.HorizontalScope()) {
                            GUILayout.Label(InspectorGUI.MakeLabel(wrapper.Member), skin.label);
                            GUILayout.FlexibleSpace();
                            using (new GUILayout.VerticalScope()) {
                                for (int i = 0; i < 3; ++i)
                                {
                                    var rowDataInstances = (from constraintParser
                                                            in constraintsParser
                                                            where constraintParser[rowType][i] != null
                                                            select constraintParser[rowType][i].RowData).ToArray();
                                    // TODO: This could probably be replaced by using InspectorEditor.HandleType
                                    //       with a tweak. We use wrapper.Get<type>( foo.RowData ) while our
                                    //       drawers uses wrapper.Get<type>().
                                    // UPDATE: Probably not worth it because we have to override all labels
                                    //         written by our default drawers.
                                    // ****************************************************************************
                                    //var objects = ( from constraintParser
                                    //                in constraintsParser
                                    //                where constraintParser[ rowType ][ i ] != null
                                    //                select constraintParser[ rowType ][ i ].RowData ).ToArray();
                                    //using ( new GUILayout.HorizontalScope() )
                                    //using ( new GUI.EnabledBlock( refTransOrRotRowData[ i ] != null ) ) {
                                    //  RowLabel( i, skin );
                                    //  InspectorEditor.HandleType( wrapper, objects );
                                    //}
                                    // ****************************************************************************

                                    using (new GUILayout.HorizontalScope())
                                        using (new GUI.EnabledBlock(refTransOrRotRowData[i] != null)) {
                                            RowLabel(i, skin);

                                            // Handling type float, e.g., compliance and damping.
                                            if (wrapper.IsType <float>())
                                            {
                                                EditorGUI.showMixedValue = !wrapper.AreValuesEqual(rowDataInstances);
                                                var value = EditorGUILayout.FloatField(wrapper.Get <float>(refTransOrRotRowData[i]?.RowData));
                                                if (UnityEngine.GUI.changed)
                                                {
                                                    foreach (var constraintParser in constraintsParser)
                                                    {
                                                        wrapper.ConditionalSet(constraintParser[rowType][i].RowData, value);
                                                    }
                                                    UnityEngine.GUI.changed = false;
                                                }
                                                EditorGUI.showMixedValue = false;
                                            }
                                            // Handling type RangeReal, e.g., force range.
                                            // Note: During multi-selection we don't want to write, e.g., Min from
                                            //       reference row data when value for Max is changed.
                                            else if (wrapper.IsType <RangeReal>())
                                            {
                                                EditorGUI.showMixedValue = rowDataInstances.Any(rowData => !Equals(wrapper.Get <RangeReal>(refTransOrRotRowData[i]?.RowData).Min,
                                                                                                                   wrapper.Get <RangeReal>(rowData).Min));
                                                var forceRangeMin = EditorGUILayout.FloatField(wrapper.Get <RangeReal>(refTransOrRotRowData[i]?.RowData).Min,
                                                                                               GUILayout.MaxWidth(128));
                                                var forceRangeMinChanged = UnityEngine.GUI.changed;
                                                EditorGUI.showMixedValue = false;
                                                UnityEngine.GUI.changed  = false;
                                                EditorGUI.showMixedValue = rowDataInstances.Any(rowData => !Equals(wrapper.Get <RangeReal>(refTransOrRotRowData[i]?.RowData).Max,
                                                                                                                   wrapper.Get <RangeReal>(rowData).Max));
                                                var forceRangeMax = EditorGUILayout.FloatField(wrapper.Get <RangeReal>(refTransOrRotRowData[i]?.RowData).Max,
                                                                                               GUILayout.MaxWidth(128));
                                                if (forceRangeMinChanged || UnityEngine.GUI.changed)
                                                {
                                                    foreach (var constraintParser in constraintsParser)
                                                    {
                                                        var range = wrapper.Get <RangeReal>(constraintParser[rowType][i].RowData);
                                                        if (forceRangeMinChanged)
                                                        {
                                                            range.Min = forceRangeMin;
                                                        }
                                                        if (UnityEngine.GUI.changed)
                                                        {
                                                            range.Max = forceRangeMax;
                                                        }

                                                        // Validation of Min > Max has to go somewhere else because if e.g.,
                                                        // Min = 50 and the user wants to type Max = 200 we're receiving
                                                        // Max = 2 as the user types.

                                                        wrapper.ConditionalSet(constraintParser[rowType][i].RowData, range);
                                                    }
                                                    UnityEngine.GUI.changed  = false;
                                                    EditorGUI.showMixedValue = false;
                                                }
                                            } // IsType RangeReal.
                                        }// Horizontal and GUI Enabled blocks.
                                }             // For U, V, N.
                            }                 // Right align vertical scope.
                        }                     // Horizontal with flexible space for alignment.
                        GUI.Separator();
                    }                         // For type wrappers.
                }                             // Indentation.
                GUI.Separator();
            }                                 // For Translational, Rotational.

            if (GUI.Foldout(selected("controllers"),
                            GUI.MakeLabel("Controllers", true),
                            skin))
            {
                GUI.Separator();
                using (new GUI.Indent(12)) {
                    foreach (var refController in refConstraint.GetElementaryConstraintControllers())
                    {
                        var    controllerType    = refController.GetControllerType();
                        var    controllerTypeTag = controllerType.ToString()[0].ToString();
                        var    controllerName    = ConstraintUtils.FindName(refController);
                        string dimString         = "[" + GUI.AddColorTag(controllerTypeTag,
                                                                         controllerType == Constraint.ControllerType.Rotational ?
                                                                         Color.Lerp(UnityEngine.GUI.color, Color.red, 0.75f) :
                                                                         Color.Lerp(UnityEngine.GUI.color, Color.green, 0.75f)) + "] ";
                        if (!GUI.Foldout(selected(controllerTypeTag + controllerName),
                                         GUI.MakeLabel(dimString + controllerName, true),
                                         skin))
                        {
                            GUI.Separator();
                            continue;
                        }

                        var controllers = (from constraint
                                           in constraints
                                           from controller
                                           in constraint.GetElementaryConstraintControllers()
                                           where controller.GetType() == refController.GetType()
                                           select controller).ToArray();
                        using (new GUI.Indent(12)) {
                            InspectorEditor.DrawMembersGUI(controllers);
                            GUI.Separator();
                            InspectorEditor.DrawMembersGUI(controllers, controller => (controller as ElementaryConstraint).RowData[0]);
                        }

                        GUI.Separator();
                    }
                }
            }
        }