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(propBorder);
            bool hasBordersInSelection = targets.Any(x => (x as RegularPolygon).Border);

            using (new EditorGUI.DisabledScope(hasBordersInSelection == false))
                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();


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

            fillEditor.DrawProperties(this);

            base.EndProperties();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            base.BeginProperties();
            bool multiEditing = serializedObject.isEditingMultipleObjects;

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

            EditorGUILayout.PropertyField(propPivot);
            using (new EditorGUILayout.HorizontalScope()) {
                EditorGUILayout.PrefixLabel("Size");
                using (ShapesUI.TempLabelWidth(14)) {
                    EditorGUILayout.PropertyField(propWidth, new GUIContent("X"), GUILayout.MinWidth(20));
                    EditorGUILayout.PropertyField(propHeight, new GUIContent("Y"), GUILayout.MinWidth(20));
                }
            }

            bool isBorder = ((Rectangle)target).IsBorder;

            using (new EditorGUI.DisabledScope(!multiEditing && isBorder == false))
                ShapesUI.FloatInSpaceField(propThickness, propThicknessSpace);

            bool hasRadius = ((Rectangle)target).IsRounded;

            using (new EditorGUI.DisabledScope(hasRadius == false)) {
                EditorGUILayout.PropertyField(propCornerRadiusMode, new GUIContent("Radius Mode"));
                CornerRadiusProperties();
            }

            rectEditor.GUIEditButton();

            bool hasDashablesInSelection = targets.Any(x => (x as Rectangle).IsBorder);

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

            fillEditor.DrawProperties(this);

            base.EndProperties();
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
0
        public override void OnInspectorGUI()
        {
            SerializedObject so = serializedObject;

            // show detail edit
            bool showDetailEdit = targets.OfType <Line>().Any(x => x.Geometry == LineGeometry.Volumetric3D);

            base.BeginProperties(showColor: false, canEditDetailLevel: showDetailEdit);

            bool updateGeometry = false;

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(propGeometry, new GUIContent("Geometry"));
            if (EditorGUI.EndChangeCheck())
            {
                updateGeometry = true;
            }
            EditorGUILayout.PropertyField(propStart);
            EditorGUILayout.PropertyField(propEnd);
            ShapesUI.FloatInSpaceField(propThickness, propThicknessSpace);
            scenePointEditor.GUIEditButton("Edit Points in Scene");

            // style (color, caps, dashes)
            ShapesUI.BeginGroup();
            EditorGUILayout.PropertyField(propColorMode);
            if ((Line.LineColorMode)propColorMode.enumValueIndex == Line.LineColorMode.Single)
            {
                base.PropertyFieldColor();
            }
            else
            {
                using (new EditorGUILayout.HorizontalScope()) {
                    EditorGUILayout.PrefixLabel("Colors");
                    base.PropertyFieldColor(GUIContent.none);
                    EditorGUILayout.PropertyField(propColorEnd, GUIContent.none);
                }
            }

            using (new EditorGUILayout.HorizontalScope()) {
                EditorGUILayout.PrefixLabel("End Caps");
                if (ShapesUI.DrawTypeSwitchButtons(propEndCaps, UIAssets.LineCapButtonContents))
                {
                    updateGeometry = true;
                }
            }

            ShapesUI.EndGroup();

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

            base.EndProperties();

            if (updateGeometry)
            {
                foreach (Line line in targets.Cast <Line>())
                {
                    line.UpdateMesh();
                }
            }
        }
Ejemplo n.º 6
0
        public override void OnInspectorGUI()
        {
            SerializedObject so = serializedObject;

            base.BeginProperties(showColor: false);

            bool updateGeometry = false;

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(propGeometry, new GUIContent("Geometry"));
            if (EditorGUI.EndChangeCheck())
            {
                updateGeometry = true;
            }

            // shape (positions & thickness)
            ShapesUI.BeginGroup();
            EditorGUILayout.PropertyField(propStart);
            EditorGUILayout.PropertyField(propEnd);
            ShapesUI.FloatInSpaceField(propThickness, propThicknessSpace);
            ShapesUI.EndGroup();

            // style (color, caps, dashes)
            ShapesUI.BeginGroup();
            EditorGUILayout.PropertyField(propColorMode);
            if ((Line.LineColorMode)propColorMode.enumValueIndex == Line.LineColorMode.Single)
            {
                base.PropertyFieldColor();
            }
            else
            {
                using (new EditorGUILayout.HorizontalScope()) {
                    EditorGUILayout.PrefixLabel("Colors");
                    base.PropertyFieldColor(GUIContent.none);
                    EditorGUILayout.PropertyField(propColorEnd, GUIContent.none);
                }
            }

            using (new EditorGUILayout.HorizontalScope()) {
                EditorGUILayout.PrefixLabel("End Caps");
                if (ShapesUI.DrawTypeSwitchButtons(propEndCaps, ShapesAssets.LineCapButtonContents, 20))
                {
                    updateGeometry = true;
                }
            }

            ShapesUI.EndGroup();

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

            base.EndProperties();

            if (updateGeometry)
            {
                foreach (Line line in targets.Cast <Line>())
                {
                    line.UpdateMesh();
                }
            }
        }