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

Commit 52d9afe

Browse files
committed
Better VC integration (Perforce etc)
1 parent 59c53ce commit 52d9afe

1 file changed

Lines changed: 54 additions & 48 deletions

File tree

PostProcessing/Editor/EffectListEditor.cs

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -131,64 +131,70 @@ public void OnGUI()
131131
RefreshEditors();
132132
m_Asset.isDirty = false;
133133
}
134-
135-
EditorGUILayout.LabelField(EditorUtilities.GetContent("Overrides"), EditorStyles.boldLabel);
136134

137-
// Override list
138-
for (int i = 0; i < m_Editors.Count; i++)
135+
bool isEditable = !VersionControl.Provider.isActive
136+
|| AssetDatabase.IsOpenForEdit(m_Asset, StatusQueryOptions.UseCachedIfPossible);
137+
138+
using (new EditorGUI.DisabledScope(!isEditable))
139139
{
140-
var editor = m_Editors[i];
141-
string title = editor.GetDisplayTitle();
142-
int id = i; // Needed for closure capture below
143-
144-
EditorUtilities.DrawSplitter();
145-
bool displayContent = EditorUtilities.DrawHeader(
146-
title,
147-
editor.baseProperty,
148-
editor.activeProperty,
149-
editor.target,
150-
() => ResetEffectOverride(editor.target.GetType(), id),
151-
() => RemoveEffectOverride(id)
152-
);
153-
154-
if (displayContent)
140+
EditorGUILayout.LabelField(EditorUtilities.GetContent("Overrides"), EditorStyles.boldLabel);
141+
142+
// Override list
143+
for (int i = 0; i < m_Editors.Count; i++)
155144
{
156-
using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue))
157-
editor.OnInternalInspectorGUI();
145+
var editor = m_Editors[i];
146+
string title = editor.GetDisplayTitle();
147+
int id = i; // Needed for closure capture below
148+
149+
EditorUtilities.DrawSplitter();
150+
bool displayContent = EditorUtilities.DrawHeader(
151+
title,
152+
editor.baseProperty,
153+
editor.activeProperty,
154+
editor.target,
155+
() => ResetEffectOverride(editor.target.GetType(), id),
156+
() => RemoveEffectOverride(id)
157+
);
158+
159+
if (displayContent)
160+
{
161+
using (new EditorGUI.DisabledScope(!editor.activeProperty.boolValue))
162+
editor.OnInternalInspectorGUI();
163+
}
158164
}
159-
}
160165

161-
if (m_Editors.Count > 0)
162-
{
163-
EditorUtilities.DrawSplitter();
164-
EditorGUILayout.Space();
165-
}
166-
else
167-
{
168-
EditorGUILayout.HelpBox("No override set on this volume.", MessageType.Info);
169-
}
170-
171-
if (GUILayout.Button("Add effect...", EditorStyles.miniButton))
172-
{
173-
var menu = new GenericMenu();
166+
if (m_Editors.Count > 0)
167+
{
168+
EditorUtilities.DrawSplitter();
169+
EditorGUILayout.Space();
170+
}
171+
else
172+
{
173+
EditorGUILayout.HelpBox("No override set on this volume.", MessageType.Info);
174+
}
174175

175-
var typeMap = PostProcessManager.instance.settingsTypes;
176-
foreach (var kvp in typeMap)
176+
if (GUILayout.Button("Add effect...", EditorStyles.miniButton))
177177
{
178-
var type = kvp.Key;
179-
var title = EditorUtilities.GetContent(kvp.Value.menuItem);
180-
bool exists = m_Asset.HasSettings(type);
181-
182-
if (!exists)
183-
menu.AddItem(title, false, () => AddEffectOverride(type));
184-
else
185-
menu.AddDisabledItem(title);
178+
var menu = new GenericMenu();
179+
180+
var typeMap = PostProcessManager.instance.settingsTypes;
181+
foreach (var kvp in typeMap)
182+
{
183+
var type = kvp.Key;
184+
var title = EditorUtilities.GetContent(kvp.Value.menuItem);
185+
bool exists = m_Asset.HasSettings(type);
186+
187+
if (!exists)
188+
menu.AddItem(title, false, () => AddEffectOverride(type));
189+
else
190+
menu.AddDisabledItem(title);
191+
}
192+
193+
menu.ShowAsContext();
186194
}
187195

188-
menu.ShowAsContext();
196+
EditorGUILayout.Space();
189197
}
190-
191-
EditorGUILayout.Space();
192198
}
193199

194200
void AddEffectOverride(Type type)

0 commit comments

Comments
 (0)