public override void OnInspectorGUI() { serializedObject.Update(); base.BeginProperties(); bool multiEditing = serializedObject.isEditingMultipleObjects; using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("Type"); ShapesUI.DrawTypeSwitchButtons(propType, ShapesAssets.RectTypeButtonContents, 20); } 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 isHollow = ((Rectangle)target).IsHollow; using (new EditorGUI.DisabledScope(!multiEditing && isHollow == false)) { EditorGUILayout.PropertyField(propThickness); } bool hasRadius = ((Rectangle)target).IsRounded; using (new EditorGUI.DisabledScope(hasRadius == false)) { EditorGUILayout.PropertyField(propCornerRadiusMode, new GUIContent("Radius Mode")); CornerRadiusProperties(); } base.EndProperties(); }
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(); }
void DrawStyleGUI() { bool canSetStyle = !isLine || (propGeometry.hasMultipleDifferentValues || propGeometry.enumValueIndex != (int)LineGeometry.Volumetric3D); if (canSetStyle) { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel("Style"); ShapesUI.DrawTypeSwitchButtons(propType, UIAssets.LineDashButtonContents); } bool canEditStyle = propShapeModifier.hasMultipleDifferentValues || ((DashType)propType.enumValueIndex).HasModifier(); using (new EditorGUI.DisabledScope(canEditStyle == false)) EditorGUILayout.PropertyField(propShapeModifier); } else // this else is only applicable for lines { using (new EditorGUI.DisabledScope(true)) { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.PrefixLabel(new GUIContent("Style", "3D lines support basic dashes only")); GUILayout.Toggle(true, UIAssets.LineDashButtonContents[0], ShapesUI.GetMiniButtonStyle(0, 3), GUILayout.MinHeight(20)); GUILayout.Toggle(false, UIAssets.LineDashButtonContents[1], ShapesUI.GetMiniButtonStyle(1, 3), GUILayout.MinHeight(20)); GUILayout.Toggle(false, UIAssets.LineDashButtonContents[2], ShapesUI.GetMiniButtonStyle(2, 3), GUILayout.MinHeight(20)); } } } }
public static void DrawAngleSwitchButtons(SerializedProperty prop) { GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(" "); GUIContent[] angLabels = (Screen.width < 300) ? UIAssets.AngleUnitButtonContentsShort : UIAssets.AngleUnitButtonContents; ShapesUI.DrawTypeSwitchButtons(prop, angLabels, null, 15); GUILayout.EndHorizontal(); }
void DrawAngleProperties(DiscType selectedType) { using (new EditorGUI.DisabledScope(selectedType.HasSector() == false && serializedObject.isEditingMultipleObjects == false)) { ShapesUI.AngleProperty(propAngRadiansStart, "Angle start", propAngUnitInput, angLabelLayout); ShapesUI.AngleProperty(propAngRadiansEnd, "Angle end", propAngUnitInput, angLabelLayout); GUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(" "); GUIContent[] angLabels = (Screen.width < 300) ? ShapesAssets.AngleUnitButtonContentsShort : ShapesAssets.AngleUnitButtonContents; ShapesUI.DrawTypeSwitchButtons(propAngUnitInput, angLabels, 15); GUILayout.EndHorizontal(); } }
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(); }
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(); }
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(); }
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(); } } }
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(); } } }