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

Commit a87de09

Browse files
committed
Added reset/copy/paste options for debug views
1 parent cc00034 commit a87de09

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

PostProcessing/Editor/PostProcessingModelEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ internal void OnGUI()
3636
GUILayout.Space(5);
3737

3838
var display = alwaysEnabled
39-
? EditorGUIHelper.Header(serializedProperty.displayName, m_SettingsProperty)
39+
? EditorGUIHelper.Header(serializedProperty.displayName, m_SettingsProperty, Reset)
4040
: EditorGUIHelper.Header(serializedProperty.displayName, m_SettingsProperty, m_EnabledProperty, Reset);
4141

4242
if (display)

PostProcessing/Editor/Utils/EditorGUIHelper.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static GUIContent GetContent(string textAndTooltip)
4141

4242
#endregion
4343

44-
public static bool Header(string title, SerializedProperty group)
44+
public static bool Header(string title, SerializedProperty group, Action resetAction)
4545
{
4646
var rect = GUILayoutUtility.GetRect(16f, 22f, FxStyles.header);
4747
GUI.Box(rect, title, FxStyles.header);
@@ -51,12 +51,29 @@ public static bool Header(string title, SerializedProperty group)
5151
var foldoutRect = new Rect(rect.x + 4f, rect.y + 2f, 13f, 13f);
5252
var e = Event.current;
5353

54+
var popupRect = new Rect(rect.x + rect.width - FxStyles.paneOptionsIcon.width - 5f, rect.y + FxStyles.paneOptionsIcon.height / 2f + 1f, FxStyles.paneOptionsIcon.width, FxStyles.paneOptionsIcon.height);
55+
GUI.DrawTexture(popupRect, FxStyles.paneOptionsIcon);
56+
5457
if (e.type == EventType.Repaint)
5558
FxStyles.headerFoldout.Draw(foldoutRect, false, false, display, false);
5659

5760
if (e.type == EventType.MouseDown)
5861
{
59-
if (rect.Contains(e.mousePosition))
62+
if (popupRect.Contains(e.mousePosition))
63+
{
64+
var popup = new GenericMenu();
65+
popup.AddItem(GetContent("Reset"), false, () => resetAction());
66+
popup.AddSeparator(string.Empty);
67+
popup.AddItem(GetContent("Copy Settings"), false, () => CopySettings(group));
68+
69+
if (CanPaste(group))
70+
popup.AddItem(GetContent("Paste Settings"), false, () => PasteSettings(group));
71+
else
72+
popup.AddDisabledItem(GetContent("Paste Settings"));
73+
74+
popup.ShowAsContext();
75+
}
76+
else if (rect.Contains(e.mousePosition) && group != null)
6077
{
6178
display = !display;
6279

0 commit comments

Comments
 (0)