public override void OnInspectorGUI()
        {
            base.BeginProperties(showColor: false);

            // Color properties
            EditorGUILayout.PropertyField(propColorMode);
            switch ((Disc.DiscColorMode)propColorMode.enumValueIndex)
            {
            case Disc.DiscColorMode.Single:
                base.PropertyFieldColor();
                break;

            case Disc.DiscColorMode.Radial:
                base.PropertyFieldColor("Inner");
                EditorGUILayout.PropertyField(propColorOuterStart, new GUIContent("Outer"));
                break;

            case Disc.DiscColorMode.Angular:
                base.PropertyFieldColor("Start");
                EditorGUILayout.PropertyField(propColorInnerEnd, new GUIContent("End"));
                break;

            case Disc.DiscColorMode.Bilinear:
                base.PropertyFieldColor("Inner Start");
                EditorGUILayout.PropertyField(propColorOuterStart, new GUIContent("Outer Start"));
                EditorGUILayout.PropertyField(propColorInnerEnd, new GUIContent("Inner End"));
                EditorGUILayout.PropertyField(propColorOuterEnd, new GUIContent("Outer End"));
                break;
            }

            using (new EditorGUILayout.HorizontalScope()) {
                EditorGUILayout.PrefixLabel("Type");
                ShapesUI.DrawTypeSwitchButtons(propType, ShapesAssets.DiscTypeButtonContents, 20);
            }

            DiscType selectedType = (DiscType)propType.enumValueIndex;

            if (propType.enumValueIndex == (int)DiscType.Arc)
            {
                ShapesUI.EnumToggleProperty(propArcEndCaps, "Round Caps");
            }
            ShapesUI.FloatInSpaceField(propRadius, propRadiusSpace);
            using (new EditorGUI.DisabledScope(selectedType.HasThickness() == false && serializedObject.isEditingMultipleObjects == false))
                ShapesUI.FloatInSpaceField(propThickness, propThicknessSpace);
            DrawAngleProperties(selectedType);

            ShapesUI.BeginGroup();
            dashEditor.DrawProperties();
            ShapesUI.EndGroup();

            base.EndProperties();
        }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            base.BeginProperties(showColor: false);

            EditorGUILayout.PropertyField(propGeometry);

            // Color properties
            EditorGUILayout.PropertyField(propColorMode);
            switch ((Disc.DiscColorMode)propColorMode.enumValueIndex)
            {
            case Disc.DiscColorMode.Single:
                base.PropertyFieldColor();
                break;

            case Disc.DiscColorMode.Radial:
                base.PropertyFieldColor("Inner");
                EditorGUILayout.PropertyField(propColorOuterStart, new GUIContent("Outer"));
                break;

            case Disc.DiscColorMode.Angular:
                base.PropertyFieldColor("Start");
                EditorGUILayout.PropertyField(propColorInnerEnd, new GUIContent("End"));
                break;

            case Disc.DiscColorMode.Bilinear:
                base.PropertyFieldColor("Inner Start");
                EditorGUILayout.PropertyField(propColorOuterStart, new GUIContent("Outer Start"));
                EditorGUILayout.PropertyField(propColorInnerEnd, new GUIContent("Inner End"));
                EditorGUILayout.PropertyField(propColorOuterEnd, new GUIContent("Outer End"));
                break;
            }

            using (new EditorGUILayout.HorizontalScope()) {
                EditorGUILayout.PrefixLabel("Type");
                ShapesUI.DrawTypeSwitchButtons(propType, UIAssets.DiscTypeButtonContents);
            }

            DiscType selectedType = (DiscType)propType.enumValueIndex;

            if (propType.enumValueIndex == (int)DiscType.Arc)
            {
                ShapesUI.EnumToggleProperty(propArcEndCaps, "Round Caps");
            }
            ShapesUI.FloatInSpaceField(propRadius, propRadiusSpace);
            using (new EditorGUI.DisabledScope(selectedType.HasThickness() == false && serializedObject.isEditingMultipleObjects == false))
                ShapesUI.FloatInSpaceField(propThickness, propThicknessSpace);
            DrawAngleProperties(selectedType);

            bool canEditInSceneView = propRadiusSpace.hasMultipleDifferentValues || propRadiusSpace.enumValueIndex == (int)ThicknessSpace.Meters;

            using (new EditorGUI.DisabledScope(canEditInSceneView == false))
                discEditor.GUIEditButton();

            bool hasDashablesInSelection = targets.Any(x => (x as Disc).HasThickness);

            using (new ShapesUI.GroupScope())
                using (new EditorGUI.DisabledScope(hasDashablesInSelection == false))
                    dashEditor.DrawProperties();

            base.EndProperties();
        }