GraphEdit is an area capable of showing various GraphNodes. It manages connection events between them.
    public class GraphEdit : Control

GraphEdit manages the showing of GraphNodes it contains, as well as connections and disconnections between them. Signals are sent for each of these two events. Disconnection between GraphNode slots is disabled by default.

It is greatly advised to enable low-processor usage mode (see OS.LowProcessorUsageMode) when using GraphEdits.

Inheritance Chain

Constructors

    public GraphEdit()

Signals

    "_begin_node_move" ()

Signal sent at the beginning of a GraphNode movement.

    "_end_node_move" ()

Signal sent at the end of a GraphNode movement.

    "connection_from_empty" (String to, int to_slot, Vector2 release_position)

Signal sent when user dragging connection from input port into empty space of the graph.

    "connection_request" (String from, int from_slot, String to, int to_slot)

Signal sent to the GraphEdit when the connection between the from_slot slot of the from GraphNode and the to_slot slot of the to GraphNode is attempted to be created.

    "connection_to_empty" (String from, int from_slot, Vector2 release_position)

Signal sent when user dragging connection from output port into empty space of the graph.

    "copy_nodes_request" ()

Signal sent when the user presses Ctrl + C.

    "delete_nodes_request" ()

Signal sent when a GraphNode is attempted to be removed from the GraphEdit.

    "disconnection_request" (String from, int from_slot, String to, int to_slot)

Emitted to the GraphEdit when the connection between from_slot slot of from GraphNode and to_slot slot of to GraphNode is attempted to be removed.

    "duplicate_nodes_request" ()

Emitted when a GraphNode is attempted to be duplicated in the GraphEdit.

    "node_selected" (Node node)

Emitted when a GraphNode is selected.

    "paste_nodes_request" ()

Signal sent when the user presses Ctrl + V.

    "popup_request" (Vector2 position)

Emitted when a popup is requested. Happens on right-clicking in the GraphEdit. position is the position of the mouse pointer when the signal is sent.

    "scroll_offset_changed" (Vector2 ofs)

Properties

    public bool RightDisconnects { get; set; }

If true, enables disconnection of existing connections in the GraphEdit by dragging the right end.

    public Vector2 ScrollOffset { get; set; }

The scroll offset.

    public int SnapDistance { get; set; }

The snapping distance in pixels.

    public bool UseSnap { get; set; }

If true, enables snapping.

    public float Zoom { get; set; }

The current zoom value.

Methods

    public void AddValidConnectionType(int fromType, int toType)

Makes possible the connection between two different slot types. The type is defined with the GraphNode.SetSlot(int, bool, int, Godot.Color, bool, int, Godot.Color, Godot.Texture, Godot.Texture) method.

    public void AddValidLeftDisconnectType(int type)

Makes possible to disconnect nodes when dragging from the slot at the left if it has the specified type.

    public void AddValidRightDisconnectType(int type)

Makes possible to disconnect nodes when dragging from the slot at the right if it has the specified type.

    public void ClearConnections()

Removes all connections between nodes.

    public Error ConnectNode(string from, int fromPort, string to, int toPort)

Create a connection between the fromPort slot of the from GraphNode and the toPort slot of the to GraphNode. If the connection already exists, no connection is created.

    public void DisconnectNode(string from, int fromPort, string to, int toPort)

Removes the connection between the fromPort slot of the from GraphNode and the toPort slot of the to GraphNode. If the connection does not exist, no connection is removed.

    public Godot.Collections.Array GetConnectionList()

Returns an Array containing the list of connections. A connection consists in a structure of the form { from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }.

    [Obsolete("GetScrollOfs is deprecated. Use the ScrollOffset property instead.")]
    public Vector2 GetScrollOfs()

Getter for ScrollOffset

    [Obsolete("GetSnap is deprecated. Use the SnapDistance property instead.")]
    public int GetSnap()

Getter for SnapDistance

    [Obsolete("GetZoom is deprecated. Use the Zoom property instead.")]
    public float GetZoom()

Getter for Zoom

    public HBoxContainer GetZoomHbox()

    public bool IsNodeConnected(string from, int fromPort, string to, int toPort)

Returns true if the fromPort slot of the from GraphNode is connected to the toPort slot of the to GraphNode.

    [Obsolete("IsRightDisconnectsEnabled is deprecated. Use the RightDisconnects property instead.")]
    public bool IsRightDisconnectsEnabled()

Getter for RightDisconnects

    [Obsolete("IsUsingSnap is deprecated. Use the UseSnap property instead.")]
    public bool IsUsingSnap()

Getter for UseSnap

    public bool IsValidConnectionType(int fromType, int toType)

Returns whether it’s possible to connect slots of the specified types.

    public void RemoveValidConnectionType(int fromType, int toType)

Makes it not possible to connect between two different slot types. The type is defined with the GraphNode.SetSlot(int, bool, int, Godot.Color, bool, int, Godot.Color, Godot.Texture, Godot.Texture) method.

    public void RemoveValidLeftDisconnectType(int type)

Removes the possibility to disconnect nodes when dragging from the slot at the left if it has the specified type.

    public void RemoveValidRightDisconnectType(int type)

Removes the possibility to disconnect nodes when dragging from the slot at the right if it has the specified type.

    public void SetConnectionActivity(string from, int fromPort, string to, int toPort, float amount)

    [Obsolete("SetRightDisconnects is deprecated. Use the RightDisconnects property instead.")]
    public void SetRightDisconnects(bool enable)

Setter for RightDisconnects

    [Obsolete("SetScrollOfs is deprecated. Use the ScrollOffset property instead.")]
    public void SetScrollOfs(Vector2 ofs)

Setter for ScrollOffset

    public void SetSelected(Node node)

Sets the specified node as the one selected.

    [Obsolete("SetSnap is deprecated. Use the SnapDistance property instead.")]
    public void SetSnap(int pixels)

Setter for SnapDistance

    [Obsolete("SetUseSnap is deprecated. Use the UseSnap property instead.")]
    public void SetUseSnap(bool enable)

Setter for UseSnap

    [Obsolete("SetZoom is deprecated. Use the Zoom property instead.")]
    public void SetZoom(float pZoom)

Setter for Zoom

Tags: