class_graphnode.rst 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the GraphNode.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_GraphNode:
  6. GraphNode
  7. =========
  8. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. A GraphNode is a container with several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.
  13. Properties
  14. ----------
  15. +----------------------------------------+--------------------------------------------------------+-----------------+
  16. | :ref:`bool<class_bool>` | :ref:`comment<class_GraphNode_property_comment>` | false |
  17. +----------------------------------------+--------------------------------------------------------+-----------------+
  18. | :ref:`Vector2<class_Vector2>` | :ref:`offset<class_GraphNode_property_offset>` | Vector2( 0, 0 ) |
  19. +----------------------------------------+--------------------------------------------------------+-----------------+
  20. | :ref:`Overlay<enum_GraphNode_Overlay>` | :ref:`overlay<class_GraphNode_property_overlay>` | 0 |
  21. +----------------------------------------+--------------------------------------------------------+-----------------+
  22. | :ref:`bool<class_bool>` | :ref:`resizable<class_GraphNode_property_resizable>` | false |
  23. +----------------------------------------+--------------------------------------------------------+-----------------+
  24. | :ref:`bool<class_bool>` | :ref:`selected<class_GraphNode_property_selected>` | false |
  25. +----------------------------------------+--------------------------------------------------------+-----------------+
  26. | :ref:`bool<class_bool>` | :ref:`show_close<class_GraphNode_property_show_close>` | false |
  27. +----------------------------------------+--------------------------------------------------------+-----------------+
  28. | :ref:`String<class_String>` | :ref:`title<class_GraphNode_property_title>` | "" |
  29. +----------------------------------------+--------------------------------------------------------+-----------------+
  30. Methods
  31. -------
  32. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`clear_all_slots<class_GraphNode_method_clear_all_slots>` **(** **)** |
  34. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`clear_slot<class_GraphNode_method_clear_slot>` **(** :ref:`int<class_int>` idx **)** |
  36. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Color<class_Color>` | :ref:`get_connection_input_color<class_GraphNode_method_get_connection_input_color>` **(** :ref:`int<class_int>` idx **)** |
  38. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`get_connection_input_count<class_GraphNode_method_get_connection_input_count>` **(** **)** |
  40. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Vector2<class_Vector2>` | :ref:`get_connection_input_position<class_GraphNode_method_get_connection_input_position>` **(** :ref:`int<class_int>` idx **)** |
  42. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`get_connection_input_type<class_GraphNode_method_get_connection_input_type>` **(** :ref:`int<class_int>` idx **)** |
  44. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`Color<class_Color>` | :ref:`get_connection_output_color<class_GraphNode_method_get_connection_output_color>` **(** :ref:`int<class_int>` idx **)** |
  46. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`get_connection_output_count<class_GraphNode_method_get_connection_output_count>` **(** **)** |
  48. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Vector2<class_Vector2>` | :ref:`get_connection_output_position<class_GraphNode_method_get_connection_output_position>` **(** :ref:`int<class_int>` idx **)** |
  50. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`int<class_int>` | :ref:`get_connection_output_type<class_GraphNode_method_get_connection_output_type>` **(** :ref:`int<class_int>` idx **)** |
  52. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Color<class_Color>` | :ref:`get_slot_color_left<class_GraphNode_method_get_slot_color_left>` **(** :ref:`int<class_int>` idx **)** const |
  54. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Color<class_Color>` | :ref:`get_slot_color_right<class_GraphNode_method_get_slot_color_right>` **(** :ref:`int<class_int>` idx **)** const |
  56. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`get_slot_type_left<class_GraphNode_method_get_slot_type_left>` **(** :ref:`int<class_int>` idx **)** const |
  58. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`int<class_int>` | :ref:`get_slot_type_right<class_GraphNode_method_get_slot_type_right>` **(** :ref:`int<class_int>` idx **)** const |
  60. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`is_slot_enabled_left<class_GraphNode_method_is_slot_enabled_left>` **(** :ref:`int<class_int>` idx **)** const |
  62. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`is_slot_enabled_right<class_GraphNode_method_is_slot_enabled_right>` **(** :ref:`int<class_int>` idx **)** const |
  64. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | 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:`Texture<class_Texture>` custom_left=null, :ref:`Texture<class_Texture>` custom_right=null **)** |
  66. +-------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. Theme Properties
  68. ----------------
  69. +---------------------------------+---------------+---------------------+
  70. | :ref:`StyleBox<class_StyleBox>` | breakpoint | |
  71. +---------------------------------+---------------+---------------------+
  72. | :ref:`Texture<class_Texture>` | close | |
  73. +---------------------------------+---------------+---------------------+
  74. | :ref:`Color<class_Color>` | close_color | Color( 0, 0, 0, 1 ) |
  75. +---------------------------------+---------------+---------------------+
  76. | :ref:`int<class_int>` | close_offset | 18 |
  77. +---------------------------------+---------------+---------------------+
  78. | :ref:`StyleBox<class_StyleBox>` | comment | |
  79. +---------------------------------+---------------+---------------------+
  80. | :ref:`StyleBox<class_StyleBox>` | commentfocus | |
  81. +---------------------------------+---------------+---------------------+
  82. | :ref:`StyleBox<class_StyleBox>` | defaultfocus | |
  83. +---------------------------------+---------------+---------------------+
  84. | :ref:`StyleBox<class_StyleBox>` | defaultframe | |
  85. +---------------------------------+---------------+---------------------+
  86. | :ref:`StyleBox<class_StyleBox>` | frame | |
  87. +---------------------------------+---------------+---------------------+
  88. | :ref:`Texture<class_Texture>` | port | |
  89. +---------------------------------+---------------+---------------------+
  90. | :ref:`int<class_int>` | port_offset | 3 |
  91. +---------------------------------+---------------+---------------------+
  92. | :ref:`StyleBox<class_StyleBox>` | position | |
  93. +---------------------------------+---------------+---------------------+
  94. | :ref:`Texture<class_Texture>` | resizer | |
  95. +---------------------------------+---------------+---------------------+
  96. | :ref:`Color<class_Color>` | resizer_color | Color( 0, 0, 0, 1 ) |
  97. +---------------------------------+---------------+---------------------+
  98. | :ref:`StyleBox<class_StyleBox>` | selectedframe | |
  99. +---------------------------------+---------------+---------------------+
  100. | :ref:`int<class_int>` | separation | 1 |
  101. +---------------------------------+---------------+---------------------+
  102. | :ref:`Color<class_Color>` | title_color | Color( 0, 0, 0, 1 ) |
  103. +---------------------------------+---------------+---------------------+
  104. | :ref:`Font<class_Font>` | title_font | |
  105. +---------------------------------+---------------+---------------------+
  106. | :ref:`int<class_int>` | title_offset | 20 |
  107. +---------------------------------+---------------+---------------------+
  108. Signals
  109. -------
  110. .. _class_GraphNode_signal_close_request:
  111. - **close_request** **(** **)**
  112. Signal sent on closing the GraphNode.
  113. .. _class_GraphNode_signal_dragged:
  114. - **dragged** **(** :ref:`Vector2<class_Vector2>` from, :ref:`Vector2<class_Vector2>` to **)**
  115. Signal sent when the GraphNode is dragged.
  116. .. _class_GraphNode_signal_offset_changed:
  117. - **offset_changed** **(** **)**
  118. Signal sent when the GraphNode is moved.
  119. .. _class_GraphNode_signal_raise_request:
  120. - **raise_request** **(** **)**
  121. Signal sent when the GraphNode is requested to be displayed over other ones. Happens on focusing (clicking into) the GraphNode.
  122. .. _class_GraphNode_signal_resize_request:
  123. - **resize_request** **(** :ref:`Vector2<class_Vector2>` new_minsize **)**
  124. Enumerations
  125. ------------
  126. .. _enum_GraphNode_Overlay:
  127. .. _class_GraphNode_constant_OVERLAY_DISABLED:
  128. .. _class_GraphNode_constant_OVERLAY_BREAKPOINT:
  129. .. _class_GraphNode_constant_OVERLAY_POSITION:
  130. enum **Overlay**:
  131. - **OVERLAY_DISABLED** = **0**
  132. - **OVERLAY_BREAKPOINT** = **1**
  133. - **OVERLAY_POSITION** = **2**
  134. Description
  135. -----------
  136. A GraphNode is a container defined by a title. It can have one or more input and output slots, which can be enabled (shown) or disabled (not shown) and have different (incompatible) types. Colors can also be assigned to slots. A tuple of input and output slots is defined for each GUI element included in the GraphNode. Input and output connections are left and right slots, but only enabled slots are counted as connections.
  137. Property Descriptions
  138. ---------------------
  139. .. _class_GraphNode_property_comment:
  140. - :ref:`bool<class_bool>` **comment**
  141. +-----------+--------------------+
  142. | *Default* | false |
  143. +-----------+--------------------+
  144. | *Setter* | set_comment(value) |
  145. +-----------+--------------------+
  146. | *Getter* | is_comment() |
  147. +-----------+--------------------+
  148. .. _class_GraphNode_property_offset:
  149. - :ref:`Vector2<class_Vector2>` **offset**
  150. +-----------+-------------------+
  151. | *Default* | Vector2( 0, 0 ) |
  152. +-----------+-------------------+
  153. | *Setter* | set_offset(value) |
  154. +-----------+-------------------+
  155. | *Getter* | get_offset() |
  156. +-----------+-------------------+
  157. The offset of the GraphNode, relative to the scroll offset of the :ref:`GraphEdit<class_GraphEdit>`.
  158. **Note:** You cannot use position directly, as :ref:`GraphEdit<class_GraphEdit>` is a :ref:`Container<class_Container>`.
  159. .. _class_GraphNode_property_overlay:
  160. - :ref:`Overlay<enum_GraphNode_Overlay>` **overlay**
  161. +-----------+--------------------+
  162. | *Default* | 0 |
  163. +-----------+--------------------+
  164. | *Setter* | set_overlay(value) |
  165. +-----------+--------------------+
  166. | *Getter* | get_overlay() |
  167. +-----------+--------------------+
  168. .. _class_GraphNode_property_resizable:
  169. - :ref:`bool<class_bool>` **resizable**
  170. +-----------+----------------------+
  171. | *Default* | false |
  172. +-----------+----------------------+
  173. | *Setter* | set_resizable(value) |
  174. +-----------+----------------------+
  175. | *Getter* | is_resizable() |
  176. +-----------+----------------------+
  177. .. _class_GraphNode_property_selected:
  178. - :ref:`bool<class_bool>` **selected**
  179. +-----------+---------------------+
  180. | *Default* | false |
  181. +-----------+---------------------+
  182. | *Setter* | set_selected(value) |
  183. +-----------+---------------------+
  184. | *Getter* | is_selected() |
  185. +-----------+---------------------+
  186. .. _class_GraphNode_property_show_close:
  187. - :ref:`bool<class_bool>` **show_close**
  188. +-----------+------------------------------+
  189. | *Default* | false |
  190. +-----------+------------------------------+
  191. | *Setter* | set_show_close_button(value) |
  192. +-----------+------------------------------+
  193. | *Getter* | is_close_button_visible() |
  194. +-----------+------------------------------+
  195. .. _class_GraphNode_property_title:
  196. - :ref:`String<class_String>` **title**
  197. +-----------+------------------+
  198. | *Default* | "" |
  199. +-----------+------------------+
  200. | *Setter* | set_title(value) |
  201. +-----------+------------------+
  202. | *Getter* | get_title() |
  203. +-----------+------------------+
  204. Method Descriptions
  205. -------------------
  206. .. _class_GraphNode_method_clear_all_slots:
  207. - void **clear_all_slots** **(** **)**
  208. Disables all input and output slots of the GraphNode.
  209. .. _class_GraphNode_method_clear_slot:
  210. - void **clear_slot** **(** :ref:`int<class_int>` idx **)**
  211. Disables input and output slot whose index is ``idx``.
  212. .. _class_GraphNode_method_get_connection_input_color:
  213. - :ref:`Color<class_Color>` **get_connection_input_color** **(** :ref:`int<class_int>` idx **)**
  214. Returns the color of the input connection ``idx``.
  215. .. _class_GraphNode_method_get_connection_input_count:
  216. - :ref:`int<class_int>` **get_connection_input_count** **(** **)**
  217. Returns the number of enabled input slots (connections) to the GraphNode.
  218. .. _class_GraphNode_method_get_connection_input_position:
  219. - :ref:`Vector2<class_Vector2>` **get_connection_input_position** **(** :ref:`int<class_int>` idx **)**
  220. Returns the position of the input connection ``idx``.
  221. .. _class_GraphNode_method_get_connection_input_type:
  222. - :ref:`int<class_int>` **get_connection_input_type** **(** :ref:`int<class_int>` idx **)**
  223. Returns the type of the input connection ``idx``.
  224. .. _class_GraphNode_method_get_connection_output_color:
  225. - :ref:`Color<class_Color>` **get_connection_output_color** **(** :ref:`int<class_int>` idx **)**
  226. Returns the color of the output connection ``idx``.
  227. .. _class_GraphNode_method_get_connection_output_count:
  228. - :ref:`int<class_int>` **get_connection_output_count** **(** **)**
  229. Returns the number of enabled output slots (connections) of the GraphNode.
  230. .. _class_GraphNode_method_get_connection_output_position:
  231. - :ref:`Vector2<class_Vector2>` **get_connection_output_position** **(** :ref:`int<class_int>` idx **)**
  232. Returns the position of the output connection ``idx``.
  233. .. _class_GraphNode_method_get_connection_output_type:
  234. - :ref:`int<class_int>` **get_connection_output_type** **(** :ref:`int<class_int>` idx **)**
  235. Returns the type of the output connection ``idx``.
  236. .. _class_GraphNode_method_get_slot_color_left:
  237. - :ref:`Color<class_Color>` **get_slot_color_left** **(** :ref:`int<class_int>` idx **)** const
  238. Returns the color set to ``idx`` left (input) slot.
  239. .. _class_GraphNode_method_get_slot_color_right:
  240. - :ref:`Color<class_Color>` **get_slot_color_right** **(** :ref:`int<class_int>` idx **)** const
  241. Returns the color set to ``idx`` right (output) slot.
  242. .. _class_GraphNode_method_get_slot_type_left:
  243. - :ref:`int<class_int>` **get_slot_type_left** **(** :ref:`int<class_int>` idx **)** const
  244. Returns the (integer) type of left (input) ``idx`` slot.
  245. .. _class_GraphNode_method_get_slot_type_right:
  246. - :ref:`int<class_int>` **get_slot_type_right** **(** :ref:`int<class_int>` idx **)** const
  247. Returns the (integer) type of right (output) ``idx`` slot.
  248. .. _class_GraphNode_method_is_slot_enabled_left:
  249. - :ref:`bool<class_bool>` **is_slot_enabled_left** **(** :ref:`int<class_int>` idx **)** const
  250. Returns ``true`` if left (input) slot ``idx`` is enabled, ``false`` otherwise.
  251. .. _class_GraphNode_method_is_slot_enabled_right:
  252. - :ref:`bool<class_bool>` **is_slot_enabled_right** **(** :ref:`int<class_int>` idx **)** const
  253. Returns ``true`` if right (output) slot ``idx`` is enabled, ``false`` otherwise.
  254. .. _class_GraphNode_method_set_slot:
  255. - 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:`Texture<class_Texture>` custom_left=null, :ref:`Texture<class_Texture>` custom_right=null **)**