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

Commit c73f1d4

Browse files
committed
Changed the trackball UI to be more compact
1 parent 0374371 commit c73f1d4

2 files changed

Lines changed: 34 additions & 9 deletions

File tree

PostProcessing/Editor/Models/ColorGradingModelEditor.cs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace UnityEditor.PostProcessing
88
{
99
using Settings = ColorGradingModel.Settings;
1010
using Tonemapper = ColorGradingModel.Tonemapper;
11+
using ColorWheelMode = ColorGradingModel.ColorWheelMode;
1112

1213
[PostProcessingModelEditor(typeof(ColorGradingModel))]
1314
public class ColorGradingModelEditor : PostProcessingModelEditor
@@ -48,6 +49,7 @@ struct ChannelMixerSettings
4849

4950
struct ColorWheelsSettings
5051
{
52+
public SerializedProperty mode;
5153
public SerializedProperty log;
5254
public SerializedProperty linear;
5355
}
@@ -138,6 +140,7 @@ public override void OnEnable()
138140
// Color wheels
139141
m_ColorWheels = new ColorWheelsSettings
140142
{
143+
mode = FindSetting((Settings x) => x.colorWheels.mode),
141144
log = FindSetting((Settings x) => x.colorWheels.log),
142145
linear = FindSetting((Settings x) => x.colorWheels.linear)
143146
};
@@ -400,15 +403,28 @@ void DoChannelMixerGUI()
400403

401404
void DoColorWheelsGUI()
402405
{
403-
EditorGUILayout.Space();
404-
EditorGUILayout.PropertyField(m_ColorWheels.linear);
405-
var rect = GUILayoutUtility.GetLastRect();
406-
WheelSetTitle(rect, "Linear Controls");
407-
408-
EditorGUILayout.Space();
409-
EditorGUILayout.PropertyField(m_ColorWheels.log);
410-
rect = GUILayoutUtility.GetLastRect();
411-
WheelSetTitle(rect, "Log Controls");
406+
int wheelMode = m_ColorWheels.mode.intValue;
407+
408+
using (new EditorGUILayout.HorizontalScope())
409+
{
410+
GUILayout.Space(15);
411+
if (GUILayout.Toggle(wheelMode == (int)ColorWheelMode.Linear, "Linear", EditorStyles.miniButtonLeft)) wheelMode = (int)ColorWheelMode.Linear;
412+
if (GUILayout.Toggle(wheelMode == (int)ColorWheelMode.Log, "Log", EditorStyles.miniButtonRight)) wheelMode = (int)ColorWheelMode.Log;
413+
}
414+
415+
m_ColorWheels.mode.intValue = wheelMode;
416+
EditorGUILayout.Space();
417+
418+
if (wheelMode == (int)ColorWheelMode.Linear)
419+
{
420+
EditorGUILayout.PropertyField(m_ColorWheels.linear);
421+
WheelSetTitle(GUILayoutUtility.GetLastRect(), "Linear Controls");
422+
}
423+
else if (wheelMode == (int)ColorWheelMode.Log)
424+
{
425+
EditorGUILayout.PropertyField(m_ColorWheels.log);
426+
WheelSetTitle(GUILayoutUtility.GetLastRect(), "Log Controls");
427+
}
412428
}
413429

414430
static void WheelSetTitle(Rect position, string label)

PostProcessing/Runtime/Models/ColorGradingModel.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,17 @@ public static LinearWheelsSettings defaultSettings
181181
}
182182
}
183183

184+
public enum ColorWheelMode
185+
{
186+
Linear,
187+
Log
188+
}
189+
184190
[Serializable]
185191
public struct ColorWheelsSettings
186192
{
193+
public ColorWheelMode mode;
194+
187195
[TrackballGroup]
188196
public LogWheelsSettings log;
189197

@@ -196,6 +204,7 @@ public static ColorWheelsSettings defaultSettings
196204
{
197205
return new ColorWheelsSettings
198206
{
207+
mode = ColorWheelMode.Log,
199208
log = LogWheelsSettings.defaultSettings,
200209
linear = LinearWheelsSettings.defaultSettings
201210
};

0 commit comments

Comments
 (0)