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

Commit 3990b5b

Browse files
committed
Moved layer states out of editor prefs
1 parent a6663d0 commit 3990b5b

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

PostProcessing/Editor/PostProcessLayerEditor.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public sealed class PostProcessLayerEditor : BaseEditor<PostProcessLayer>
3737
SerializedProperty m_DebugMonitor;
3838
SerializedProperty m_DebugLightMeter;
3939

40+
SerializedProperty m_ShowToolkit;
41+
SerializedProperty m_ShowCustomSorter;
42+
4043
Dictionary<PostProcessEvent, ReorderableList> m_CustomLists;
4144

4245
static GUIContent[] s_AntialiasingMethodNames =
@@ -80,6 +83,9 @@ void OnEnable()
8083
m_DebugMonitor = FindProperty(x => x.debugView.monitor);
8184
m_DebugLightMeter = FindProperty(x => x.debugView.lightMeter);
8285

86+
m_ShowToolkit = serializedObject.FindProperty("m_ShowToolkit");
87+
m_ShowCustomSorter = serializedObject.FindProperty("m_ShowCustomSorter");
88+
8389
// In case of domain reload, if the inspector is opened on a disabled PostProcessLayer
8490
// component it won't go through its OnEnable() and thus will miss bundle initialization
8591
// so force it there - also for some reason, an editor's OnEnable() can be called before
@@ -279,9 +285,9 @@ void DoDebugLayer()
279285
void DoToolkit()
280286
{
281287
EditorUtilities.DrawSplitter();
282-
GlobalSettings.showLayerToolkit = EditorUtilities.DrawHeader("Toolkit", GlobalSettings.showLayerToolkit);
288+
m_ShowToolkit.boolValue = EditorUtilities.DrawHeader("Toolkit", m_ShowToolkit.boolValue);
283289

284-
if (GlobalSettings.showLayerToolkit)
290+
if (m_ShowToolkit.boolValue)
285291
{
286292
GUILayout.Space(2);
287293

@@ -328,9 +334,9 @@ void DoToolkit()
328334
void DoCustomEffectSorter()
329335
{
330336
EditorUtilities.DrawSplitter();
331-
GlobalSettings.showCustomSorter = EditorUtilities.DrawHeader("Custom Effect Sorting", GlobalSettings.showCustomSorter);
337+
m_ShowCustomSorter.boolValue = EditorUtilities.DrawHeader("Custom Effect Sorting", m_ShowCustomSorter.boolValue);
332338

333-
if (GlobalSettings.showCustomSorter)
339+
if (m_ShowCustomSorter.boolValue)
334340
{
335341
GUILayout.Space(5);
336342

PostProcessing/Editor/Utils/GlobalSettings.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ static class Keys
1111
internal const string volumeGizmoColor = "PostProcessing.Volume.GizmoColor";
1212
internal const string currentChannelMixer = "PostProcessing.ChannelMixer.CurrentChannel";
1313
internal const string currentCurve = "PostProcessing.Curve.Current";
14-
internal const string showLayerToolkit = "PostProcessing.Layer.showLayerToolkit";
15-
internal const string showCustomSorter = "PostProcessing.Layer.ShowCustomSorter";
1614
}
1715

1816
static bool m_Loaded = false;
@@ -45,20 +43,6 @@ internal static int currentCurve
4543
set { TrySave(ref m_CurrentCurve, value, Keys.currentCurve); }
4644
}
4745

48-
static bool m_ShowCustomSorter = false;
49-
internal static bool showCustomSorter
50-
{
51-
get { return m_ShowCustomSorter; }
52-
set { TrySave(ref m_ShowCustomSorter, value, Keys.showCustomSorter); }
53-
}
54-
55-
static bool m_ShowLayerToolkit = false;
56-
internal static bool showLayerToolkit
57-
{
58-
get { return m_ShowLayerToolkit; }
59-
set { TrySave(ref m_ShowLayerToolkit, value, Keys.showLayerToolkit); }
60-
}
61-
6246
static GlobalSettings()
6347
{
6448
Load();
@@ -82,8 +66,6 @@ static void Load()
8266
m_VolumeGizmoColor = GetColor(Keys.volumeGizmoColor, new Color(0.2f, 0.8f, 0.1f, 0.5f));
8367
m_CurrentChannelMixer = EditorPrefs.GetInt(Keys.currentChannelMixer, 0);
8468
m_CurrentCurve = EditorPrefs.GetInt(Keys.currentCurve, 0);
85-
m_ShowLayerToolkit = EditorPrefs.GetBool(Keys.showLayerToolkit, false);
86-
m_ShowCustomSorter = EditorPrefs.GetBool(Keys.showCustomSorter, false);
8769

8870
m_Loaded = true;
8971
}

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ public enum Antialiasing
3939
[SerializeField]
4040
PostProcessResources m_Resources;
4141

42+
// UI states
43+
[SerializeField]
44+
bool m_ShowToolkit;
45+
46+
[SerializeField]
47+
bool m_ShowCustomSorter;
48+
4249
// Will stop applying post-processing effects just before color grading is applied
4350
// Currently used to export to exr without color grading
4451
public bool breakBeforeColorGrading = false;

0 commit comments

Comments
 (0)