GraphNode
Inherits: Container < Control < CanvasItem < Node < Object A GraphNode is a container with potentially several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.
Description
Control-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
Methods
Theme Properties
Signals
- close_request ( ) show_close).
- dragged ( Vector2 from, Vector2 to ) 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.
- resize_request ( Vector2 new_minsize ) resizable).
- slot_updated ( int idx )
Emitted when any GraphNode’s slot is updated.
Enumerations
Overlay: - OVERLAY_DISABLED = 0 —- No overlay is shown.
- OVERLAY_BREAKPOINT = 1 —- Show overlay set in the
breakpointtheme property. - OVERLAY_POSITION = 2 —- Show overlay set in the
positiontheme property.Property Descriptions
- bool comment
true, the GraphNode is a comment node.
- Vector2 offset GraphEdit. Note: You cannot use position directly, as GraphEdit is a Container.
- Overlay overlay Overlay.
- bool resizable
true, the user can resize the GraphNode. Note: Dragging the handle will only emit the resize_request signal, the GraphNode needs to be resized manually.
- bool selected
true, the GraphNode is selected.
- bool show_close
true, the close button will be visible. Note: Pressing it will only emit the close_request signal, the GraphNode needs to be removed manually.
- String title
The text displayed in the GraphNode’s title bar.
Method Descriptions
- clear_all_slots ( ) Disables all input and output slots of the GraphNode.
- clear_slot ( int idx )
idx.
- Color get_connection_input_color ( int idx )
Color of the input connection
idx.
- int get_connection_input_count ( ) Returns the number of enabled input slots (connections) to the GraphNode.
- Vector2 get_connection_input_position ( int idx )
idx.
- int get_connection_input_type ( int idx )
idx.
- Color get_connection_output_color ( int idx )
Color of the output connection
idx.
- int get_connection_output_count ( ) Returns the number of enabled output slots (connections) of the GraphNode.
- Vector2 get_connection_output_position ( int idx )
idx.
- int get_connection_output_type ( int idx )
idx.
- Color get_slot_color_left ( int idx ) const
Color of the slot
idx.
- Color get_slot_color_right ( int idx ) const
Color of the slot
idx.
- int get_slot_type_left ( int idx ) const
idx.
- int get_slot_type_right ( int idx ) const
idx.
- bool is_slot_enabled_left ( int idx ) const
trueif left (input) side of the slotidxis enabled.
- bool is_slot_enabled_right ( int idx ) const
trueif right (output) side of the slotidxis enabled.
- set_slot ( int idx, bool enableleft, int type_left, Color color_left, bool enable_right, int type_right, Color color_right, Texture custom_left=null, Texture custom_right=null )
idx.enable_left/right, a port will appear and the slot will be able to be connected from this side.type_left/rightis an arbitrary type of the port. Only ports with the same type values can be connected.color_left/rightis the tint of the port’s icon on this side.custom_left/rightis a custom texture for this side’s port. Note: This method only sets properties of the slot. To create the slot, add a Control-derived child to the GraphNode. `set_slot*` methods. You must enable at least one side of the slot to do so.
- set_slot_color_left ( int idx, Color color_left )
Color of the left (input) side of the slot
idxtocolor_left.
- set_slot_color_right ( int idx, Color color_right )
Color of the right (output) side of the slot
idxtocolor_right.
- set_slot_enabled_left ( int idx, bool enable_left )
idx. Ifenable_leftistrue, a port will appear on the left side and the slot will be able to be connected from this side.
- set_slot_enabled_right ( int idx, bool enable_right )
idx. Ifenable_rightistrue, a port will appear on the right side and the slot will be able to be connected from this side.
- set_slot_type_left ( int idx, int type_left )
idxtotype_left.
- set_slot_type_right ( int idx, int type_right )
idxtotype_right.Theme Property Descriptions
- Color close_color The color modulation applied to the close button icon.
- Color resizer_color The color modulation applied to the resizer icon.
- Color title_color Color of the title text.
- int close_offset The vertical offset of the close button.
- int port_offset Horizontal offset for the ports.
- int separation The vertical distance between ports.
- int title_offset Vertical offset of the title text.
- Font title_font Font used for the title text.
- Texture close show_close is enabled.
- Texture port The icon used for representing ports.
- Texture resizer resizable is enabled.
- StyleBox breakpoint overlay is set to OVERLAY_BREAKPOINT.
- StyleBox comment StyleBox used when comment is enabled.
- StyleBox commentfocus
StyleBox used when comment is enabled and the
GraphNodeis focused.
- StyleBox defaultfocus
- StyleBox defaultframe
- StyleBox frame
GraphNode.
- StyleBox position overlay is set to OVERLAY_POSITION.
- StyleBox selectedframe
GraphNodeis selected.
