File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed
Assets/com.alelievr.NodeGraphProcessor/Editor/Utils Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -254,22 +254,28 @@ static MonoScript FindScriptFromClassName(string className)
254
254
255
255
public static Type GetNodeViewTypeFromType ( Type nodeType )
256
256
{
257
- Type view ;
257
+ Type view ;
258
258
259
- if ( nodeViewPerType . TryGetValue ( nodeType , out view ) )
260
- return view ;
259
+ if ( nodeViewPerType . TryGetValue ( nodeType , out view ) )
260
+ return view ;
261
261
262
- // Allow for inheritance in node views: multiple C# node using the same view
263
- foreach ( var type in nodeViewPerType )
264
- {
265
- if ( nodeType . IsSubclassOf ( type . Key ) )
266
- return type . Value ;
267
- }
262
+ Type baseType = null ;
268
263
269
- return view ;
270
- }
264
+ // Allow for inheritance in node views: multiple C# node using the same view
265
+ foreach ( var type in nodeViewPerType )
266
+ {
267
+ // Find a view (not first fitted view) of nodeType
268
+ if ( nodeType . IsSubclassOf ( type . Key ) && ( baseType == null || type . Value . IsSubclassOf ( baseType ) ) )
269
+ baseType = type . Value ;
270
+ }
271
+
272
+ if ( baseType != null )
273
+ return baseType ;
274
+
275
+ return view ;
276
+ }
271
277
272
- public static IEnumerable < ( string path , Type type ) > GetNodeMenuEntries ( BaseGraph graph = null )
278
+ public static IEnumerable < ( string path , Type type ) > GetNodeMenuEntries ( BaseGraph graph = null )
273
279
{
274
280
foreach ( var node in genericNodes . nodePerMenuTitle )
275
281
yield return ( node . Key , node . Value ) ;
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
10
10
- Renamable nodes
11
11
- Added an API in the toolbar view to add separators and custom UI fields.
12
12
13
+ ### Fixed
14
+ - Fixed GetNodeViewTypeFromType not supporting inheritance.
15
+
13
16
## [ 1.1.2]
14
17
15
18
### Fixed
You can’t perform that action at this time.
0 commit comments