A container with connection ports, representing a node in a [GraphEdit].
[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 [b]input port[/b] and the right port is referred to as the [b]output port[/b]. 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.
[b]Note:[/b] 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 [method get_input_port_slot] and [method get_output_port_slot] to get the slot index from the port index.
Disables all slots of the GraphNode. This will remove all input/output ports from the GraphNode.
Disables the slot with the given [param slot_index]. This will remove the corresponding input and output port from the GraphNode.
Returns the [Color] of the input port with the given [param port_idx].
Returns the number of slots with an enabled input port.
Returns the position of the input port with the given [param port_idx].
Returns the corresponding slot index of the input port with the given [param port_idx].
Returns the type of the input port with the given [param port_idx].
Returns the [Color] of the output port with the given [param port_idx].
Returns the number of slots with an enabled output port.
Returns the position of the output port with the given [param port_idx].
Returns the corresponding slot index of the output port with the given [param port_idx].
Returns the type of the output port with the given [param port_idx].
Returns the left (input) [Color] of the slot with the given [param slot_index].
Returns the right (output) [Color] of the slot with the given [param slot_index].
Returns the left (input) type of the slot with the given [param slot_index].
Returns the right (output) type of the slot with the given [param slot_index].
Returns the [HBoxContainer] used for the title bar, only containing a [Label] for displaying the title by default. This can be used to add custom controls to the title bar such as option or close buttons.
Returns true if the background [StyleBox] of the slot with the given [param slot_index] is drawn.
Returns [code]true[/code] if left (input) side of the slot with the given [param slot_index] is enabled.
Returns [code]true[/code] if right (output) side of the slot with the given [param slot_index] is enabled.
Sets properties of the slot with the given [param slot_index].
If [param enable_left_port]/[param enable_right_port] is [code]true[/code], a port will appear and the slot will be able to be connected from this side.
With [param type_left]/[param type_right] an arbitrary type can be assigned to each port. Two ports can be connected if they share the same type, or if the connection between their types is allowed in the parent [GraphEdit] (see [method GraphEdit.add_valid_connection_type]). Keep in mind that the [GraphEdit] has the final say in accepting the connection. Type compatibility simply allows the [signal GraphEdit.connection_request] signal to be emitted.
Ports can be further customized using [param color_left]/[param color_right] and [param custom_icon_left]/[param custom_icon_right]. The color parameter adds a tint to the icon. The custom icon can be used to override the default port dot.
Additionally, [param draw_stylebox] can be used to enable or disable drawing of the background stylebox for each slot. See [theme_item slot].
Individual properties can also be set using one of the [code]set_slot_*[/code] methods.
[b]Note:[/b] This method only sets properties of the slot. To create the slot itself, add a [Control]-derived child to the GraphNode.
Sets the [Color] of the left (input) side of the slot with the given [param slot_index] to [param color].
Sets the [Color] of the right (output) side of the slot with the given [param slot_index] to [param color].
Toggles the background [StyleBox] of the slot with the given [param slot_index].
Toggles the left (input) side of the slot with the given [param slot_index]. If [param enable] is [code]true[/code], a port will appear on the left side and the slot will be able to be connected from this side.
Toggles the right (output) side of the slot with the given [param slot_index]. If [param enable] is [code]true[/code], a port will appear on the right side and the slot will be able to be connected from this side.
Sets the left (input) type of the slot with the given [param slot_index] to [param type]. If the value is negative, all connections will be disallowed to be created via user inputs.
Sets the right (output) type of the slot with the given [param slot_index] to [param type]. If the value is negative, all connections will be disallowed to be created via user inputs.
The text displayed in the GraphNode's title bar.
Emitted when any GraphNode's slot is updated.
The color modulation applied to the resizer icon.
Horizontal offset for the ports.
The vertical distance between ports.
The icon used for representing ports.
The default background for the slot area of the [GraphNode].
The [StyleBox] used for the slot area when selected.
The [StyleBox] used for each slot of the [GraphNode].
The [StyleBox] used for the title bar of the [GraphNode].
The [StyleBox] used for the title bar of the [GraphNode] when it is selected.