Skip to content

Commit 30cf584

Browse files
committed
Merge branch 'master' of github.com:alelievr/NodeGraphProcessor
2 parents 91ddb20 + d99d092 commit 30cf584

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

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

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

564570
foreach (var field in fields)
565571
{
@@ -725,6 +731,11 @@ protected VisualElement AddControlField(FieldInfo field, string label = null, bo
725731
controlsContainer.Add(element);
726732
}
727733
}
734+
else
735+
{
736+
// Make sure we create an empty placeholder if FieldFactory can not provide a drawer
737+
if (showInputDrawer) AddEmptyField(field, false);
738+
}
728739

729740
var visibleCondition = field.GetCustomAttribute(typeof(VisibleIf)) as VisibleIf;
730741
if (visibleCondition != null)

0 commit comments

Comments
 (0)