Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 720e220

Browse files
committed
Improved volume UI & styling a bit
1 parent 84b655e commit 720e220

File tree

4 files changed

+40
-24
lines changed

4 files changed

+40
-24
lines changed

PostProcessing/Editor/Effects/ColorGradingEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ void DoStandardModeGUI(bool hdr)
293293

294294
using (new EditorGUILayout.HorizontalScope())
295295
{
296-
EditorGUILayout.PrefixLabel("Channel Mixer", GUIStyle.none, Styling.labelHeader);
296+
EditorGUILayout.PrefixLabel("Channel Mixer", GUIStyle.none, Styling.headerLabel);
297297

298298
EditorGUI.BeginChangeCheck();
299299
{

PostProcessing/Editor/PostProcessEffectBaseEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected void PropertyField(SerializedParameterOverride property, GUIContent ti
132132
var rect = EditorGUILayout.GetControlRect(false, 24f);
133133
rect.y += 8f;
134134
rect = EditorGUI.IndentedRect(rect);
135-
EditorGUI.LabelField(rect, (attr as HeaderAttribute).header, Styling.labelHeader);
135+
EditorGUI.LabelField(rect, (attr as HeaderAttribute).header, Styling.headerLabel);
136136
}
137137
}
138138
}

PostProcessing/Editor/Utils/EditorUtilities.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,17 @@ public static void DrawSplitter()
139139
if (Event.current.type != EventType.Repaint)
140140
return;
141141

142-
EditorGUI.DrawRect(rect, !EditorGUIUtility.isProSkin
143-
? new Color(0.6f, 0.6f, 0.6f, 1.333f)
144-
: new Color(0.12f, 0.12f, 0.12f, 1.333f));
142+
EditorGUI.DrawRect(rect, Styling.splitter);
145143
}
146144

147145
public static void DrawOverrideCheckbox(Rect rect, SerializedProperty property)
148146
{
149-
var oldColor = GUI.color;
150-
GUI.color = new Color(0.6f, 0.6f, 0.6f, 0.75f);
151147
property.boolValue = GUI.Toggle(rect, property.boolValue, GetContent("|Override this setting for this volume."), Styling.smallTickbox);
152-
GUI.color = oldColor;
153148
}
154149

155150
public static void DrawHeaderLabel(string title)
156151
{
157-
EditorGUILayout.LabelField(title, Styling.labelHeader);
152+
EditorGUILayout.LabelField(title, Styling.headerLabel);
158153
}
159154

160155
public static bool DrawHeader(string title, bool state)
@@ -175,13 +170,12 @@ public static bool DrawHeader(string title, bool state)
175170
backgroundRect.width += 4f;
176171

177172
// Background
178-
float backgroundTint = EditorGUIUtility.isProSkin ? 0.1f : 1f;
179-
EditorGUI.DrawRect(backgroundRect, new Color(backgroundTint, backgroundTint, backgroundTint, 0.2f));
173+
EditorGUI.DrawRect(backgroundRect, Styling.headerBackground);
180174

181175
// Title
182176
EditorGUI.LabelField(labelRect, GetContent(title), EditorStyles.boldLabel);
183177

184-
// Active checkbox
178+
// Foldout
185179
state = GUI.Toggle(foldoutRect, state, GUIContent.none, EditorStyles.foldout);
186180

187181
var e = Event.current;
@@ -203,32 +197,39 @@ public static bool DrawHeader(string title, SerializedProperty group, Serialized
203197
var backgroundRect = GUILayoutUtility.GetRect(1f, 17f);
204198

205199
var labelRect = backgroundRect;
206-
labelRect.xMin += 16f;
200+
labelRect.xMin += 32f;
207201
labelRect.xMax -= 20f;
208202

203+
var foldoutRect = backgroundRect;
204+
foldoutRect.y += 1f;
205+
foldoutRect.width = 13f;
206+
foldoutRect.height = 13f;
207+
209208
var toggleRect = backgroundRect;
209+
toggleRect.x += 16f;
210210
toggleRect.y += 2f;
211211
toggleRect.width = 13f;
212212
toggleRect.height = 13f;
213213

214-
var menuIcon = EditorGUIUtility.isProSkin
215-
? Styling.paneOptionsIconDark
216-
: Styling.paneOptionsIconLight;
217-
214+
var menuIcon = Styling.paneOptionsIcon;
218215
var menuRect = new Rect(labelRect.xMax + 4f, labelRect.y + 4f, menuIcon.width, menuIcon.height);
219216

220217
// Background rect should be full-width
221218
backgroundRect.xMin = 0f;
222219
backgroundRect.width += 4f;
223220

224221
// Background
225-
float backgroundTint = EditorGUIUtility.isProSkin ? 0.1f : 1f;
226-
EditorGUI.DrawRect(backgroundRect, new Color(backgroundTint, backgroundTint, backgroundTint, 0.2f));
222+
EditorGUI.DrawRect(backgroundRect, Styling.headerBackground);
227223

228224
// Title
229225
using (new EditorGUI.DisabledScope(!activeField.boolValue))
230226
EditorGUI.LabelField(labelRect, GetContent(title), EditorStyles.boldLabel);
231227

228+
// foldout
229+
group.serializedObject.Update();
230+
group.isExpanded = GUI.Toggle(foldoutRect, group.isExpanded, GUIContent.none, EditorStyles.foldout);
231+
group.serializedObject.ApplyModifiedProperties();
232+
232233
// Active checkbox
233234
activeField.serializedObject.Update();
234235
activeField.boolValue = GUI.Toggle(toggleRect, activeField.boolValue, GUIContent.none, Styling.smallTickbox);

PostProcessing/Editor/Utils/Styling.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@ public static class Styling
77
{
88
public static readonly GUIStyle smallTickbox;
99
public static readonly GUIStyle miniLabelButton;
10+
11+
static readonly Color splitterDark;
12+
static readonly Color splitterLight;
13+
public static Color splitter { get { return EditorGUIUtility.isProSkin ? splitterDark : splitterLight; } }
1014

11-
public static readonly Texture2D paneOptionsIconDark;
12-
public static readonly Texture2D paneOptionsIconLight;
15+
static readonly Texture2D paneOptionsIconDark;
16+
static readonly Texture2D paneOptionsIconLight;
17+
public static Texture2D paneOptionsIcon { get { return EditorGUIUtility.isProSkin ? paneOptionsIconDark : paneOptionsIconLight; } }
1318

14-
public static readonly GUIStyle labelHeader;
19+
public static readonly GUIStyle headerLabel;
20+
21+
static readonly Color headerBackgroundDark;
22+
static readonly Color headerBackgroundLight;
23+
public static Color headerBackground { get { return EditorGUIUtility.isProSkin ? headerBackgroundDark : headerBackgroundLight; } }
1524

1625
public static readonly GUIStyle wheelLabel;
1726
public static readonly GUIStyle wheelThumb;
@@ -21,7 +30,7 @@ public static class Styling
2130

2231
static Styling()
2332
{
24-
smallTickbox = new GUIStyle("ShurikenCheckMark");
33+
smallTickbox = new GUIStyle("ShurikenToggle");
2534

2635
miniLabelButton = new GUIStyle(EditorStyles.miniLabel);
2736
miniLabelButton.normal = new GUIStyleState
@@ -40,10 +49,16 @@ static Styling()
4049
miniLabelButton.onNormal = activeState;
4150
miniLabelButton.onActive = activeState;
4251

52+
splitterDark = new Color(0.12f, 0.12f, 0.12f, 1.333f);
53+
splitterLight = new Color(0.6f, 0.6f, 0.6f, 1.333f);
54+
55+
headerBackgroundDark = new Color(0.1f, 0.1f, 0.1f, 0.2f);
56+
headerBackgroundLight = new Color(1f, 1f, 1f, 0.2f);
57+
4358
paneOptionsIconDark = (Texture2D)EditorGUIUtility.Load("Builtin Skins/DarkSkin/Images/pane options.png");
4459
paneOptionsIconLight = (Texture2D)EditorGUIUtility.Load("Builtin Skins/LightSkin/Images/pane options.png");
4560

46-
labelHeader = new GUIStyle(EditorStyles.miniLabel);
61+
headerLabel = new GUIStyle(EditorStyles.miniLabel);
4762

4863
wheelThumb = new GUIStyle("ColorPicker2DThumb");
4964

0 commit comments

Comments
 (0)