Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
GraphNode¶
Inherits: GraphElement < Container < Control < CanvasItem < Node < Object
A container with connection ports, representing a node in a GraphEdit.
Description¶
GraphNode allows to create nodes for a GraphEdit graph with customizable content based on its child controls. GraphNode is derived from Container and it is responsible for placing its children on screen. This works similar to VBoxContainer. Children, in turn, provide GraphNode with so-called slots, each of which can have a connection port on either side.
Each GraphNode slot is defined by its index and can provide the node with up to two ports: one on the left, and one on the right. By convention the left port is also referred to as the input port and the right port is referred to as the output port. Each port can be enabled and configured individually, using different type and color. The type is an arbitrary value that you can define using your own considerations. The parent GraphEdit will receive this information on each connect and disconnect request.
Slots can be configured in the Inspector dock once you add at least one child Control. The properties are grouped by each slot's index in the "Slot" section.
Note: While GraphNode is set up using slots and slot indices, connections are made between the ports which are enabled. Because of that GraphEdit uses the port's index and not the slot's index. You can use get_input_port_slot and get_output_port_slot to get the slot index from the port index.
Properties¶
mouse_filter |
|
|
|
Methods¶
void |
_draw_port ( int slot_index, Vector2i position, bool left, Color color ) virtual |
void |
clear_all_slots ( ) |
void |
clear_slot ( int slot_index ) |
get_input_port_color ( int port_idx ) |
|
get_input_port_position ( int port_idx ) |
|
get_input_port_slot ( int port_idx ) |
|
get_input_port_type ( int port_idx ) |
|
get_output_port_color ( int port_idx ) |
|
get_output_port_position ( int port_idx ) |
|
get_output_port_slot ( int port_idx ) |
|
get_output_port_type ( int port_idx ) |
|
get_slot_color_left ( int slot_index ) const |
|
get_slot_color_right ( int slot_index ) const |
|
get_slot_type_left ( int slot_index ) const |
|
get_slot_type_right ( int slot_index ) const |
|
is_slot_draw_stylebox ( int slot_index ) const |
|
is_slot_enabled_left ( int slot_index ) const |
|
is_slot_enabled_right ( int slot_index ) const |
|
void |
set_slot ( int slot_index, bool enable_left_port, int type_left, Color color_left, bool enable_right_port, int type_right, Color color_right, Texture2D custom_icon_left=null, Texture2D custom_icon_right=null, bool draw_stylebox=true ) |
void |
set_slot_color_left ( int slot_index, Color color ) |
void |
set_slot_color_right ( int slot_index, Color color ) |
void |
set_slot_draw_stylebox ( int slot_index, bool enable ) |
void |
set_slot_enabled_left ( int slot_index, bool enable ) |
void |
set_slot_enabled_right ( int slot_index, bool enable ) |
void |
set_slot_type_left ( int slot_index, int type ) |
void |
set_slot_type_right ( int slot_index, int type ) |
Theme Properties¶
|
||
|
||
|
||
Signals¶
slot_updated ( int slot_index )
Emitted when any GraphNode's slot is updated.
Property Descriptions¶
String title = ""
The text displayed in the GraphNode's title bar.
Method Descriptions¶
void _draw_port ( int slot_index, Vector2i position, bool left, Color color ) virtual
There is currently no description for this method. Please help us by contributing one!
void clear_all_slots ( )
Disables all slots of the GraphNode. This will remove all input/output ports from the GraphNode.
void clear_slot ( int slot_index )
Disables the slot with the given slot_index
. This will remove the corresponding input and output port from the GraphNode.
Color get_input_port_color ( int port_idx )
Returns the Color of the input port with the given port_idx
.
int get_input_port_count ( )
Returns the number of slots with an enabled input port.
Vector2 get_input_port_position ( int port_idx )
Returns the position of the input port with the given port_idx
.
int get_input_port_slot ( int port_idx )
Returns the corresponding slot index of the input port with the given port_idx
.
int get_input_port_type ( int port_idx )
Returns the type of the input port with the given port_idx
.
Color get_output_port_color ( int port_idx )
Returns the Color of the output port with the given port_idx
.
int get_output_port_count ( )
Returns the number of slots with an enabled output port.
Vector2 get_output_port_position ( int port_idx )
Returns the position of the output port with the given port_idx
.
int get_output_port_slot ( int port_idx )
Returns the corresponding slot index of the output port with the given port_idx
.
int get_output_port_type ( int port_idx )
Returns the type of the output port with the given port_idx
.
Color get_slot_color_left ( int slot_index ) const
Returns the left (input) Color of the slot with the given slot_index
.
Color get_slot_color_right ( int slot_index ) const
Returns the right (output) Color of the slot with the given slot_index
.
int get_slot_type_left ( int slot_index ) const
Returns the left (input) type of the slot with the given slot_index
.
int get_slot_type_right ( int slot_index ) const
Returns the right (output) type of the slot with the given slot_index
.
HBoxContainer get_titlebar_hbox ( )