mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Bugfix: Calling base.OnBodyGUI after drawing ports would make noodles disappear
This commit is contained in:
parent
d7f5bd2a1a
commit
91151b327a
@ -12,7 +12,7 @@ namespace XNodeEditor {
|
||||
|
||||
/// <summary> Fires every whenever a node was modified through the editor </summary>
|
||||
public static Action<XNode.Node> onUpdateNode;
|
||||
public static Dictionary<XNode.NodePort, Vector2> portPositions;
|
||||
public readonly static Dictionary<XNode.NodePort, Vector2> portPositions = new Dictionary<XNode.NodePort, Vector2>();
|
||||
|
||||
public virtual void OnHeaderGUI() {
|
||||
GUILayout.Label(target.name, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
|
||||
@ -25,7 +25,6 @@ namespace XNodeEditor {
|
||||
// serializedObject.ApplyModifiedProperties(); goes at the end.
|
||||
serializedObject.Update();
|
||||
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();
|
||||
|
||||
@ -301,7 +301,7 @@ namespace XNodeEditor {
|
||||
|
||||
NodeEditor nodeEditor = NodeEditor.GetEditor(node, this);
|
||||
|
||||
NodeEditor.portPositions = new Dictionary<XNode.NodePort, Vector2>();
|
||||
NodeEditor.portPositions.Clear();
|
||||
|
||||
//Get node position
|
||||
Vector2 nodePos = GridToWindowPositionNoClipped(node.position);
|
||||
@ -351,8 +351,7 @@ namespace XNodeEditor {
|
||||
Vector2 portHandlePos = kvp.Value;
|
||||
portHandlePos += node.position;
|
||||
Rect rect = new Rect(portHandlePos.x - 8, portHandlePos.y - 8, 16, 16);
|
||||
if (portConnectionPoints.ContainsKey(kvp.Key)) portConnectionPoints[kvp.Key] = rect;
|
||||
else portConnectionPoints.Add(kvp.Key, rect);
|
||||
portConnectionPoints[kvp.Key] = rect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -147,8 +147,7 @@ namespace XNodeEditor {
|
||||
|
||||
// Register the handle position
|
||||
Vector2 portPos = rect.center;
|
||||
if (NodeEditor.portPositions.ContainsKey(port)) NodeEditor.portPositions[port] = portPos;
|
||||
else NodeEditor.portPositions.Add(port, portPos);
|
||||
NodeEditor.portPositions[port] = portPos;
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,8 +203,7 @@ namespace XNodeEditor {
|
||||
|
||||
// Register the handle position
|
||||
Vector2 portPos = rect.center;
|
||||
if (NodeEditor.portPositions.ContainsKey(port)) NodeEditor.portPositions[port] = portPos;
|
||||
else NodeEditor.portPositions.Add(port, portPos);
|
||||
NodeEditor.portPositions[port] = portPos;
|
||||
}
|
||||
|
||||
/// <summary> Add a port field to previous layout element. </summary>
|
||||
@ -233,8 +231,7 @@ namespace XNodeEditor {
|
||||
|
||||
// Register the handle position
|
||||
Vector2 portPos = rect.center;
|
||||
if (NodeEditor.portPositions.ContainsKey(port)) NodeEditor.portPositions[port] = portPos;
|
||||
else NodeEditor.portPositions.Add(port, portPos);
|
||||
NodeEditor.portPositions[port] = portPos;
|
||||
}
|
||||
|
||||
/// <summary> Draws an input and an output port on the same line </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user