GraphEdit

    Category: Core

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

    Properties

    void ( int from_type, to_type )
    voidadd_valid_left_disconnect_type ( type )
    voidadd_valid_right_disconnect_type ( type )
    voidclear_connections ( )
    connect_node ( from, int from_port, to, int to_port )
    void ( String from, from_port, String to, to_port )
    Array ( ) const
    HBoxContainer ( )
    bool ( String from, from_port, String to, to_port )
    bool ( int from_type, to_type ) const
    voidremove_valid_connection_type ( from_type, int to_type )
    void ( int type )
    void ( int type )
    void ( String from, from_port, String to, to_port, float amount )
    void ( Node node )

    Theme Properties

    • _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_request ( from, int from_slot, to, int to_slot )

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


    • connection_to_empty ( from, int from_slot, release_position )

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


    • disconnection_request ( String from, from_slot, String to, to_slot )

    Signal sent 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 ( )

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


    • node_selected ( Node node )

    Emitted when a GraphNode is selected.


    • popup_request ( position )

    • scroll_offset_changed ( Vector2 ofs )

    Description

    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 GraphNodes slots is disabled by default.

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

    • bool right_disconnects
    Setterset_right_disconnects(value)
    Getteris_right_disconnects_enabled()

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


    • scroll_offset

    The scroll offset.


    • int snap_distance
    Setterset_snap(value)
    Getterget_snap()

    The snapping distance in pixels.


    • use_snap

    If , enables snapping.


    Setterset_zoom(value)
    Getterget_zoom()

    The current zoom value.

    Method Descriptions

    • void add_valid_connection_type ( from_type, int to_type )

    Makes possible the connection between two different slot types. The type is defined with the method.


    • void add_valid_left_disconnect_type ( int type )

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



    • void clear_connections ( )

    Remove all connections between nodes.


    • connect_node ( String from, from_port, String to, to_port )

    Create a connection between ‘from_port’ slot of ‘from’ GraphNode and ‘to_port’ slot of ‘to’ GraphNode. If the connection already exists, no connection is created.


    • void disconnect_node ( String from, from_port, String to, to_port )

    Remove the connection between ‘from_port’ slot of ‘from’ GraphNode and ‘to_port’ slot of ‘to’ GraphNode, if connection exists.


    • Array get_connection_list ( ) const

    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” }


    • get_zoom_hbox ( )

    • bool is_node_connected ( from, int from_port, to, int to_port )

    Returns if the ‘from_port’ slot of ‘from’ GraphNode is connected to the ‘to_port’ slot of ‘to’ GraphNode.


    • is_valid_connection_type ( int from_type, to_type ) const

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


    • void remove_valid_connection_type ( int from_type, to_type )

    Makes it not possible to connect between two different slot types. The type is defined with the GraphNode.set_slot method.


    • void remove_valid_left_disconnect_type ( type )

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


    • void remove_valid_right_disconnect_type ( int type )

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


    • void set_connection_activity ( from, int from_port, to, int to_port, amount )

    • void set_selected ( Node node )