Skip to content

Commit 8485100

Browse files
Fix missing and inconsistent field drawers on inherited node fields
1 parent d765749 commit 8485100

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,13 @@ protected void AddInputContainer()
556556

557557
protected virtual void DrawDefaultInspector(bool fromInspector = false)
558558
{
559-
var fields = nodeTarget.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
559+
var fields = nodeTarget.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
560+
// Filter fields from the BaseNode type since we are only interested in user-defined fields
561+
// (better than BindingFlags.DeclaredOnly because we keep any inherited user-defined fields)
562+
.Where(f => f.DeclaringType != typeof(BaseNode))
563+
// Order by MetadataToken to sync the order with the port order (make sure FieldDrawers are next to the correct port)
564+
//TODO: Also consider custom port order
565+
.OrderBy(f => f.MetadataToken);
560566

561567
foreach (var field in fields)
562568
{

0 commit comments

Comments
 (0)