GraphNode

    A GraphNode is a container with potentially several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.

    A GraphNode is a container. Each GraphNode can have several input and output slots, sometimes referred to as ports, allowing connections between GraphNodes. To add a slot to GraphNode, add any -derived child node to it.

    After adding at least one child to GraphNode new sections will be automatically created in the Inspector called ‘Slot’. When ‘Slot’ is expanded you will see list with index number for each slot. You can click on each of them to expand further.

    In the Inspector you can enable (show) or disable (hide) slots. By default all slots are disabled so you may not see any slots on your GraphNode initially. You can assign a type to each slot. Only slots of the same type will be able to connect to each other. You can also assign colors to slots. A tuple of input and output slots is defined for each GUI element included in the GraphNode. Input connections are on the left and output connections are on the right side of GraphNode. Only enabled slots are counted as connections.

    Properties

    voidclear_all_slots ( )
    void ( int idx )
    get_connection_input_color ( idx )
    int ( )
    Vector2 ( int idx )
    get_connection_input_type ( idx )
    Color ( int idx )
    get_connection_output_count ( )
    get_connection_output_position ( idx )
    int ( int idx )
    get_slot_color_left ( idx ) const
    Color ( int idx ) const
    get_slot_type_left ( idx ) const
    int ( int idx ) const
    is_slot_enabled_left ( idx ) const
    bool ( int idx ) const
    void ( int idx, enable_left, int type_left, color_left, bool enable_right, type_right, Color color_right, custom_left=null, Texture custom_right=null )

    Theme Properties

    breakpoint 
    Textureclose 
    close_colorColor( 0, 0, 0, 1 )
    intclose_offset18
    comment 
    StyleBoxcommentfocus 
    defaultfocus 
    StyleBoxdefaultframe 
    frame 
    Textureport 
    port_offset3
    StyleBoxposition 
    resizer 
    Colorresizer_colorColor( 0, 0, 0, 1 )
    selectedframe 
    intseparation1
    title_colorColor( 0, 0, 0, 1 )
    Fonttitle_font 
    title_offset20
    • close_request ( )

    Emitted when the GraphNode is requested to be closed. Happens on clicking the close button (see show_close).


    Emitted when the GraphNode is dragged.


    • offset_changed ( )

    Emitted when the GraphNode is moved.


    • raise_request ( )

    Emitted when the GraphNode is requested to be displayed over other ones. Happens on focusing (clicking into) the GraphNode.


    Emitted when the GraphNode is requested to be resized. Happens on dragging the resizer handle (see ).

    Enumerations

    enum Overlay:

    • OVERLAY_DISABLED = 0 —- No overlay is shown.
    • OVERLAY_BREAKPOINT = 1 —- Show overlay set in the breakpoint theme property.
    • OVERLAY_POSITION = 2 —- Show overlay set in the position theme property.

    If true, the GraphNode is a comment node.


    • offset
    DefaultVector2( 0, 0 )
    Setterset_offset(value)
    Getterget_offset()

    The offset of the GraphNode, relative to the scroll offset of the GraphEdit.

    Note: You cannot use position directly, as is a Container.


    • overlay
    Default0
    Setterset_overlay(value)
    Getterget_overlay()

    If true, the user can resize the GraphNode.

    Note: Dragging the handle will only emit the signal, the GraphNode needs to be resized manually.


    Default
    Setterset_selected(value)
    Getteris_selected()

    If true, the GraphNode is selected.


    • show_close
    Defaultfalse
    Setterset_show_close_button(value)
    Getteris_close_button_visible()

    If true, the close button will be visible.

    Note: Pressing it will only emit the close_request signal, the GraphNode needs to be removed manually.


    • title

    The text displayed in the GraphNode’s title bar.

    Method Descriptions

    • void clear_all_slots ( )

    Disables all input and output slots of the GraphNode.


    • void clear_slot ( int idx )

    Disables input and output slot whose index is idx.


    Returns the color of the input connection idx.


    • get_connection_input_count ( )

    Returns the number of enabled input slots (connections) to the GraphNode.


    • Vector2 get_connection_input_position ( idx )

    Returns the position of the input connection idx.


    • int get_connection_input_type ( idx )

    Returns the type of the input connection idx.


    • Color get_connection_output_color ( idx )

    Returns the color of the output connection idx.


    • int get_connection_output_count ( )

    • get_connection_output_position ( int idx )

    Returns the position of the output connection idx.


    • get_connection_output_type ( int idx )

    Returns the type of the output connection idx.


    • get_slot_color_left ( int idx ) const

    Returns the color set to idx left (input) slot.


    • get_slot_color_right ( int idx ) const

    Returns the color set to idx right (output) slot.


    • get_slot_type_left ( int idx ) const

    Returns the (integer) type of left (input) idx slot.


    • get_slot_type_right ( int idx ) const

    Returns the (integer) type of right (output) slot.


    • is_slot_enabled_left ( int idx ) const

    Returns true if left (input) slot idx is enabled, false otherwise.


    Returns true if right (output) slot idx is enabled, false otherwise.


    • void set_slot ( idx, bool enable_left, type_left, Color color_left, enable_right, int type_right, color_right, Texture custom_left=null, custom_right=null )

    Sets properties of the slot with ID idx.

    If enable_left/right, a port will appear and the slot will be able to be connected from this side.

    type_left/right is an arbitrary type of the port. Only ports with the same type values can be connected.

    color_left/right is the tint of the port’s icon on this side.

    custom_left/ is a custom texture for this side’s port.