mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 01:06:01 +08:00
Added automatic drawing of instance ports
Fixed minor issue getting parentType twice
This commit is contained in:
parent
43038cfcc1
commit
2939fe4935
@ -52,6 +52,7 @@ namespace XNodeEditor {
|
||||
string[] excludes = { "m_Script", "graph", "position", "ports" };
|
||||
portPositions = new Dictionary<XNode.NodePort, Vector2>();
|
||||
|
||||
// Iterate through serialized properties and draw them like the Inspector (But with ports)
|
||||
SerializedProperty iterator = serializedObject.GetIterator();
|
||||
bool enterChildren = true;
|
||||
EditorGUIUtility.labelWidth = 84;
|
||||
@ -60,6 +61,12 @@ namespace XNodeEditor {
|
||||
if (excludes.Contains(iterator.name)) continue;
|
||||
NodeEditorGUILayout.PropertyField(iterator, true);
|
||||
}
|
||||
|
||||
// Iterate through instance ports and draw them in the order in which they are serialized
|
||||
foreach(XNode.NodePort instancePort in target.InstancePorts) {
|
||||
NodeEditorGUILayout.PortField(instancePort);
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ namespace XNodeEditor {
|
||||
|
||||
private static System.Type GetType(SerializedProperty property) {
|
||||
System.Type parentType = property.serializedObject.targetObject.GetType();
|
||||
System.Reflection.FieldInfo fi = NodeEditorWindow.GetFieldInfo(property.serializedObject.targetObject.GetType(), property.name);
|
||||
System.Reflection.FieldInfo fi = NodeEditorWindow.GetFieldInfo(parentType, property.name);
|
||||
return fi.FieldType;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user