class_graphnode.rst 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/GraphNode.xml.
  6. .. _class_GraphNode:
  7. GraphNode
  8. =========
  9. **Experimental:** This class may be changed or removed in future versions.
  10. **Inherits:** :ref:`GraphElement<class_GraphElement>` **<** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  11. A container with connection ports, representing a node in a :ref:`GraphEdit<class_GraphEdit>`.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. **GraphNode** allows to create nodes for a :ref:`GraphEdit<class_GraphEdit>` graph with customizable content based on its child controls. **GraphNode** is derived from :ref:`Container<class_Container>` and it 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.
  16. 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.
  17. 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.
  18. \ **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 the port's index and not the slot's index. You can use :ref:`get_input_port_slot<class_GraphNode_method_get_input_port_slot>` and :ref:`get_output_port_slot<class_GraphNode_method_get_output_port_slot>` to get the slot index from the port index.
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +----------------------------------------------+----------------------------------------------+-----------------------------------------------------------------------+
  25. | :ref:`MouseFilter<enum_Control_MouseFilter>` | mouse_filter | ``0`` (overrides :ref:`Control<class_Control_property_mouse_filter>`) |
  26. +----------------------------------------------+----------------------------------------------+-----------------------------------------------------------------------+
  27. | :ref:`String<class_String>` | :ref:`title<class_GraphNode_property_title>` | ``""`` |
  28. +----------------------------------------------+----------------------------------------------+-----------------------------------------------------------------------+
  29. .. rst-class:: classref-reftable-group
  30. Methods
  31. -------
  32. .. table::
  33. :widths: auto
  34. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`_draw_port<class_GraphNode_private_method__draw_port>` **(** :ref:`int<class_int>` slot_index, :ref:`Vector2i<class_Vector2i>` position, :ref:`bool<class_bool>` left, :ref:`Color<class_Color>` color **)** |virtual| |
  36. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`clear_all_slots<class_GraphNode_method_clear_all_slots>` **(** **)** |
  38. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`clear_slot<class_GraphNode_method_clear_slot>` **(** :ref:`int<class_int>` slot_index **)** |
  40. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Color<class_Color>` | :ref:`get_input_port_color<class_GraphNode_method_get_input_port_color>` **(** :ref:`int<class_int>` port_idx **)** |
  42. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`get_input_port_count<class_GraphNode_method_get_input_port_count>` **(** **)** |
  44. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`Vector2<class_Vector2>` | :ref:`get_input_port_position<class_GraphNode_method_get_input_port_position>` **(** :ref:`int<class_int>` port_idx **)** |
  46. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`get_input_port_slot<class_GraphNode_method_get_input_port_slot>` **(** :ref:`int<class_int>` port_idx **)** |
  48. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`get_input_port_type<class_GraphNode_method_get_input_port_type>` **(** :ref:`int<class_int>` port_idx **)** |
  50. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Color<class_Color>` | :ref:`get_output_port_color<class_GraphNode_method_get_output_port_color>` **(** :ref:`int<class_int>` port_idx **)** |
  52. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`int<class_int>` | :ref:`get_output_port_count<class_GraphNode_method_get_output_port_count>` **(** **)** |
  54. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Vector2<class_Vector2>` | :ref:`get_output_port_position<class_GraphNode_method_get_output_port_position>` **(** :ref:`int<class_int>` port_idx **)** |
  56. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`get_output_port_slot<class_GraphNode_method_get_output_port_slot>` **(** :ref:`int<class_int>` port_idx **)** |
  58. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`int<class_int>` | :ref:`get_output_port_type<class_GraphNode_method_get_output_port_type>` **(** :ref:`int<class_int>` port_idx **)** |
  60. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Color<class_Color>` | :ref:`get_slot_color_left<class_GraphNode_method_get_slot_color_left>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  62. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Color<class_Color>` | :ref:`get_slot_color_right<class_GraphNode_method_get_slot_color_right>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  64. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_slot_custom_icon_left<class_GraphNode_method_get_slot_custom_icon_left>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  66. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_slot_custom_icon_right<class_GraphNode_method_get_slot_custom_icon_right>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  68. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`int<class_int>` | :ref:`get_slot_type_left<class_GraphNode_method_get_slot_type_left>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  70. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`int<class_int>` | :ref:`get_slot_type_right<class_GraphNode_method_get_slot_type_right>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  72. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`HBoxContainer<class_HBoxContainer>` | :ref:`get_titlebar_hbox<class_GraphNode_method_get_titlebar_hbox>` **(** **)** |
  74. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`bool<class_bool>` | :ref:`is_slot_draw_stylebox<class_GraphNode_method_is_slot_draw_stylebox>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  76. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`bool<class_bool>` | :ref:`is_slot_enabled_left<class_GraphNode_method_is_slot_enabled_left>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  78. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`bool<class_bool>` | :ref:`is_slot_enabled_right<class_GraphNode_method_is_slot_enabled_right>` **(** :ref:`int<class_int>` slot_index **)** |const| |
  80. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | 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 **)** |
  82. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`set_slot_color_left<class_GraphNode_method_set_slot_color_left>` **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)** |
  84. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`set_slot_color_right<class_GraphNode_method_set_slot_color_right>` **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)** |
  86. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`set_slot_custom_icon_left<class_GraphNode_method_set_slot_custom_icon_left>` **(** :ref:`int<class_int>` slot_index, :ref:`Texture2D<class_Texture2D>` custom_icon **)** |
  88. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`set_slot_custom_icon_right<class_GraphNode_method_set_slot_custom_icon_right>` **(** :ref:`int<class_int>` slot_index, :ref:`Texture2D<class_Texture2D>` custom_icon **)** |
  90. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | void | :ref:`set_slot_draw_stylebox<class_GraphNode_method_set_slot_draw_stylebox>` **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)** |
  92. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | void | :ref:`set_slot_enabled_left<class_GraphNode_method_set_slot_enabled_left>` **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)** |
  94. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | void | :ref:`set_slot_enabled_right<class_GraphNode_method_set_slot_enabled_right>` **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)** |
  96. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`set_slot_type_left<class_GraphNode_method_set_slot_type_left>` **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)** |
  98. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`set_slot_type_right<class_GraphNode_method_set_slot_type_right>` **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)** |
  100. +-------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. .. rst-class:: classref-reftable-group
  102. Theme Properties
  103. ----------------
  104. .. table::
  105. :widths: auto
  106. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  107. | :ref:`Color<class_Color>` | :ref:`resizer_color<class_GraphNode_theme_color_resizer_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  108. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  109. | :ref:`int<class_int>` | :ref:`port_h_offset<class_GraphNode_theme_constant_port_h_offset>` | ``0`` |
  110. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  111. | :ref:`int<class_int>` | :ref:`separation<class_GraphNode_theme_constant_separation>` | ``2`` |
  112. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  113. | :ref:`Texture2D<class_Texture2D>` | :ref:`port<class_GraphNode_theme_icon_port>` | |
  114. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  115. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_GraphNode_theme_style_panel>` | |
  116. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  117. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel_selected<class_GraphNode_theme_style_panel_selected>` | |
  118. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  119. | :ref:`StyleBox<class_StyleBox>` | :ref:`slot<class_GraphNode_theme_style_slot>` | |
  120. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  121. | :ref:`StyleBox<class_StyleBox>` | :ref:`titlebar<class_GraphNode_theme_style_titlebar>` | |
  122. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  123. | :ref:`StyleBox<class_StyleBox>` | :ref:`titlebar_selected<class_GraphNode_theme_style_titlebar_selected>` | |
  124. +-----------------------------------+-------------------------------------------------------------------------+-----------------------------------+
  125. .. rst-class:: classref-section-separator
  126. ----
  127. .. rst-class:: classref-descriptions-group
  128. Signals
  129. -------
  130. .. _class_GraphNode_signal_slot_updated:
  131. .. rst-class:: classref-signal
  132. **slot_updated** **(** :ref:`int<class_int>` slot_index **)**
  133. Emitted when any GraphNode's slot is updated.
  134. .. rst-class:: classref-section-separator
  135. ----
  136. .. rst-class:: classref-descriptions-group
  137. Property Descriptions
  138. ---------------------
  139. .. _class_GraphNode_property_title:
  140. .. rst-class:: classref-property
  141. :ref:`String<class_String>` **title** = ``""``
  142. .. rst-class:: classref-property-setget
  143. - void **set_title** **(** :ref:`String<class_String>` value **)**
  144. - :ref:`String<class_String>` **get_title** **(** **)**
  145. The text displayed in the GraphNode's title bar.
  146. .. rst-class:: classref-section-separator
  147. ----
  148. .. rst-class:: classref-descriptions-group
  149. Method Descriptions
  150. -------------------
  151. .. _class_GraphNode_private_method__draw_port:
  152. .. rst-class:: classref-method
  153. void **_draw_port** **(** :ref:`int<class_int>` slot_index, :ref:`Vector2i<class_Vector2i>` position, :ref:`bool<class_bool>` left, :ref:`Color<class_Color>` color **)** |virtual|
  154. .. container:: contribute
  155. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  156. .. rst-class:: classref-item-separator
  157. ----
  158. .. _class_GraphNode_method_clear_all_slots:
  159. .. rst-class:: classref-method
  160. void **clear_all_slots** **(** **)**
  161. Disables all slots of the GraphNode. This will remove all input/output ports from the GraphNode.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_GraphNode_method_clear_slot:
  165. .. rst-class:: classref-method
  166. void **clear_slot** **(** :ref:`int<class_int>` slot_index **)**
  167. Disables the slot with the given ``slot_index``. This will remove the corresponding input and output port from the GraphNode.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_GraphNode_method_get_input_port_color:
  171. .. rst-class:: classref-method
  172. :ref:`Color<class_Color>` **get_input_port_color** **(** :ref:`int<class_int>` port_idx **)**
  173. Returns the :ref:`Color<class_Color>` of the input port with the given ``port_idx``.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_GraphNode_method_get_input_port_count:
  177. .. rst-class:: classref-method
  178. :ref:`int<class_int>` **get_input_port_count** **(** **)**
  179. Returns the number of slots with an enabled input port.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_GraphNode_method_get_input_port_position:
  183. .. rst-class:: classref-method
  184. :ref:`Vector2<class_Vector2>` **get_input_port_position** **(** :ref:`int<class_int>` port_idx **)**
  185. Returns the position of the input port with the given ``port_idx``.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_GraphNode_method_get_input_port_slot:
  189. .. rst-class:: classref-method
  190. :ref:`int<class_int>` **get_input_port_slot** **(** :ref:`int<class_int>` port_idx **)**
  191. Returns the corresponding slot index of the input port with the given ``port_idx``.
  192. .. rst-class:: classref-item-separator
  193. ----
  194. .. _class_GraphNode_method_get_input_port_type:
  195. .. rst-class:: classref-method
  196. :ref:`int<class_int>` **get_input_port_type** **(** :ref:`int<class_int>` port_idx **)**
  197. Returns the type of the input port with the given ``port_idx``.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_GraphNode_method_get_output_port_color:
  201. .. rst-class:: classref-method
  202. :ref:`Color<class_Color>` **get_output_port_color** **(** :ref:`int<class_int>` port_idx **)**
  203. Returns the :ref:`Color<class_Color>` of the output port with the given ``port_idx``.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_GraphNode_method_get_output_port_count:
  207. .. rst-class:: classref-method
  208. :ref:`int<class_int>` **get_output_port_count** **(** **)**
  209. Returns the number of slots with an enabled output port.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_GraphNode_method_get_output_port_position:
  213. .. rst-class:: classref-method
  214. :ref:`Vector2<class_Vector2>` **get_output_port_position** **(** :ref:`int<class_int>` port_idx **)**
  215. Returns the position of the output port with the given ``port_idx``.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_GraphNode_method_get_output_port_slot:
  219. .. rst-class:: classref-method
  220. :ref:`int<class_int>` **get_output_port_slot** **(** :ref:`int<class_int>` port_idx **)**
  221. Returns the corresponding slot index of the output port with the given ``port_idx``.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_GraphNode_method_get_output_port_type:
  225. .. rst-class:: classref-method
  226. :ref:`int<class_int>` **get_output_port_type** **(** :ref:`int<class_int>` port_idx **)**
  227. Returns the type of the output port with the given ``port_idx``.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_GraphNode_method_get_slot_color_left:
  231. .. rst-class:: classref-method
  232. :ref:`Color<class_Color>` **get_slot_color_left** **(** :ref:`int<class_int>` slot_index **)** |const|
  233. Returns the left (input) :ref:`Color<class_Color>` of the slot with the given ``slot_index``.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_GraphNode_method_get_slot_color_right:
  237. .. rst-class:: classref-method
  238. :ref:`Color<class_Color>` **get_slot_color_right** **(** :ref:`int<class_int>` slot_index **)** |const|
  239. Returns the right (output) :ref:`Color<class_Color>` of the slot with the given ``slot_index``.
  240. .. rst-class:: classref-item-separator
  241. ----
  242. .. _class_GraphNode_method_get_slot_custom_icon_left:
  243. .. rst-class:: classref-method
  244. :ref:`Texture2D<class_Texture2D>` **get_slot_custom_icon_left** **(** :ref:`int<class_int>` slot_index **)** |const|
  245. Returns the left (input) custom :ref:`Texture2D<class_Texture2D>` of the slot with the given ``slot_index``.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_GraphNode_method_get_slot_custom_icon_right:
  249. .. rst-class:: classref-method
  250. :ref:`Texture2D<class_Texture2D>` **get_slot_custom_icon_right** **(** :ref:`int<class_int>` slot_index **)** |const|
  251. Returns the right (output) custom :ref:`Texture2D<class_Texture2D>` of the slot with the given ``slot_index``.
  252. .. rst-class:: classref-item-separator
  253. ----
  254. .. _class_GraphNode_method_get_slot_type_left:
  255. .. rst-class:: classref-method
  256. :ref:`int<class_int>` **get_slot_type_left** **(** :ref:`int<class_int>` slot_index **)** |const|
  257. Returns the left (input) type of the slot with the given ``slot_index``.
  258. .. rst-class:: classref-item-separator
  259. ----
  260. .. _class_GraphNode_method_get_slot_type_right:
  261. .. rst-class:: classref-method
  262. :ref:`int<class_int>` **get_slot_type_right** **(** :ref:`int<class_int>` slot_index **)** |const|
  263. Returns the right (output) type of the slot with the given ``slot_index``.
  264. .. rst-class:: classref-item-separator
  265. ----
  266. .. _class_GraphNode_method_get_titlebar_hbox:
  267. .. rst-class:: classref-method
  268. :ref:`HBoxContainer<class_HBoxContainer>` **get_titlebar_hbox** **(** **)**
  269. Returns the :ref:`HBoxContainer<class_HBoxContainer>` used for the title bar, only containing a :ref:`Label<class_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.
  270. .. rst-class:: classref-item-separator
  271. ----
  272. .. _class_GraphNode_method_is_slot_draw_stylebox:
  273. .. rst-class:: classref-method
  274. :ref:`bool<class_bool>` **is_slot_draw_stylebox** **(** :ref:`int<class_int>` slot_index **)** |const|
  275. Returns true if the background :ref:`StyleBox<class_StyleBox>` of the slot with the given ``slot_index`` is drawn.
  276. .. rst-class:: classref-item-separator
  277. ----
  278. .. _class_GraphNode_method_is_slot_enabled_left:
  279. .. rst-class:: classref-method
  280. :ref:`bool<class_bool>` **is_slot_enabled_left** **(** :ref:`int<class_int>` slot_index **)** |const|
  281. Returns ``true`` if left (input) side of the slot with the given ``slot_index`` is enabled.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_GraphNode_method_is_slot_enabled_right:
  285. .. rst-class:: classref-method
  286. :ref:`bool<class_bool>` **is_slot_enabled_right** **(** :ref:`int<class_int>` slot_index **)** |const|
  287. Returns ``true`` if right (output) side of the slot with the given ``slot_index`` is enabled.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_GraphNode_method_set_slot:
  291. .. rst-class:: classref-method
  292. 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 **)**
  293. Sets properties of the slot with the given ``slot_index``.
  294. 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.
  295. 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.
  296. 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.
  297. 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>`.
  298. Individual properties can also be set using one of the ``set_slot_*`` methods.
  299. \ **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.
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_GraphNode_method_set_slot_color_left:
  303. .. rst-class:: classref-method
  304. void **set_slot_color_left** **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)**
  305. Sets the :ref:`Color<class_Color>` of the left (input) side of the slot with the given ``slot_index`` to ``color``.
  306. .. rst-class:: classref-item-separator
  307. ----
  308. .. _class_GraphNode_method_set_slot_color_right:
  309. .. rst-class:: classref-method
  310. void **set_slot_color_right** **(** :ref:`int<class_int>` slot_index, :ref:`Color<class_Color>` color **)**
  311. Sets the :ref:`Color<class_Color>` of the right (output) side of the slot with the given ``slot_index`` to ``color``.
  312. .. rst-class:: classref-item-separator
  313. ----
  314. .. _class_GraphNode_method_set_slot_custom_icon_left:
  315. .. rst-class:: classref-method
  316. void **set_slot_custom_icon_left** **(** :ref:`int<class_int>` slot_index, :ref:`Texture2D<class_Texture2D>` custom_icon **)**
  317. Sets the custom :ref:`Texture2D<class_Texture2D>` of the left (input) side of the slot with the given ``slot_index`` to ``custom_icon``.
  318. .. rst-class:: classref-item-separator
  319. ----
  320. .. _class_GraphNode_method_set_slot_custom_icon_right:
  321. .. rst-class:: classref-method
  322. void **set_slot_custom_icon_right** **(** :ref:`int<class_int>` slot_index, :ref:`Texture2D<class_Texture2D>` custom_icon **)**
  323. Sets the custom :ref:`Texture2D<class_Texture2D>` of the right (output) side of the slot with the given ``slot_index`` to ``custom_icon``.
  324. .. rst-class:: classref-item-separator
  325. ----
  326. .. _class_GraphNode_method_set_slot_draw_stylebox:
  327. .. rst-class:: classref-method
  328. void **set_slot_draw_stylebox** **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)**
  329. Toggles the background :ref:`StyleBox<class_StyleBox>` of the slot with the given ``slot_index``.
  330. .. rst-class:: classref-item-separator
  331. ----
  332. .. _class_GraphNode_method_set_slot_enabled_left:
  333. .. rst-class:: classref-method
  334. void **set_slot_enabled_left** **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)**
  335. Toggles the left (input) side of the slot with the given ``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.
  336. .. rst-class:: classref-item-separator
  337. ----
  338. .. _class_GraphNode_method_set_slot_enabled_right:
  339. .. rst-class:: classref-method
  340. void **set_slot_enabled_right** **(** :ref:`int<class_int>` slot_index, :ref:`bool<class_bool>` enable **)**
  341. Toggles the right (output) side of the slot with the given ``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.
  342. .. rst-class:: classref-item-separator
  343. ----
  344. .. _class_GraphNode_method_set_slot_type_left:
  345. .. rst-class:: classref-method
  346. void **set_slot_type_left** **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)**
  347. Sets the left (input) type of the slot with the given ``slot_index`` to ``type``. If the value is negative, all connections will be disallowed to be created via user inputs.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _class_GraphNode_method_set_slot_type_right:
  351. .. rst-class:: classref-method
  352. void **set_slot_type_right** **(** :ref:`int<class_int>` slot_index, :ref:`int<class_int>` type **)**
  353. Sets the right (output) type of the slot with the given ``slot_index`` to ``type``. If the value is negative, all connections will be disallowed to be created via user inputs.
  354. .. rst-class:: classref-section-separator
  355. ----
  356. .. rst-class:: classref-descriptions-group
  357. Theme Property Descriptions
  358. ---------------------------
  359. .. _class_GraphNode_theme_color_resizer_color:
  360. .. rst-class:: classref-themeproperty
  361. :ref:`Color<class_Color>` **resizer_color** = ``Color(0.875, 0.875, 0.875, 1)``
  362. The color modulation applied to the resizer icon.
  363. .. rst-class:: classref-item-separator
  364. ----
  365. .. _class_GraphNode_theme_constant_port_h_offset:
  366. .. rst-class:: classref-themeproperty
  367. :ref:`int<class_int>` **port_h_offset** = ``0``
  368. Horizontal offset for the ports.
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_GraphNode_theme_constant_separation:
  372. .. rst-class:: classref-themeproperty
  373. :ref:`int<class_int>` **separation** = ``2``
  374. The vertical distance between ports.
  375. .. rst-class:: classref-item-separator
  376. ----
  377. .. _class_GraphNode_theme_icon_port:
  378. .. rst-class:: classref-themeproperty
  379. :ref:`Texture2D<class_Texture2D>` **port**
  380. The icon used for representing ports.
  381. .. rst-class:: classref-item-separator
  382. ----
  383. .. _class_GraphNode_theme_style_panel:
  384. .. rst-class:: classref-themeproperty
  385. :ref:`StyleBox<class_StyleBox>` **panel**
  386. The default background for the slot area of the **GraphNode**.
  387. .. rst-class:: classref-item-separator
  388. ----
  389. .. _class_GraphNode_theme_style_panel_selected:
  390. .. rst-class:: classref-themeproperty
  391. :ref:`StyleBox<class_StyleBox>` **panel_selected**
  392. The :ref:`StyleBox<class_StyleBox>` used for the slot area when selected.
  393. .. rst-class:: classref-item-separator
  394. ----
  395. .. _class_GraphNode_theme_style_slot:
  396. .. rst-class:: classref-themeproperty
  397. :ref:`StyleBox<class_StyleBox>` **slot**
  398. The :ref:`StyleBox<class_StyleBox>` used for each slot of the **GraphNode**.
  399. .. rst-class:: classref-item-separator
  400. ----
  401. .. _class_GraphNode_theme_style_titlebar:
  402. .. rst-class:: classref-themeproperty
  403. :ref:`StyleBox<class_StyleBox>` **titlebar**
  404. The :ref:`StyleBox<class_StyleBox>` used for the title bar of the **GraphNode**.
  405. .. rst-class:: classref-item-separator
  406. ----
  407. .. _class_GraphNode_theme_style_titlebar_selected:
  408. .. rst-class:: classref-themeproperty
  409. :ref:`StyleBox<class_StyleBox>` **titlebar_selected**
  410. The :ref:`StyleBox<class_StyleBox>` used for the title bar of the **GraphNode** when it is selected.
  411. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  412. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  413. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  414. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  415. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  416. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  417. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`