Skip to content

Commit f0272ce

Browse files
committed
Do not filter out fake inspector entries
1 parent 90eafaa commit f0272ce

17 files changed

+203
-196
lines changed

RuntimeUnityEditor.Core/RuntimeUnityEditor.Core.projitems

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,27 @@
7272
<Compile Include="$(MSBuildThisFileDirectory)Windows\ChangeHistory\IChange.cs" />
7373
<Compile Include="$(MSBuildThisFileDirectory)Windows\Clipboard\ClipboardWindow.cs" />
7474
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\CacheEntryBase.cs" />
75-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\CallbackCacheEntey.cs" />
76-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\EventCacheEntry.cs" />
77-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\FieldCacheEntry.cs" />
75+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Fake\CallbackCacheEntey.cs" />
76+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\IL2CPP\IL2CPPEventCacheEntry.cs" />
77+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\IL2CPP\IL2CPPFieldCacheEntry.cs" />
78+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\IL2CPP\IL2CPPMethodCacheEntry.cs" />
79+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\IL2CPP\IL2CPPPropertyCacheEntry.cs" />
80+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Real\EventCacheEntry.cs" />
81+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Real\FieldCacheEntry.cs" />
7882
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\ICacheEntry.cs" />
79-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\ListCacheEntry.cs" />
80-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\MethodCacheEntry.cs" />
81-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\PropertyCacheEntry.cs" />
82-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\ReadonlyCacheEntry.cs" />
83-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\ReadonlyListCacheEntry.cs" />
83+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Fake\ListCacheEntry.cs" />
84+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Real\MethodCacheEntry.cs" />
85+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Real\PropertyCacheEntry.cs" />
86+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Fake\ReadonlyCacheEntry.cs" />
87+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Fake\ReadonlyListCacheEntry.cs" />
8488
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Inspector\InspectorStackEntryBase.cs" />
8589
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Inspector\InstanceStackEntry.cs" />
8690
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Inspector\StaticStackEntry.cs" />
8791
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Inspector.cs" />
8892
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Inspector.InspectorTab.cs" />
8993
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\InspectorHelpObject.cs" />
9094
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\MemberCollector.cs" />
91-
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\IL2CPP\MemberCollector.IL2CPP.cs" />
95+
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\IL2CPP\IL2CPPCacheEntryHelper.cs" />
9296
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\ToStringConverter.cs" />
9397
<Compile Include="$(MSBuildThisFileDirectory)Windows\Inspector\VariableFieldDrawer.cs" />
9498
<Compile Include="$(MSBuildThisFileDirectory)Windows\ObjectTree\ObjectTreeViewer.cs" />
@@ -109,6 +113,10 @@
109113
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Utils\UI\guisharp-window.png" />
110114
</ItemGroup>
111115
<ItemGroup>
112-
<Folder Include="$(MSBuildThisFileDirectory)Windows\Inspector\IL2CPP\" />
116+
<Folder Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Fake\" />
117+
<Folder Include="$(MSBuildThisFileDirectory)Windows\Inspector\Entries\Contents\Real\" />
118+
</ItemGroup>
119+
<ItemGroup>
120+
<Compile Include="$(MSBuildThisFileDirectory)windows\inspector\entries\contents\fake\IFakeCacheEntry.cs" />
113121
</ItemGroup>
114122
</Project>

RuntimeUnityEditor.Core/Windows/Inspector/Entries/Contents/CallbackCacheEntey.cs

Lines changed: 0 additions & 112 deletions
This file was deleted.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System;
2+
using System.Reflection;
3+
4+
namespace RuntimeUnityEditor.Core.Inspector.Entries
5+
{
6+
/// <inheritdoc cref="CacheEntryBase" />
7+
public class CallbackCacheEntry : CacheEntryBase, IFakeCacheEntry
8+
{
9+
private readonly string _message;
10+
private readonly Action _callback;
11+
12+
/// <inheritdoc />
13+
internal CallbackCacheEntry(string name, string message) : base(name, "RUE Callback / Feature")
14+
{
15+
_message = message;
16+
}
17+
18+
/// <inheritdoc />
19+
public CallbackCacheEntry(string name, string message, Action callback) : base(name, "RUE Callback / Feature")
20+
{
21+
_message = message;
22+
_callback = callback ?? throw new ArgumentNullException(nameof(callback));
23+
}
24+
25+
/// <inheritdoc />
26+
public override object GetValueToCache() => _message;
27+
28+
/// <inheritdoc />
29+
public override bool CanEnterValue() => true;
30+
31+
/// <inheritdoc />
32+
public override object EnterValue()
33+
{
34+
_callback();
35+
return null;
36+
}
37+
38+
/// <inheritdoc />
39+
protected override bool OnSetValue(object newValue) => false;
40+
41+
/// <inheritdoc />
42+
public override Type Type() => typeof(void);
43+
44+
/// <inheritdoc />
45+
public override MemberInfo MemberInfo => null;
46+
47+
/// <inheritdoc />
48+
public override bool CanSetValue() => false;
49+
50+
/// <inheritdoc />
51+
public override string ToString() => $"{_message} (RUE Callback / Feature)";
52+
}
53+
54+
/// <inheritdoc />
55+
public class CallbackCacheEntry<T> : CallbackCacheEntry
56+
{
57+
private readonly Func<T> _callback;
58+
59+
/// <inheritdoc />
60+
public CallbackCacheEntry(string name, string message, Func<T> callback) : base(name, message)
61+
{
62+
_callback = callback ?? throw new ArgumentNullException(nameof(callback));
63+
}
64+
65+
/// <inheritdoc />
66+
public override object EnterValue() => _callback();
67+
68+
/// <inheritdoc />
69+
public override Type Type() => typeof(T);
70+
}
71+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace RuntimeUnityEditor.Core.Inspector.Entries
2+
{
3+
/// <summary>
4+
/// Used to mark entries that are "fake" and do not correspond to actual members of an object.
5+
/// </summary>
6+
internal interface IFakeCacheEntry
7+
{
8+
}
9+
}

RuntimeUnityEditor.Core/Windows/Inspector/Entries/Contents/ListCacheEntry.cs renamed to RuntimeUnityEditor.Core/Windows/Inspector/Entries/Contents/Fake/ListCacheEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace RuntimeUnityEditor.Core.Inspector.Entries
99
/// <summary>
1010
/// Represents a cache entry for an item inside any IList.
1111
/// </summary>
12-
public class ListCacheEntry : CacheEntryBase
12+
public class ListCacheEntry : CacheEntryBase, IFakeCacheEntry
1313
{
1414
private Type _type;
1515
private readonly IList _list;

RuntimeUnityEditor.Core/Windows/Inspector/Entries/Contents/ReadonlyCacheEntry.cs renamed to RuntimeUnityEditor.Core/Windows/Inspector/Entries/Contents/Fake/ReadonlyCacheEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace RuntimeUnityEditor.Core.Inspector.Entries
66
/// <summary>
77
/// Represents a read-only cache entry in the inspector.
88
/// </summary>
9-
public class ReadonlyCacheEntry : CacheEntryBase
9+
public class ReadonlyCacheEntry : CacheEntryBase, IFakeCacheEntry
1010
{
1111
/// <summary>
1212
/// The object that this entry represents.

RuntimeUnityEditor.Core/Windows/Inspector/IL2CPP/MemberCollector.IL2CPP.cs renamed to RuntimeUnityEditor.Core/Windows/Inspector/Entries/Contents/IL2CPP/IL2CPPCacheEntryHelper.cs

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -105,76 +105,4 @@ internal static bool IsIl2CppCacheEntry(ICacheEntry entry)
105105
}
106106
}
107107

108-
/// <inheritdoc />
109-
public class IL2CPPFieldCacheEntry : PropertyCacheEntry
110-
{
111-
public FieldInfo PtrField { get; }
112-
113-
/// <inheritdoc />
114-
public IL2CPPFieldCacheEntry(object ins, PropertyInfo p, Type owner, FieldInfo ptrField) : base(ins, p, owner)
115-
{
116-
PtrField = ptrField;
117-
_nameContent.tooltip = $"IL2CPP Field (ptr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrField)})\n\n{_nameContent.tooltip}";
118-
}
119-
120-
/// <inheritdoc />
121-
public IL2CPPFieldCacheEntry(object ins, PropertyInfo p, Type owner, FieldInfo ptrField, ICacheEntry parent) : base(ins, p, owner, parent)
122-
{
123-
PtrField = ptrField;
124-
_nameContent.tooltip = $"IL2CPP Field (ptr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrField)})\n\n{_nameContent.tooltip}";
125-
}
126-
}
127-
128-
/// <inheritdoc />
129-
public class IL2CPPPropertyCacheEntry : PropertyCacheEntry
130-
{
131-
public FieldInfo PtrFieldGet { get; }
132-
public FieldInfo PtrFieldSet { get; }
133-
134-
/// <inheritdoc />
135-
public IL2CPPPropertyCacheEntry(object ins, PropertyInfo p, Type owner, FieldInfo ptrFieldGet, FieldInfo ptrFieldSet) : base(ins, p, owner)
136-
{
137-
PtrFieldGet = ptrFieldGet;
138-
PtrFieldSet = ptrFieldSet;
139-
_nameContent.tooltip = $"IL2CPP Property (getPtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldGet)}, setPtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldSet)})\n\n{_nameContent.tooltip}";
140-
}
141-
/// <inheritdoc />
142-
public IL2CPPPropertyCacheEntry(object ins, PropertyInfo p, Type owner, FieldInfo ptrFieldGet, FieldInfo ptrFieldSet, ICacheEntry parent) : base(ins, p, owner, parent)
143-
{
144-
PtrFieldGet = ptrFieldGet;
145-
PtrFieldSet = ptrFieldSet;
146-
_nameContent.tooltip = $"IL2CPP Property (getPtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldGet)}, setPtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldSet)})\n\n{_nameContent.tooltip}";
147-
}
148-
}
149-
150-
/// <inheritdoc />
151-
public class IL2CPPMethodCacheEntry : MethodCacheEntry
152-
{
153-
public FieldInfo PtrField { get; }
154-
155-
/// <inheritdoc />
156-
public IL2CPPMethodCacheEntry(object instance, MethodInfo methodInfo, Type owner, FieldInfo ptrField) : base(instance, methodInfo, owner)
157-
{
158-
PtrField = ptrField;
159-
_nameContent.tooltip = $"IL2CPP Method (ptr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrField)})\n\n{_nameContent.tooltip}";
160-
}
161-
}
162-
163-
/// <inheritdoc />
164-
/// TODO: This does nothing so far because events are not implemented in il2cpp interop (they show up as separate add/remove/raise methods). Maybe combine them back into events?
165-
public class IL2CPPEventCacheEntry : EventCacheEntry
166-
{
167-
public FieldInfo PtrFieldAdd { get; }
168-
public FieldInfo PtrFieldRaise { get; }
169-
public FieldInfo PtrFieldRemove { get; }
170-
/// <inheritdoc />
171-
public IL2CPPEventCacheEntry(object ins, EventInfo e, Type owner, FieldInfo ptrFieldAdd, FieldInfo ptrFieldRaise, FieldInfo ptrFieldRemove) : base(ins, e, owner)
172-
{
173-
PtrFieldAdd = ptrFieldAdd;
174-
PtrFieldRaise = ptrFieldRaise;
175-
PtrFieldRemove = ptrFieldRemove;
176-
_nameContent.tooltip = $"IL2CPP Event (addPtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldAdd)}, raisePtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldRaise)}, removePtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldRemove)})\n\n{_nameContent.tooltip}";
177-
}
178-
}
179-
180108
#endif
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#if IL2CPP
2+
using System;
3+
using System.Reflection;
4+
using RuntimeUnityEditor.Core.Inspector.Entries;
5+
6+
namespace RuntimeUnityEditor.Core.Inspector.IL2CPP;
7+
8+
/// <inheritdoc />
9+
/// TODO: This does nothing so far because events are not implemented in il2cpp interop (they show up as separate add/remove/raise methods). Maybe combine them back into events?
10+
public class IL2CPPEventCacheEntry : EventCacheEntry
11+
{
12+
public FieldInfo PtrFieldAdd { get; }
13+
public FieldInfo PtrFieldRaise { get; }
14+
public FieldInfo PtrFieldRemove { get; }
15+
/// <inheritdoc />
16+
public IL2CPPEventCacheEntry(object ins, EventInfo e, Type owner, FieldInfo ptrFieldAdd, FieldInfo ptrFieldRaise, FieldInfo ptrFieldRemove) : base(ins, e, owner)
17+
{
18+
PtrFieldAdd = ptrFieldAdd;
19+
PtrFieldRaise = ptrFieldRaise;
20+
PtrFieldRemove = ptrFieldRemove;
21+
_nameContent.tooltip = $"IL2CPP Event (addPtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldAdd)}, raisePtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldRaise)}, removePtr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrFieldRemove)})\n\n{_nameContent.tooltip}";
22+
}
23+
}
24+
#endif
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#if IL2CPP
2+
using System;
3+
using System.Reflection;
4+
using RuntimeUnityEditor.Core.Inspector.Entries;
5+
6+
namespace RuntimeUnityEditor.Core.Inspector.IL2CPP;
7+
8+
/// <inheritdoc />
9+
public class IL2CPPFieldCacheEntry : PropertyCacheEntry
10+
{
11+
public FieldInfo PtrField { get; }
12+
13+
/// <inheritdoc />
14+
public IL2CPPFieldCacheEntry(object ins, PropertyInfo p, Type owner, FieldInfo ptrField) : base(ins, p, owner)
15+
{
16+
PtrField = ptrField;
17+
_nameContent.tooltip = $"IL2CPP Field (ptr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrField)})\n\n{_nameContent.tooltip}";
18+
}
19+
20+
/// <inheritdoc />
21+
public IL2CPPFieldCacheEntry(object ins, PropertyInfo p, Type owner, FieldInfo ptrField, ICacheEntry parent) : base(ins, p, owner, parent)
22+
{
23+
PtrField = ptrField;
24+
_nameContent.tooltip = $"IL2CPP Field (ptr={IL2CPPCacheEntryHelper.SafeGetPtr(owner, ptrField)})\n\n{_nameContent.tooltip}";
25+
}
26+
}
27+
#endif

0 commit comments

Comments
 (0)