Ejemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            base.BeginProperties(showColor: true);

            EditorGUILayout.PropertyField(propGeometry);
            ShapesUI.DrawTypeSwitchButtons(propSides, SideCountTypes, indexToPolygonPreset);
            //ShapesUI.EnumButtonRow(); // todo
            EditorGUILayout.PropertyField(propSides);
            EditorGUILayout.PropertyField(propRoundness);

            ShapesUI.FloatInSpaceField(propRadius, propRadiusSpace);

            EditorGUILayout.PropertyField(propHollow);
            using (new EditorGUI.DisabledScope(propHollow.boolValue == false || propHollow.hasMultipleDifferentValues))
                ShapesUI.FloatInSpaceField(propThickness, propThicknessSpace);
            ShapesUI.AngleProperty(propAngle, "Angle", propAngUnitInput, angLabelLayout);
            ShapesUI.DrawAngleSwitchButtons(propAngUnitInput);

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

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

            fillEditor.DrawProperties(this);

            base.EndProperties();
        }
Ejemplo n.º 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();
        }