Skip to content

Commit c3c5f00

Browse files
committed
filters and refresh button visual update
1 parent cbf9d81 commit c3c5f00

File tree

5 files changed

+291
-5
lines changed

5 files changed

+291
-5
lines changed
339 Bytes
Loading

Assets/Editor/Editor Windows/Icons/filter.png.meta

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
389 Bytes
Loading

Assets/Editor/Editor Windows/Icons/refresh.png.meta

Lines changed: 127 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Editor/Editor Windows/ScriptableObjectEditorWindow.cs

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public static string[] BasicFilters
4545
private Texture2D orientationIcon;
4646
private Texture2D deleteConfigIcon;
4747
private Texture2D addConfigIcon;
48+
private Texture2D refreshIcon;
49+
private Texture2D filtersIcon;
4850

4951
// window:
5052
[MenuItem("Window/Game Config Editor")]
@@ -82,13 +84,32 @@ private void OnGUI()
8284

8385
EditorGUILayout.Space();
8486

85-
if (GUILayout.Button("Refresh", GUILayout.Width(80)))
87+
88+
GUIContent refreshButton;
89+
if (refreshIcon != null)
90+
{
91+
refreshButton = new GUIContent(refreshIcon, "refresh");
92+
}
93+
else
94+
{
95+
refreshButton = new GUIContent("refresh", "refresh");
96+
}
97+
if (GUILayout.Button(refreshButton, GUILayout.Width(80)))
8698
{
8799
RefreshAll();
88100
}
89101

90102
// Display a popup window at the mouse position for type selection
91-
if (GUILayout.Button("Filter", GUILayout.Width(80)))
103+
GUIContent filtersButton;
104+
if (filtersIcon != null)
105+
{
106+
filtersButton = new GUIContent(filtersIcon, "filters");
107+
}
108+
else
109+
{
110+
filtersButton = new GUIContent("filters", "filters");
111+
}
112+
if (GUILayout.Button(filtersButton, GUILayout.Width(80)))
92113
{
93114
Vector2 mousePosition = Event.current.mousePosition;
94115
PopupWindow.Show(new Rect(mousePosition.x, mousePosition.y + 20, 0, 0), new ConfigTypeSelectionPopup(selectedTypes, GroupScriptableObjectsByType, availableTypes));
@@ -115,7 +136,7 @@ private void OnGUI()
115136
spaceButton = new GUIContent("space", "change space between parameters");
116137
}
117138

118-
if (GUILayout.Button(spaceButton, GUILayout.Width(40)))
139+
if (GUILayout.Button(spaceButton, GUILayout.Width(80)))
119140
{
120141
SetSpace();
121142
}
@@ -130,7 +151,7 @@ private void OnGUI()
130151
orientationButton = new GUIContent("rotate", "change the table orientation");
131152
}
132153

133-
if (GUILayout.Button(orientationButton, GUILayout.Width(40)))
154+
if (GUILayout.Button(orientationButton, GUILayout.Width(80)))
134155
{
135156
if (OrientationVertical)
136157
{
@@ -270,6 +291,8 @@ private void LoadIcons()
270291
orientationIcon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/Editor/Editor Windows/Icons/orientation.png");
271292
deleteConfigIcon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/Editor/Editor Windows/Icons/delete.png");
272293
addConfigIcon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/Editor/Editor Windows/Icons/add file.png");
294+
refreshIcon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/Editor/Editor Windows/Icons/refresh.png");
295+
filtersIcon = AssetDatabase.LoadAssetAtPath<Texture2D>("Assets/Editor/Editor Windows/Icons/filter.png");
273296

274297
if (spaceIcon == null)
275298
{
@@ -287,6 +310,14 @@ private void LoadIcons()
287310
{
288311
Debug.LogError("addConfig Icon not found in: Assets/Editor/Editor Windows/Icons/add file.png");
289312
}
313+
if (refreshIcon == null)
314+
{
315+
Debug.LogError("refresh Icon not found in: Assets/Editor/Editor Windows/Icons/refresh.png");
316+
}
317+
if (filtersIcon == null)
318+
{
319+
Debug.LogError("filters Icon not found in: Assets/Editor/Editor Windows/Icons/filter.png");
320+
}
290321
}
291322

292323
private void LoadAvailableTypes()
@@ -464,7 +495,8 @@ private void PutPropertiesForObject_H<T>(List<T> Configs) where T : ScriptableOb
464495
try
465496
{
466497
EditorGUILayout.BeginVertical();
467-
// property names horizontal line:
498+
499+
// property names on horizontal line:
468500
EditorGUILayout.BeginHorizontal();
469501
try
470502
{

0 commit comments

Comments
 (0)