Skip to content

Commit 667639b

Browse files
committed
Update Watchers to 1.2.0
1 parent aae60a7 commit 667639b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+6407
-66
lines changed

Diff for: Assets/Global.uss

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Slot {
2+
margin: 5px;
3+
background-color: rgb(9, 19, 21);
4+
border-top-left-radius: 3px;
5+
border-bottom-left-radius: 3px;
6+
border-top-right-radius: 3px;
7+
border-bottom-right-radius: 3px;
8+
}
9+
10+
Container {
11+
flex-shrink: 0;
12+
flex-grow: 1;
13+
flex-direction: row;
14+
flex-wrap: wrap;
15+
}
16+

Diff for: Assets/Global.uss.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Assets/Main.uxml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
2+
<Style src="project://database/Assets/Global.uss?fileID=7433441132597879392&amp;guid=88c17a75bbfa3e74d9d4b6c5a175dcf6&amp;type=3#Global" />
3+
<ui:VisualElement>
4+
<Container Size="36" Count="29" class="container" />
5+
</ui:VisualElement>
6+
</ui:UXML>

Diff for: Assets/Main.uxml.meta

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Assets/Panel Settings.asset

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0}
13+
m_Name: Panel Settings
14+
m_EditorClassIdentifier:
15+
themeUss: {fileID: -4733365628477956816, guid: 3897c7ab566dcdd48971772ad6e15b27, type: 3}
16+
m_TargetTexture: {fileID: 0}
17+
m_ScaleMode: 1
18+
m_Scale: 1
19+
m_ReferenceDpi: 96
20+
m_FallbackDpi: 96
21+
m_ReferenceResolution: {x: 1200, y: 800}
22+
m_ScreenMatchMode: 0
23+
m_Match: 0
24+
m_SortingOrder: 0
25+
m_TargetDisplay: 0
26+
m_ClearDepthStencil: 1
27+
m_ClearColor: 0
28+
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
29+
m_DynamicAtlasSettings:
30+
m_MinAtlasSize: 64
31+
m_MaxAtlasSize: 4096
32+
m_MaxSubTextureSize: 64
33+
m_ActiveFilters: 31
34+
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
35+
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
36+
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
37+
textSettings: {fileID: 0}

Diff for: Assets/Panel Settings.asset.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Assets/UI Toolkit.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Assets/UI Toolkit/UnityThemes.meta

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import url("unity-theme://default");

Diff for: Assets/UI Toolkit/UnityThemes/UnityDefaultRuntimeTheme.tss.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Assets/Watchers/Editor/Extensions/UIElementsExtensions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using System;
32
using UnityEngine.UIElements;
43
using UnityEditor;
@@ -54,4 +53,3 @@ public static TSource AddActionButton<TSource>(this TSource source, string name,
5453
}
5554
}
5655
}
57-
#endif

Diff for: Assets/Watchers/Editor/Extensions/UIElementsFunctionPropertyExtensions.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if UNITY_EDITOR
2-
using UniRx;
1+
using UniRx;
32
using System;
43
using UnityEngine;
54
using UnityEngine.UIElements;
@@ -109,4 +108,3 @@ public static TSource AddProperty<TSource, TTarget, TEnum>(
109108
}
110109
}
111110
}
112-
#endif

Diff for: Assets/Watchers/Editor/Extensions/UIElementsObservablePropertyExtensions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using UniRx;
32
using System;
43
using UnityEngine;
@@ -189,4 +188,3 @@ public static TSource AddProperty<TSource, TEnum>(
189188
}
190189
}
191190
}
192-
#endif

Diff for: Assets/Watchers/Editor/Extensions/UIElementsPropertyBindingExtensions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using UniRx;
32
using System;
43
using UnityEngine;
@@ -17,4 +16,3 @@ public static class UIElementsPropertyBindingExtensions
1716
public static IDisposable BindTo<TEnum>(this EnumField field, IObservable<TEnum> observable) where TEnum: Enum => observable.SubscribeWithState(field, (x, state) => state.value = x);
1817
}
1918
}
20-
#endif

Diff for: Assets/Watchers/Editor/Extensions/Utilities.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using UnityEngine;
32

43
namespace Gbros.Watchers
@@ -8,4 +7,3 @@ public static class Utilities
87
public static Color Color(string hex) => ColorUtility.TryParseHtmlString(hex, out var color) ? color : UnityEngine.Color.white;
98
}
109
}
11-
#endif

Diff for: Assets/Watchers/Editor/Extensions/WatcherExtensions.cs

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using UniRx;
32
using System;
43

@@ -10,5 +9,3 @@ public static class WatcherExtensions
109
public static void AddTo(this IDisposable disposable, IWatcherElement watcherElement) => disposable.AddTo(watcherElement.Watcher);
1110
}
1211
}
13-
14-
#endif

Diff for: Assets/Watchers/Editor/Extensions/WatcherUIElementsFunctionPropertyExtensions.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if UNITY_EDITOR
2-
using UniRx;
1+
using UniRx;
32
using System;
43
using UnityEngine;
54
using UnityEngine.UIElements;
@@ -102,4 +101,3 @@ public static TSource AddProperty<TSource, TTarget, TEnum>(
102101
}
103102
}
104103
}
105-
#endif

Diff for: Assets/Watchers/Editor/Extensions/WatcherUIElementsObservablePropertyExtensions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if UNITY_EDITOR
21
using System;
32
using UnityEngine;
43
using UnityEngine.UIElements;
@@ -182,4 +181,3 @@ public static TSource AddProperty<TSource,TEnum>(
182181

183182
}
184183
}
185-
#endif

Diff for: Assets/Watchers/Editor/Extensions/WatcherUIElementsSerializedPropertyExtensions.cs

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if UNITY_EDITOR
2-
using System;
1+
using System;
32
using UnityEngine.UIElements;
43
using UnityEditor.UIElements;
54
using System.Linq.Expressions;
@@ -12,7 +11,8 @@ public static class WatcherUIElementsSerializedPropertyExtensions
1211
public static TSource AddSerializedProperty<TSource, TTarget, TProperty>(this TSource source,
1312
TTarget target,
1413
Expression<Func<TTarget, TProperty>> propertySelector,
15-
string name = null)
14+
string name = null,
15+
Action<PropertyField> callback = null)
1616
where TSource : VisualElement, IWatcherElement
1717
where TTarget : UnityEngine.Object
1818
{
@@ -23,14 +23,22 @@ public static TSource AddSerializedProperty<TSource, TTarget, TProperty>(this TS
2323
}
2424

2525
var propertyName = propertySelector.GetName();
26-
source.Add(name ?? propertyName, new PropertyField(serializedObject.FindProperty(propertyName), name ?? propertyName), field => field.Bind(serializedObject));
26+
27+
source.Add(name ?? propertyName,
28+
new PropertyField(serializedObject.FindProperty(propertyName), name ?? propertyName),
29+
field =>
30+
{
31+
field.Bind(serializedObject);
32+
callback?.Invoke(field);
33+
});
2734
return source;
2835
}
2936

3037
public static TSource AddSerializedProperty<TSource, TTarget>(this TSource source,
3138
TTarget target,
3239
string propertyName,
33-
string name = null)
40+
string name = null,
41+
Action<PropertyField> callback = null)
3442
where TSource : VisualElement, IWatcherElement
3543
where TTarget : UnityEngine.Object
3644
{
@@ -40,9 +48,14 @@ public static TSource AddSerializedProperty<TSource, TTarget>(this TSource sourc
4048
source.Watcher.SerializedObjects.Add(target, serializedObject);
4149
}
4250

43-
source.Add(name ?? propertyName, new PropertyField(serializedObject.FindProperty(propertyName), name ?? propertyName), field => field.Bind(serializedObject));
51+
source.Add(name ?? propertyName,
52+
new PropertyField(serializedObject.FindProperty(propertyName), name ?? propertyName),
53+
field =>
54+
{
55+
field.Bind(serializedObject);
56+
callback?.Invoke(field);
57+
});
4458
return source;
4559
}
4660
}
4761
}
48-
#endif

Diff for: Assets/Watchers/Editor/Watcher.cs

+3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ public class Watcher : IDisposable
1111
{
1212
public bool IsDisposed { get; private set; }
1313
public CompositeDisposable Disposables { get; } = new CompositeDisposable();
14+
15+
public WatcherSelector Selector { get; }
1416

1517
internal Watcher(string key = Watchers.Default, string groupKey = null)
1618
{
1719
Key = key;
1820
GroupKey = groupKey;
21+
Selector = new WatcherSelector(this);
1922
}
2023

2124
public List<WatcherBoard> Boards { get; private set; } = new List<WatcherBoard>();

Diff for: Assets/Watchers/Editor/WatcherEditor.cs

+9-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class WatcherEditor : EditorWindow
2222
public Watcher CurrentWatcher { get; private set; }
2323
public WatcherBoard CurrentBoard { get; private set; }
2424
public VisualElement BoardContainer { get; private set; }
25-
25+
2626
public VisualElement LeftPanel { get; private set; }
2727
public VisualElement RightPanel { get; private set; }
2828

@@ -89,7 +89,7 @@ private void Initialize()
8989
Watchers.Created += OnWatcherCreated;
9090
Watchers.Cleared += OnWatchersCleared;
9191

92-
92+
9393
foreach (var watcher in Watchers.All)
9494
{
9595
OnWatcherCreated(watcher);
@@ -153,7 +153,7 @@ public void ChangeCurrentBoard(WatcherBoard board)
153153
{
154154
ChangeCurrentWatcher(board?.Watcher);
155155
}
156-
156+
157157
if (CurrentBoard is not null && Topbar.TryQ<Button>(out var button, CurrentBoard.viewDataKey))
158158
{
159159
button.RemoveFromClassList(WatcherTopbarButtonActiveClassName);
@@ -201,22 +201,20 @@ private void Cleanup()
201201
BoardContainer?.Clear();
202202
Topbar?.Clear();
203203
Sidebar?.Clear();
204-
LeftPanel?.Clear();
205204
}
206205

207206
private void OnWatcherCreated(Watcher watcher)
208207
{
209208
Watchers.Logger?.Invoke($"Watchers: Editor - adding {watcher.Key} to left panel");
210-
211-
var watcherSelector = new WatcherSelector(watcher);
212-
watcherSelector.clicked += () => ChangeCurrentWatcher(watcher);
209+
210+
watcher.Selector.clicked += () => ChangeCurrentWatcher(watcher);
213211

214212
if (watcher.GroupKey is not null)
215213
{
216214
var keys = watcher.GroupKey.Split('\\');
217215

218216
VisualElement currentElement = Sidebar;
219-
217+
220218
for (var i = 0; i < keys.Length; i++)
221219
{
222220
var key = keys[i];
@@ -233,14 +231,14 @@ private void OnWatcherCreated(Watcher watcher)
233231
}
234232

235233
currentElement = foldout;
236-
234+
237235
}
238236

239-
currentElement.Add(watcherSelector);
237+
currentElement.Add(watcher.Selector);
240238
}
241239
else
242240
{
243-
Sidebar.Add(watcherSelector);
241+
Sidebar.Add(watcher.Selector);
244242
}
245243
}
246244

Diff for: Assets/Watchers/Editor/WatcherEditor.uxml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Style src="project://database/Assets/Watchers/Editor/WatcherEditor.uss?fileID=7433441132597879392&amp;guid=02cce2d1fce6d064a91c16e5e97c8ab3&amp;type=3#WatcherEditor" />
33
<WatcherSplitView fixed-pane-initial-dimension="150">
44
<ui:VisualElement name="left-panel" style="flex-grow: 1; width: auto;">
5-
<ui:ListView focusable="true" />
5+
<ui:ScrollView style="flex-grow: 1;" />
66
</ui:VisualElement>
77
<ui:VisualElement name="right-panel">
88
<ui:ScrollView mode="Horizontal" vertical-scroller-visibility="Hidden" style="height: auto;" />

Diff for: Assets/Watchers/Editor/Watchers.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public static class Watchers
1717
public static event Action<Watcher> Deleted;
1818
public static event Action Cleared;
1919
public const string Default = nameof(Watcher);
20-
public const string DefaultEditorPath = "Packages/com.gbros.tools.watchers/Editor/";
20+
//public const string DefaultEditorPath = "Packages/com.gbros.tools.watchers/Editor/";
21+
public const string DefaultEditorPath = "Assets/Watchers/Editor/";
2122
public static string DefaultEditorStylePath = $"{DefaultEditorPath}WatcherEditor.uss";
2223
public static string DefaultEditorUXMLPath = $"{DefaultEditorPath}WatcherEditor.uxml";
2324
public static string EditorStylePath = $"{DefaultEditorPath}WatcherEditor.uss";

Diff for: Assets/Watchers/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Gbros - Watchers",
44
"description": "Watchers is a collection of handy windows and extensions that will speed up your workflow and make your life easier. See more on our blog post - https://www.gbrosgames.com/blog",
55
"license": "MIT",
6-
"version": "1.1.0",
6+
"version": "1.2.0",
77
"keywords": [
88
"UniRx",
99
"Gbros"

0 commit comments

Comments
 (0)