mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 17:28:58 +00:00
classref: Sync with current master branch (4ba934bf3)
This commit is contained in:
+135
-113
@@ -12,16 +12,18 @@ GraphNode
|
||||
|
||||
**Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
||||
|
||||
A GraphNode is a container with potentially several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.
|
||||
GraphNode is a :ref:`Container<class_Container>` control that represents a single data unit in a :ref:`GraphEdit<class_GraphEdit>` graph. You can customize the number, type, and color of left- and right-side connection ports.
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
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 :ref:`Control<class_Control>`-derived child node to it.
|
||||
GraphNode allows to create nodes for a :ref:`GraphEdit<class_GraphEdit>` graph with customizable content based on its child :ref:`Control<class_Control>`\ s. GraphNode is a :ref:`Container<class_Container>` and is responsible for placing its children on screen. This works similar to :ref:`VBoxContainer<class_VBoxContainer>`. Children, in turn, provide GraphNode with so-called slots, each of which can have a connection port on either side. This is similar to how :ref:`TabContainer<class_TabContainer>` uses children to create the tabs.
|
||||
|
||||
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.
|
||||
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 :ref:`GraphEdit<class_GraphEdit>` will receive this information on each connect and disconnect request.
|
||||
|
||||
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.
|
||||
Slots can be configured in the Inspector dock once you add at least one child :ref:`Control<class_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 :ref:`GraphEdit<class_GraphEdit>` uses port's index and not slot's index. You can use :ref:`get_connection_input_slot<class_GraphNode_method_get_connection_input_slot>` and :ref:`get_connection_output_slot<class_GraphNode_method_get_connection_output_slot>` to get the slot index from the port index.
|
||||
|
||||
Properties
|
||||
----------
|
||||
@@ -55,61 +57,65 @@ Properties
|
||||
Methods
|
||||
-------
|
||||
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear_all_slots<class_GraphNode_method_clear_all_slots>` **(** **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear_slot<class_GraphNode_method_clear_slot>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_connection_input_color<class_GraphNode_method_get_connection_input_color>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_input_count<class_GraphNode_method_get_connection_input_count>` **(** **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_input_height<class_GraphNode_method_get_connection_input_height>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`get_connection_input_position<class_GraphNode_method_get_connection_input_position>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_input_type<class_GraphNode_method_get_connection_input_type>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_connection_output_color<class_GraphNode_method_get_connection_output_color>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_output_count<class_GraphNode_method_get_connection_output_count>` **(** **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_output_height<class_GraphNode_method_get_connection_output_height>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`get_connection_output_position<class_GraphNode_method_get_connection_output_position>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_output_type<class_GraphNode_method_get_connection_output_type>` **(** :ref:`int<class_int>` idx **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_slot_color_left<class_GraphNode_method_get_slot_color_left>` **(** :ref:`int<class_int>` idx **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_slot_color_right<class_GraphNode_method_get_slot_color_right>` **(** :ref:`int<class_int>` idx **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_slot_type_left<class_GraphNode_method_get_slot_type_left>` **(** :ref:`int<class_int>` idx **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_slot_type_right<class_GraphNode_method_get_slot_type_right>` **(** :ref:`int<class_int>` idx **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_slot_draw_stylebox<class_GraphNode_method_is_slot_draw_stylebox>` **(** :ref:`int<class_int>` idx **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_slot_enabled_left<class_GraphNode_method_is_slot_enabled_left>` **(** :ref:`int<class_int>` idx **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_slot_enabled_right<class_GraphNode_method_is_slot_enabled_right>` **(** :ref:`int<class_int>` idx **)** |const| |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot<class_GraphNode_method_set_slot>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable_left, :ref:`int<class_int>` type_left, :ref:`Color<class_Color>` color_left, :ref:`bool<class_bool>` enable_right, :ref:`int<class_int>` type_right, :ref:`Color<class_Color>` color_right, :ref:`Texture2D<class_Texture2D>` custom_left=null, :ref:`Texture2D<class_Texture2D>` custom_right=null, :ref:`bool<class_bool>` enable=true **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_color_left<class_GraphNode_method_set_slot_color_left>` **(** :ref:`int<class_int>` idx, :ref:`Color<class_Color>` color_left **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_color_right<class_GraphNode_method_set_slot_color_right>` **(** :ref:`int<class_int>` idx, :ref:`Color<class_Color>` color_right **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_draw_stylebox<class_GraphNode_method_set_slot_draw_stylebox>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` draw_stylebox **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_enabled_left<class_GraphNode_method_set_slot_enabled_left>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable_left **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_enabled_right<class_GraphNode_method_set_slot_enabled_right>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable_right **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_type_left<class_GraphNode_method_set_slot_type_left>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` type_left **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_type_right<class_GraphNode_method_set_slot_type_right>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` type_right **)** |
|
||||
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear_all_slots<class_GraphNode_method_clear_all_slots>` **(** **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`clear_slot<class_GraphNode_method_clear_slot>` **(** :ref:`int<class_int>` slot_index **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_connection_input_color<class_GraphNode_method_get_connection_input_color>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_input_count<class_GraphNode_method_get_connection_input_count>` **(** **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_input_height<class_GraphNode_method_get_connection_input_height>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`get_connection_input_position<class_GraphNode_method_get_connection_input_position>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_input_slot<class_GraphNode_method_get_connection_input_slot>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_input_type<class_GraphNode_method_get_connection_input_type>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_connection_output_color<class_GraphNode_method_get_connection_output_color>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_output_count<class_GraphNode_method_get_connection_output_count>` **(** **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_output_height<class_GraphNode_method_get_connection_output_height>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Vector2<class_Vector2>` | :ref:`get_connection_output_position<class_GraphNode_method_get_connection_output_position>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_output_slot<class_GraphNode_method_get_connection_output_slot>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_connection_output_type<class_GraphNode_method_get_connection_output_type>` **(** :ref:`int<class_int>` port **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_slot_color_left<class_GraphNode_method_get_slot_color_left>` **(** :ref:`int<class_int>` slot_index **)** |const| |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`Color<class_Color>` | :ref:`get_slot_color_right<class_GraphNode_method_get_slot_color_right>` **(** :ref:`int<class_int>` slot_index **)** |const| |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_slot_type_left<class_GraphNode_method_get_slot_type_left>` **(** :ref:`int<class_int>` slot_index **)** |const| |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`int<class_int>` | :ref:`get_slot_type_right<class_GraphNode_method_get_slot_type_right>` **(** :ref:`int<class_int>` slot_index **)** |const| |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_slot_draw_stylebox<class_GraphNode_method_is_slot_draw_stylebox>` **(** :ref:`int<class_int>` slot_index **)** |const| |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_slot_enabled_left<class_GraphNode_method_is_slot_enabled_left>` **(** :ref:`int<class_int>` slot_index **)** |const| |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| :ref:`bool<class_bool>` | :ref:`is_slot_enabled_right<class_GraphNode_method_is_slot_enabled_right>` **(** :ref:`int<class_int>` slot_index **)** |const| |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot<class_GraphNode_method_set_slot>` **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable_left_port, :ref:`int<class_int>` type_left, :ref:`Color<class_Color>` color_left, :ref:`bool<class_bool>` enable_right_port, :ref:`int<class_int>` type_right, :ref:`Color<class_Color>` color_right, :ref:`Texture2D<class_Texture2D>` custom_icon_left=null, :ref:`Texture2D<class_Texture2D>` custom_icon_right=null, :ref:`bool<class_bool>` draw_stylebox=true **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_color_left<class_GraphNode_method_set_slot_color_left>` **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_color_right<class_GraphNode_method_set_slot_color_right>` **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_draw_stylebox<class_GraphNode_method_set_slot_draw_stylebox>` **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_enabled_left<class_GraphNode_method_set_slot_enabled_left>` **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_enabled_right<class_GraphNode_method_set_slot_enabled_right>` **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_type_left<class_GraphNode_method_set_slot_type_left>` **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| void | :ref:`set_slot_type_right<class_GraphNode_method_set_slot_type_right>` **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)** |
|
||||
+-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Theme Properties
|
||||
----------------
|
||||
@@ -436,17 +442,17 @@ Disables all input and output slots of the GraphNode.
|
||||
|
||||
.. _class_GraphNode_method_clear_slot:
|
||||
|
||||
- void **clear_slot** **(** :ref:`int<class_int>` idx **)**
|
||||
- void **clear_slot** **(** :ref:`int<class_int>` slot_index **)**
|
||||
|
||||
Disables input and output slot whose index is ``idx``.
|
||||
Disables input and output slot whose index is ``slot_index``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_input_color:
|
||||
|
||||
- :ref:`Color<class_Color>` **get_connection_input_color** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`Color<class_Color>` **get_connection_input_color** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the :ref:`Color<class_Color>` of the input connection ``idx``.
|
||||
Returns the :ref:`Color<class_Color>` of the input connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
@@ -460,33 +466,41 @@ Returns the number of enabled input slots (connections) to the GraphNode.
|
||||
|
||||
.. _class_GraphNode_method_get_connection_input_height:
|
||||
|
||||
- :ref:`int<class_int>` **get_connection_input_height** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`int<class_int>` **get_connection_input_height** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the height of the input connection ``idx``.
|
||||
Returns the height of the input connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_input_position:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **get_connection_input_position** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`Vector2<class_Vector2>` **get_connection_input_position** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the position of the input connection ``idx``.
|
||||
Returns the position of the input connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_input_slot:
|
||||
|
||||
- :ref:`int<class_int>` **get_connection_input_slot** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the corresponding slot index of the input connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_input_type:
|
||||
|
||||
- :ref:`int<class_int>` **get_connection_input_type** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`int<class_int>` **get_connection_input_type** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the type of the input connection ``idx``.
|
||||
Returns the type of the input connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_output_color:
|
||||
|
||||
- :ref:`Color<class_Color>` **get_connection_output_color** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`Color<class_Color>` **get_connection_output_color** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the :ref:`Color<class_Color>` of the output connection ``idx``.
|
||||
Returns the :ref:`Color<class_Color>` of the output connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
@@ -500,157 +514,165 @@ Returns the number of enabled output slots (connections) of the GraphNode.
|
||||
|
||||
.. _class_GraphNode_method_get_connection_output_height:
|
||||
|
||||
- :ref:`int<class_int>` **get_connection_output_height** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`int<class_int>` **get_connection_output_height** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the height of the output connection ``idx``.
|
||||
Returns the height of the output connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_output_position:
|
||||
|
||||
- :ref:`Vector2<class_Vector2>` **get_connection_output_position** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`Vector2<class_Vector2>` **get_connection_output_position** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the position of the output connection ``idx``.
|
||||
Returns the position of the output connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_output_slot:
|
||||
|
||||
- :ref:`int<class_int>` **get_connection_output_slot** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the corresponding slot index of the output connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_connection_output_type:
|
||||
|
||||
- :ref:`int<class_int>` **get_connection_output_type** **(** :ref:`int<class_int>` idx **)**
|
||||
- :ref:`int<class_int>` **get_connection_output_type** **(** :ref:`int<class_int>` port **)**
|
||||
|
||||
Returns the type of the output connection ``idx``.
|
||||
Returns the type of the output connection ``port``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_slot_color_left:
|
||||
|
||||
- :ref:`Color<class_Color>` **get_slot_color_left** **(** :ref:`int<class_int>` idx **)** |const|
|
||||
- :ref:`Color<class_Color>` **get_slot_color_left** **(** :ref:`int<class_int>` slot_index **)** |const|
|
||||
|
||||
Returns the left (input) :ref:`Color<class_Color>` of the slot ``idx``.
|
||||
Returns the left (input) :ref:`Color<class_Color>` of the slot ``slot_index``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_slot_color_right:
|
||||
|
||||
- :ref:`Color<class_Color>` **get_slot_color_right** **(** :ref:`int<class_int>` idx **)** |const|
|
||||
- :ref:`Color<class_Color>` **get_slot_color_right** **(** :ref:`int<class_int>` slot_index **)** |const|
|
||||
|
||||
Returns the right (output) :ref:`Color<class_Color>` of the slot ``idx``.
|
||||
Returns the right (output) :ref:`Color<class_Color>` of the slot ``slot_index``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_slot_type_left:
|
||||
|
||||
- :ref:`int<class_int>` **get_slot_type_left** **(** :ref:`int<class_int>` idx **)** |const|
|
||||
- :ref:`int<class_int>` **get_slot_type_left** **(** :ref:`int<class_int>` slot_index **)** |const|
|
||||
|
||||
Returns the left (input) type of the slot ``idx``.
|
||||
Returns the left (input) type of the slot ``slot_index``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_get_slot_type_right:
|
||||
|
||||
- :ref:`int<class_int>` **get_slot_type_right** **(** :ref:`int<class_int>` idx **)** |const|
|
||||
- :ref:`int<class_int>` **get_slot_type_right** **(** :ref:`int<class_int>` slot_index **)** |const|
|
||||
|
||||
Returns the right (output) type of the slot ``idx``.
|
||||
Returns the right (output) type of the slot ``slot_index``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_is_slot_draw_stylebox:
|
||||
|
||||
- :ref:`bool<class_bool>` **is_slot_draw_stylebox** **(** :ref:`int<class_int>` idx **)** |const|
|
||||
- :ref:`bool<class_bool>` **is_slot_draw_stylebox** **(** :ref:`int<class_int>` slot_index **)** |const|
|
||||
|
||||
Returns true if the background :ref:`StyleBox<class_StyleBox>` of the slot ``idx`` is drawn.
|
||||
Returns true if the background :ref:`StyleBox<class_StyleBox>` of the slot ``slot_index`` is drawn.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_is_slot_enabled_left:
|
||||
|
||||
- :ref:`bool<class_bool>` **is_slot_enabled_left** **(** :ref:`int<class_int>` idx **)** |const|
|
||||
- :ref:`bool<class_bool>` **is_slot_enabled_left** **(** :ref:`int<class_int>` slot_index **)** |const|
|
||||
|
||||
Returns ``true`` if left (input) side of the slot ``idx`` is enabled.
|
||||
Returns ``true`` if left (input) side of the slot ``slot_index`` is enabled.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_is_slot_enabled_right:
|
||||
|
||||
- :ref:`bool<class_bool>` **is_slot_enabled_right** **(** :ref:`int<class_int>` idx **)** |const|
|
||||
- :ref:`bool<class_bool>` **is_slot_enabled_right** **(** :ref:`int<class_int>` slot_index **)** |const|
|
||||
|
||||
Returns ``true`` if right (output) side of the slot ``idx`` is enabled.
|
||||
Returns ``true`` if right (output) side of the slot ``slot_index`` is enabled.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot:
|
||||
|
||||
- void **set_slot** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable_left, :ref:`int<class_int>` type_left, :ref:`Color<class_Color>` color_left, :ref:`bool<class_bool>` enable_right, :ref:`int<class_int>` type_right, :ref:`Color<class_Color>` color_right, :ref:`Texture2D<class_Texture2D>` custom_left=null, :ref:`Texture2D<class_Texture2D>` custom_right=null, :ref:`bool<class_bool>` enable=true **)**
|
||||
- void **set_slot** **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable_left_port, :ref:`int<class_int>` type_left, :ref:`Color<class_Color>` color_left, :ref:`bool<class_bool>` enable_right_port, :ref:`int<class_int>` type_right, :ref:`Color<class_Color>` color_right, :ref:`Texture2D<class_Texture2D>` custom_icon_left=null, :ref:`Texture2D<class_Texture2D>` custom_icon_right=null, :ref:`bool<class_bool>` draw_stylebox=true **)**
|
||||
|
||||
Sets properties of the slot with ID ``idx``.
|
||||
Sets properties of the slot with the ``slot_index`` index.
|
||||
|
||||
If ``enable_left``/``enable_right``, a port will appear and the slot will be able to be connected from this side.
|
||||
If ``enable_left_port``/``enable_right_port`` is ``true``, a port will appear and the slot will be able to be connected from this side.
|
||||
|
||||
``type_left``/``type_right`` is an arbitrary type of the port. Only ports with the same type values can be connected and negative values will disallow all connections to be made via user inputs.
|
||||
With ``type_left``/``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 :ref:`GraphEdit<class_GraphEdit>` (see :ref:`GraphEdit.add_valid_connection_type<class_GraphEdit_method_add_valid_connection_type>`). Keep in mind that the :ref:`GraphEdit<class_GraphEdit>` has the final say in accepting the connection. Type compatibility simply allows the :ref:`GraphEdit.connection_request<class_GraphEdit_signal_connection_request>` signal to be emitted.
|
||||
|
||||
``color_left``/``color_right`` is the tint of the port's icon on this side.
|
||||
Ports can be further customized using ``color_left``/``color_right`` and ``custom_icon_left``/``custom_icon_right``. The color parameter adds a tint to the icon. The custom icon can be used to override the default port dot.
|
||||
|
||||
``custom_left``/``custom_right`` is a custom texture for this side's port.
|
||||
Additionally, ``draw_stylebox`` can be used to enable or disable drawing of the background stylebox for each slot. See :ref:`slot<class_GraphNode_theme_style_slot>`.
|
||||
|
||||
\ **Note:** This method only sets properties of the slot. To create the slot, add a :ref:`Control<class_Control>`-derived child to the GraphNode.
|
||||
Individual properties can also be set using one of the ``set_slot_*`` methods.
|
||||
|
||||
Individual properties can be set using one of the ``set_slot_*`` methods. You must enable at least one side of the slot to do so.
|
||||
\ **Note:** This method only sets properties of the slot. To create the slot itself, add a :ref:`Control<class_Control>`-derived child to the GraphNode.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot_color_left:
|
||||
|
||||
- void **set_slot_color_left** **(** :ref:`int<class_int>` idx, :ref:`Color<class_Color>` color_left **)**
|
||||
- void **set_slot_color_left** **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)**
|
||||
|
||||
Sets the :ref:`Color<class_Color>` of the left (input) side of the slot ``idx`` to ``color_left``.
|
||||
Sets the :ref:`Color<class_Color>` of the left (input) side of the slot ``slot_index`` to ``color``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot_color_right:
|
||||
|
||||
- void **set_slot_color_right** **(** :ref:`int<class_int>` idx, :ref:`Color<class_Color>` color_right **)**
|
||||
- void **set_slot_color_right** **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)**
|
||||
|
||||
Sets the :ref:`Color<class_Color>` of the right (output) side of the slot ``idx`` to ``color_right``.
|
||||
Sets the :ref:`Color<class_Color>` of the right (output) side of the slot ``slot_index`` to ``color``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot_draw_stylebox:
|
||||
|
||||
- void **set_slot_draw_stylebox** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` draw_stylebox **)**
|
||||
- void **set_slot_draw_stylebox** **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)**
|
||||
|
||||
Toggles the background :ref:`StyleBox<class_StyleBox>` of the slot ``idx``.
|
||||
Toggles the background :ref:`StyleBox<class_StyleBox>` of the slot ``slot_index``.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot_enabled_left:
|
||||
|
||||
- void **set_slot_enabled_left** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable_left **)**
|
||||
- void **set_slot_enabled_left** **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)**
|
||||
|
||||
Toggles the left (input) side of the slot ``idx``. If ``enable_left`` is ``true``, a port will appear on the left side and the slot will be able to be connected from this side.
|
||||
Toggles the left (input) side of the slot ``slot_index``. If ``enable`` is ``true``, a port will appear on the left side and the slot will be able to be connected from this side.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot_enabled_right:
|
||||
|
||||
- void **set_slot_enabled_right** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable_right **)**
|
||||
- void **set_slot_enabled_right** **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)**
|
||||
|
||||
Toggles the right (output) side of the slot ``idx``. If ``enable_right`` is ``true``, a port will appear on the right side and the slot will be able to be connected from this side.
|
||||
Toggles the right (output) side of the slot ``slot_index``. If ``enable`` is ``true``, a port will appear on the right side and the slot will be able to be connected from this side.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot_type_left:
|
||||
|
||||
- void **set_slot_type_left** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` type_left **)**
|
||||
- void **set_slot_type_left** **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)**
|
||||
|
||||
Sets the left (input) type of the slot ``idx`` to ``type_left``. If the value is negative, all connections will be disallowed to be created via user inputs.
|
||||
Sets the left (input) type of the slot ``slot_index`` to ``type``. If the value is negative, all connections will be disallowed to be created via user inputs.
|
||||
|
||||
----
|
||||
|
||||
.. _class_GraphNode_method_set_slot_type_right:
|
||||
|
||||
- void **set_slot_type_right** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` type_right **)**
|
||||
- void **set_slot_type_right** **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)**
|
||||
|
||||
Sets the right (output) type of the slot ``idx`` to ``type_right``. If the value is negative, all connections will be disallowed to be created via user inputs.
|
||||
Sets the right (output) type of the slot ``slot_index`` to ``type``. If the value is negative, all connections will be disallowed to be created via user inputs.
|
||||
|
||||
Theme Property Descriptions
|
||||
---------------------------
|
||||
|
||||
Reference in New Issue
Block a user