Skip to content

Commit 2c982b4

Browse files
authored
Labels! (#4)
* Label progress * More progress on label integration * Progress * Initial asset labels * Minimal asset labels * Progress * Style cleanup * Finalize labels * Progress * More label progress * Add advanced boolean configuration * Fix most label bugs * Enhancements * Initial processor toggle logic * Lots of progress * Mostly finished * Cool stuff * Cleanup * PR feedback * PR feedback 2 * PR feedback 3 * PR feedback 4
1 parent 43b14d3 commit 2c982b4

17 files changed

+3267
-492
lines changed

Editor/DataVisualizer/Data/DataVisualizerSettings.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed class DataVisualizerSettings : ScriptableObject
2929
[Tooltip(
3030
"If true, window state (selection, order, collapse) is saved in a special ScriptableObject. If false, state is saved within this settings asset file."
3131
)]
32-
public bool persistStateInSettingsAsset = true;
32+
public bool persistStateInSettingsAsset;
3333

3434
[Tooltip("If true, when selecting an Object, it will be selected in the Inspector.")]
3535
public bool selectActiveObject;
@@ -68,6 +68,14 @@ public sealed class DataVisualizerSettings : ScriptableObject
6868
[ReadOnly]
6969
internal List<string> managedTypeNames = new();
7070

71+
[SerializeField]
72+
[ReadOnly]
73+
internal List<TypeLabelFilterConfig> labelFilterConfigs = new();
74+
75+
[SerializeField]
76+
[ReadOnly]
77+
internal List<ProcessorState> processorStates = new();
78+
7179
private void OnValidate()
7280
{
7381
if (Application.isEditor && !Application.isPlaying)
@@ -112,6 +120,12 @@ public void HydrateFrom(DataVisualizerUserState userState)
112120
userState.objectOrders?.Select(order => order.Clone()).ToList()
113121
?? new List<TypeObjectOrder>();
114122
managedTypeNames = userState.managedTypeNames?.ToList() ?? new List<string>();
123+
labelFilterConfigs =
124+
userState.labelFilterConfigs?.Select(config => config.Clone()).ToList()
125+
?? new List<TypeLabelFilterConfig>();
126+
processorStates =
127+
userState.processorStates?.Select(state => state.Clone()).ToList()
128+
?? new List<ProcessorState>();
115129
MarkDirty();
116130
}
117131

Editor/DataVisualizer/Data/DataVisualizerUserState.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public sealed class DataVisualizerUserState
1818

1919
public List<TypeObjectOrder> objectOrders = new();
2020
public List<string> managedTypeNames = new();
21+
public List<TypeLabelFilterConfig> labelFilterConfigs = new();
22+
public List<ProcessorState> processorStates = new();
2123

2224
public void HydrateFrom(DataVisualizerSettings settings)
2325
{
@@ -42,6 +44,12 @@ public void HydrateFrom(DataVisualizerSettings settings)
4244
settings.objectOrders?.Select(order => order.Clone()).ToList()
4345
?? new List<TypeObjectOrder>();
4446
managedTypeNames = settings.managedTypeNames?.ToList() ?? new List<string>();
47+
labelFilterConfigs =
48+
settings.labelFilterConfigs?.Select(config => config.Clone()).ToList()
49+
?? new List<TypeLabelFilterConfig>();
50+
processorStates =
51+
settings.processorStates?.Select(state => state.Clone()).ToList()
52+
?? new List<ProcessorState>();
4553
}
4654

4755
public List<string> GetOrCreateObjectOrderList(string typeFullName)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
namespace WallstopStudios.DataVisualizer.Editor.Data
2+
{
3+
using System;
4+
5+
public enum ProcessorLogic
6+
{
7+
[Obsolete("Please use a valid value")]
8+
None = 0,
9+
All = 1,
10+
Filtered = 2,
11+
}
12+
13+
[Serializable]
14+
public sealed class ProcessorState
15+
{
16+
public string typeFullName = string.Empty;
17+
public bool isCollapsed = true;
18+
public ProcessorLogic logic = ProcessorLogic.Filtered;
19+
20+
public ProcessorState Clone()
21+
{
22+
return new ProcessorState
23+
{
24+
typeFullName = typeFullName ?? string.Empty,
25+
isCollapsed = isCollapsed,
26+
#pragma warning disable CS0618 // Type or member is obsolete
27+
logic = logic == ProcessorLogic.None ? ProcessorLogic.Filtered : logic,
28+
#pragma warning restore CS0618 // Type or member is obsolete
29+
};
30+
}
31+
}
32+
}

Editor/DataVisualizer/Data/ProcessorState.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
namespace WallstopStudios.DataVisualizer.Editor.Data
2+
{
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using UnityEngine.Serialization;
7+
8+
public enum LabelCombinationType
9+
{
10+
[Obsolete("Please use a valid value")]
11+
None = 0,
12+
And = 1,
13+
Or = 2,
14+
}
15+
16+
[Serializable]
17+
public sealed class TypeLabelFilterConfig
18+
{
19+
[FormerlySerializedAs("TypeFullName")]
20+
public string typeFullName = string.Empty;
21+
22+
[FormerlySerializedAs("AndLabels")]
23+
public List<string> andLabels = new();
24+
25+
[FormerlySerializedAs("OrLabels")]
26+
public List<string> orLabels = new();
27+
28+
[FormerlySerializedAs("CombinationType")]
29+
public LabelCombinationType combinationType = LabelCombinationType.And;
30+
31+
public bool isCollapsed;
32+
33+
public bool isAdvancedCollapsed = true;
34+
35+
public TypeLabelFilterConfig Clone()
36+
{
37+
return new TypeLabelFilterConfig
38+
{
39+
isCollapsed = isCollapsed,
40+
isAdvancedCollapsed = isAdvancedCollapsed,
41+
#pragma warning disable CS0618 // Type or member is obsolete
42+
combinationType =
43+
combinationType == LabelCombinationType.None
44+
? LabelCombinationType.And
45+
: combinationType,
46+
#pragma warning restore CS0618 // Type or member is obsolete
47+
typeFullName = typeFullName ?? string.Empty,
48+
andLabels = andLabels?.ToList() ?? new List<string>(),
49+
orLabels = orLabels?.ToList() ?? new List<string>(),
50+
};
51+
}
52+
}
53+
}

Editor/DataVisualizer/Data/TypeLabelFilterConfig.cs.meta

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

0 commit comments

Comments
 (0)