class_graphnode.rst 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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:`StyleBox<class_StyleBox>` | selectedframe | |
  97. +---------------------------------+---------------+---------------------+
  98. | :ref:`int<class_int>` | separation | 1 |
  99. +---------------------------------+---------------+---------------------+
  100. | :ref:`Color<class_Color>` | title_color | Color( 0, 0, 0, 1 ) |
  101. +---------------------------------+---------------+---------------------+
  102. | :ref:`Font<class_Font>` | title_font | |
  103. +---------------------------------+---------------+---------------------+
  104. | :ref:`int<class_int>` | title_offset | 20 |
  105. +---------------------------------+---------------+---------------------+
  106. Signals
  107. -------
  108. .. _class_GraphNode_signal_close_request:
  109. - **close_request** **(** **)**
  110. Signal sent on closing the GraphNode.
  111. .. _class_GraphNode_signal_dragged:
  112. - **dragged** **(** :ref:`Vector2<class_Vector2>` from, :ref:`Vector2<class_Vector2>` to **)**
  113. Signal sent when the GraphNode is dragged.
  114. .. _class_GraphNode_signal_offset_changed:
  115. - **offset_changed** **(** **)**
  116. Signal sent when the GraphNode is moved.
  117. .. _class_GraphNode_signal_raise_request:
  118. - **raise_request** **(** **)**
  119. Signal sent when the GraphNode is requested to be displayed over other ones. Happens on focusing (clicking into) the GraphNode.
  120. .. _class_GraphNode_signal_resize_request:
  121. - **resize_request** **(** :ref:`Vector2<class_Vector2>` new_minsize **)**
  122. Enumerations
  123. ------------
  124. .. _enum_GraphNode_Overlay:
  125. .. _class_GraphNode_constant_OVERLAY_DISABLED:
  126. .. _class_GraphNode_constant_OVERLAY_BREAKPOINT:
  127. .. _class_GraphNode_constant_OVERLAY_POSITION:
  128. enum **Overlay**:
  129. - **OVERLAY_DISABLED** = **0**
  130. - **OVERLAY_BREAKPOINT** = **1**
  131. - **OVERLAY_POSITION** = **2**
  132. Description
  133. -----------
  134. 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.
  135. Property Descriptions
  136. ---------------------
  137. .. _class_GraphNode_property_comment:
  138. - :ref:`bool<class_bool>` **comment**
  139. +-----------+--------------------+
  140. | *Default* | false |
  141. +-----------+--------------------+
  142. | *Setter* | set_comment(value) |
  143. +-----------+--------------------+
  144. | *Getter* | is_comment() |
  145. +-----------+--------------------+
  146. .. _class_GraphNode_property_offset:
  147. - :ref:`Vector2<class_Vector2>` **offset**
  148. +-----------+-------------------+
  149. | *Default* | Vector2( 0, 0 ) |
  150. +-----------+-------------------+
  151. | *Setter* | set_offset(value) |
  152. +-----------+-------------------+
  153. | *Getter* | get_offset() |
  154. +-----------+-------------------+
  155. The offset of the GraphNode, relative to the scroll offset of the :ref:`GraphEdit<class_GraphEdit>`.
  156. **Note:** You cannot use position directly, as :ref:`GraphEdit<class_GraphEdit>` is a :ref:`Container<class_Container>`.
  157. .. _class_GraphNode_property_overlay:
  158. - :ref:`Overlay<enum_GraphNode_Overlay>` **overlay**
  159. +-----------+--------------------+
  160. | *Default* | 0 |
  161. +-----------+--------------------+
  162. | *Setter* | set_overlay(value) |
  163. +-----------+--------------------+
  164. | *Getter* | get_overlay() |
  165. +-----------+--------------------+
  166. .. _class_GraphNode_property_resizable:
  167. - :ref:`bool<class_bool>` **resizable**
  168. +-----------+----------------------+
  169. | *Default* | false |
  170. +-----------+----------------------+
  171. | *Setter* | set_resizable(value) |
  172. +-----------+----------------------+
  173. | *Getter* | is_resizable() |
  174. +-----------+----------------------+
  175. .. _class_GraphNode_property_selected:
  176. - :ref:`bool<class_bool>` **selected**
  177. +-----------+---------------------+
  178. | *Default* | false |
  179. +-----------+---------------------+
  180. | *Setter* | set_selected(value) |
  181. +-----------+---------------------+
  182. | *Getter* | is_selected() |
  183. +-----------+---------------------+
  184. .. _class_GraphNode_property_show_close:
  185. - :ref:`bool<class_bool>` **show_close**
  186. +-----------+------------------------------+
  187. | *Default* | false |
  188. +-----------+------------------------------+
  189. | *Setter* | set_show_close_button(value) |
  190. +-----------+------------------------------+
  191. | *Getter* | is_close_button_visible() |
  192. +-----------+------------------------------+
  193. .. _class_GraphNode_property_title:
  194. - :ref:`String<class_String>` **title**
  195. +-----------+------------------+
  196. | *Default* | "" |
  197. +-----------+------------------+
  198. | *Setter* | set_title(value) |
  199. +-----------+------------------+
  200. | *Getter* | get_title() |
  201. +-----------+------------------+
  202. Method Descriptions
  203. -------------------
  204. .. _class_GraphNode_method_clear_all_slots:
  205. - void **clear_all_slots** **(** **)**
  206. Disables all input and output slots of the GraphNode.
  207. .. _class_GraphNode_method_clear_slot:
  208. - void **clear_slot** **(** :ref:`int<class_int>` idx **)**
  209. Disables input and output slot whose index is ``idx``.
  210. .. _class_GraphNode_method_get_connection_input_color:
  211. - :ref:`Color<class_Color>` **get_connection_input_color** **(** :ref:`int<class_int>` idx **)**
  212. Returns the color of the input connection ``idx``.
  213. .. _class_GraphNode_method_get_connection_input_count:
  214. - :ref:`int<class_int>` **get_connection_input_count** **(** **)**
  215. Returns the number of enabled input slots (connections) to the GraphNode.
  216. .. _class_GraphNode_method_get_connection_input_position:
  217. - :ref:`Vector2<class_Vector2>` **get_connection_input_position** **(** :ref:`int<class_int>` idx **)**
  218. Returns the position of the input connection ``idx``.
  219. .. _class_GraphNode_method_get_connection_input_type:
  220. - :ref:`int<class_int>` **get_connection_input_type** **(** :ref:`int<class_int>` idx **)**
  221. Returns the type of the input connection ``idx``.
  222. .. _class_GraphNode_method_get_connection_output_color:
  223. - :ref:`Color<class_Color>` **get_connection_output_color** **(** :ref:`int<class_int>` idx **)**
  224. Returns the color of the output connection ``idx``.
  225. .. _class_GraphNode_method_get_connection_output_count:
  226. - :ref:`int<class_int>` **get_connection_output_count** **(** **)**
  227. Returns the number of enabled output slots (connections) of the GraphNode.
  228. .. _class_GraphNode_method_get_connection_output_position:
  229. - :ref:`Vector2<class_Vector2>` **get_connection_output_position** **(** :ref:`int<class_int>` idx **)**
  230. Returns the position of the output connection ``idx``.
  231. .. _class_GraphNode_method_get_connection_output_type:
  232. - :ref:`int<class_int>` **get_connection_output_type** **(** :ref:`int<class_int>` idx **)**
  233. Returns the type of the output connection ``idx``.
  234. .. _class_GraphNode_method_get_slot_color_left:
  235. - :ref:`Color<class_Color>` **get_slot_color_left** **(** :ref:`int<class_int>` idx **)** const
  236. Returns the color set to ``idx`` left (input) slot.
  237. .. _class_GraphNode_method_get_slot_color_right:
  238. - :ref:`Color<class_Color>` **get_slot_color_right** **(** :ref:`int<class_int>` idx **)** const
  239. Returns the color set to ``idx`` right (output) slot.
  240. .. _class_GraphNode_method_get_slot_type_left:
  241. - :ref:`int<class_int>` **get_slot_type_left** **(** :ref:`int<class_int>` idx **)** const
  242. Returns the (integer) type of left (input) ``idx`` slot.
  243. .. _class_GraphNode_method_get_slot_type_right:
  244. - :ref:`int<class_int>` **get_slot_type_right** **(** :ref:`int<class_int>` idx **)** const
  245. Returns the (integer) type of right (output) ``idx`` slot.
  246. .. _class_GraphNode_method_is_slot_enabled_left:
  247. - :ref:`bool<class_bool>` **is_slot_enabled_left** **(** :ref:`int<class_int>` idx **)** const
  248. Returns ``true`` if left (input) slot ``idx`` is enabled, ``false`` otherwise.
  249. .. _class_GraphNode_method_is_slot_enabled_right:
  250. - :ref:`bool<class_bool>` **is_slot_enabled_right** **(** :ref:`int<class_int>` idx **)** const
  251. Returns ``true`` if right (output) slot ``idx`` is enabled, ``false`` otherwise.
  252. .. _class_GraphNode_method_set_slot:
  253. - 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 **)**