class_graphedit.rst 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323
  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/GraphEdit.xml.
  6. .. _class_GraphEdit:
  7. GraphEdit
  8. =========
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. An editor for graph-like structures, using :ref:`GraphNode<class_GraphNode>`\ s.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **GraphEdit** provides tools for creation, manipulation, and display of various graphs. Its main purpose in the engine is to power the visual programming systems, such as visual shaders, but it is also available for use in user projects.
  15. \ **GraphEdit** by itself is only an empty container, representing an infinite grid where :ref:`GraphNode<class_GraphNode>`\ s can be placed. Each :ref:`GraphNode<class_GraphNode>` represents a node in the graph, a single unit of data in the connected scheme. **GraphEdit**, in turn, helps to control various interactions with nodes and between nodes. When the user attempts to connect, disconnect, or delete a :ref:`GraphNode<class_GraphNode>`, a signal is emitted in the **GraphEdit**, but no action is taken by default. It is the responsibility of the programmer utilizing this control to implement the necessary logic to determine how each request should be handled.
  16. \ **Performance:** It is greatly advised to enable low-processor usage mode (see :ref:`OS.low_processor_usage_mode<class_OS_property_low_processor_usage_mode>`) when using GraphEdits.
  17. .. rst-class:: classref-reftable-group
  18. Properties
  19. ----------
  20. .. table::
  21. :widths: auto
  22. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | clip_contents | ``true`` (overrides :ref:`Control<class_Control_property_clip_contents>`) |
  24. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`connection_lines_antialiased<class_GraphEdit_property_connection_lines_antialiased>` | ``true`` |
  26. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  27. | :ref:`float<class_float>` | :ref:`connection_lines_curvature<class_GraphEdit_property_connection_lines_curvature>` | ``0.5`` |
  28. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`connection_lines_thickness<class_GraphEdit_property_connection_lines_thickness>` | ``2.0`` |
  30. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  31. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
  32. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`minimap_enabled<class_GraphEdit_property_minimap_enabled>` | ``true`` |
  34. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  35. | :ref:`float<class_float>` | :ref:`minimap_opacity<class_GraphEdit_property_minimap_opacity>` | ``0.65`` |
  36. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  37. | :ref:`Vector2<class_Vector2>` | :ref:`minimap_size<class_GraphEdit_property_minimap_size>` | ``Vector2(240, 160)`` |
  38. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  39. | :ref:`PanningScheme<enum_GraphEdit_PanningScheme>` | :ref:`panning_scheme<class_GraphEdit_property_panning_scheme>` | ``0`` |
  40. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`right_disconnects<class_GraphEdit_property_right_disconnects>` | ``false`` |
  42. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  43. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_offset<class_GraphEdit_property_scroll_offset>` | ``Vector2(0, 0)`` |
  44. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`show_arrange_button<class_GraphEdit_property_show_arrange_button>` | ``true`` |
  46. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`show_grid<class_GraphEdit_property_show_grid>` | ``true`` |
  48. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  49. | :ref:`bool<class_bool>` | :ref:`show_grid_buttons<class_GraphEdit_property_show_grid_buttons>` | ``true`` |
  50. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`show_menu<class_GraphEdit_property_show_menu>` | ``true`` |
  52. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`show_minimap_button<class_GraphEdit_property_show_minimap_button>` | ``true`` |
  54. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  55. | :ref:`bool<class_bool>` | :ref:`show_zoom_buttons<class_GraphEdit_property_show_zoom_buttons>` | ``true`` |
  56. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  57. | :ref:`bool<class_bool>` | :ref:`show_zoom_label<class_GraphEdit_property_show_zoom_label>` | ``false`` |
  58. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  59. | :ref:`int<class_int>` | :ref:`snapping_distance<class_GraphEdit_property_snapping_distance>` | ``20`` |
  60. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`snapping_enabled<class_GraphEdit_property_snapping_enabled>` | ``true`` |
  62. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  63. | :ref:`float<class_float>` | :ref:`zoom<class_GraphEdit_property_zoom>` | ``1.0`` |
  64. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  65. | :ref:`float<class_float>` | :ref:`zoom_max<class_GraphEdit_property_zoom_max>` | ``2.0736`` |
  66. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  67. | :ref:`float<class_float>` | :ref:`zoom_min<class_GraphEdit_property_zoom_min>` | ``0.232568`` |
  68. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  69. | :ref:`float<class_float>` | :ref:`zoom_step<class_GraphEdit_property_zoom_step>` | ``1.2`` |
  70. +----------------------------------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  71. .. rst-class:: classref-reftable-group
  72. Methods
  73. -------
  74. .. table::
  75. :widths: auto
  76. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`_get_connection_line<class_GraphEdit_private_method__get_connection_line>` **(** :ref:`Vector2<class_Vector2>` from_position, :ref:`Vector2<class_Vector2>` to_position **)** |virtual| |const| |
  78. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`bool<class_bool>` | :ref:`_is_in_input_hotzone<class_GraphEdit_private_method__is_in_input_hotzone>` **(** :ref:`Object<class_Object>` in_node, :ref:`int<class_int>` in_port, :ref:`Vector2<class_Vector2>` mouse_position **)** |virtual| |
  80. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`bool<class_bool>` | :ref:`_is_in_output_hotzone<class_GraphEdit_private_method__is_in_output_hotzone>` **(** :ref:`Object<class_Object>` in_node, :ref:`int<class_int>` in_port, :ref:`Vector2<class_Vector2>` mouse_position **)** |virtual| |
  82. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`bool<class_bool>` | :ref:`_is_node_hover_valid<class_GraphEdit_private_method__is_node_hover_valid>` **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)** |virtual| |
  84. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`add_valid_connection_type<class_GraphEdit_method_add_valid_connection_type>` **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)** |
  86. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`add_valid_left_disconnect_type<class_GraphEdit_method_add_valid_left_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  88. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`add_valid_right_disconnect_type<class_GraphEdit_method_add_valid_right_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  90. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | void | :ref:`arrange_nodes<class_GraphEdit_method_arrange_nodes>` **(** **)** |
  92. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | void | :ref:`clear_connections<class_GraphEdit_method_clear_connections>` **(** **)** |
  94. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`connect_node<class_GraphEdit_method_connect_node>` **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)** |
  96. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`disconnect_node<class_GraphEdit_method_disconnect_node>` **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)** |
  98. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`force_connection_drag_end<class_GraphEdit_method_force_connection_drag_end>` **(** **)** |
  100. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_connection_line<class_GraphEdit_method_get_connection_line>` **(** :ref:`Vector2<class_Vector2>` from_node, :ref:`Vector2<class_Vector2>` to_node **)** |
  102. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`Dictionary[]<class_Dictionary>` | :ref:`get_connection_list<class_GraphEdit_method_get_connection_list>` **(** **)** |const| |
  104. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`HBoxContainer<class_HBoxContainer>` | :ref:`get_menu_hbox<class_GraphEdit_method_get_menu_hbox>` **(** **)** |
  106. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`bool<class_bool>` | :ref:`is_node_connected<class_GraphEdit_method_is_node_connected>` **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)** |
  108. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`bool<class_bool>` | :ref:`is_valid_connection_type<class_GraphEdit_method_is_valid_connection_type>` **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)** |const| |
  110. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | void | :ref:`remove_valid_connection_type<class_GraphEdit_method_remove_valid_connection_type>` **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)** |
  112. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | void | :ref:`remove_valid_left_disconnect_type<class_GraphEdit_method_remove_valid_left_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  114. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | void | :ref:`remove_valid_right_disconnect_type<class_GraphEdit_method_remove_valid_right_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  116. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | void | :ref:`set_connection_activity<class_GraphEdit_method_set_connection_activity>` **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port, :ref:`float<class_float>` amount **)** |
  118. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | void | :ref:`set_selected<class_GraphEdit_method_set_selected>` **(** :ref:`Node<class_Node>` node **)** |
  120. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. .. rst-class:: classref-reftable-group
  122. Theme Properties
  123. ----------------
  124. .. table::
  125. :widths: auto
  126. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  127. | :ref:`Color<class_Color>` | :ref:`activity<class_GraphEdit_theme_color_activity>` | ``Color(1, 1, 1, 1)`` |
  128. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  129. | :ref:`Color<class_Color>` | :ref:`grid_major<class_GraphEdit_theme_color_grid_major>` | ``Color(1, 1, 1, 0.2)`` |
  130. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  131. | :ref:`Color<class_Color>` | :ref:`grid_minor<class_GraphEdit_theme_color_grid_minor>` | ``Color(1, 1, 1, 0.05)`` |
  132. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  133. | :ref:`Color<class_Color>` | :ref:`selection_fill<class_GraphEdit_theme_color_selection_fill>` | ``Color(1, 1, 1, 0.3)`` |
  134. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  135. | :ref:`Color<class_Color>` | :ref:`selection_stroke<class_GraphEdit_theme_color_selection_stroke>` | ``Color(1, 1, 1, 0.8)`` |
  136. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  137. | :ref:`int<class_int>` | :ref:`port_hotzone_inner_extent<class_GraphEdit_theme_constant_port_hotzone_inner_extent>` | ``22`` |
  138. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  139. | :ref:`int<class_int>` | :ref:`port_hotzone_outer_extent<class_GraphEdit_theme_constant_port_hotzone_outer_extent>` | ``26`` |
  140. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  141. | :ref:`Texture2D<class_Texture2D>` | :ref:`grid_toggle<class_GraphEdit_theme_icon_grid_toggle>` | |
  142. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  143. | :ref:`Texture2D<class_Texture2D>` | :ref:`layout<class_GraphEdit_theme_icon_layout>` | |
  144. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  145. | :ref:`Texture2D<class_Texture2D>` | :ref:`minimap_toggle<class_GraphEdit_theme_icon_minimap_toggle>` | |
  146. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  147. | :ref:`Texture2D<class_Texture2D>` | :ref:`snapping_toggle<class_GraphEdit_theme_icon_snapping_toggle>` | |
  148. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  149. | :ref:`Texture2D<class_Texture2D>` | :ref:`zoom_in<class_GraphEdit_theme_icon_zoom_in>` | |
  150. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  151. | :ref:`Texture2D<class_Texture2D>` | :ref:`zoom_out<class_GraphEdit_theme_icon_zoom_out>` | |
  152. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  153. | :ref:`Texture2D<class_Texture2D>` | :ref:`zoom_reset<class_GraphEdit_theme_icon_zoom_reset>` | |
  154. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  155. | :ref:`StyleBox<class_StyleBox>` | :ref:`menu_panel<class_GraphEdit_theme_style_menu_panel>` | |
  156. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  157. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_GraphEdit_theme_style_panel>` | |
  158. +-----------------------------------+--------------------------------------------------------------------------------------------+--------------------------+
  159. .. rst-class:: classref-section-separator
  160. ----
  161. .. rst-class:: classref-descriptions-group
  162. Signals
  163. -------
  164. .. _class_GraphEdit_signal_begin_node_move:
  165. .. rst-class:: classref-signal
  166. **begin_node_move** **(** **)**
  167. Emitted at the beginning of a GraphNode movement.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_GraphEdit_signal_connection_drag_ended:
  171. .. rst-class:: classref-signal
  172. **connection_drag_ended** **(** **)**
  173. Emitted at the end of a connection drag.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_GraphEdit_signal_connection_drag_started:
  177. .. rst-class:: classref-signal
  178. **connection_drag_started** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`bool<class_bool>` is_output **)**
  179. Emitted at the beginning of a connection drag.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_GraphEdit_signal_connection_from_empty:
  183. .. rst-class:: classref-signal
  184. **connection_from_empty** **(** :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port, :ref:`Vector2<class_Vector2>` release_position **)**
  185. Emitted when user drags a connection from an input port into the empty space of the graph.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_GraphEdit_signal_connection_request:
  189. .. rst-class:: classref-signal
  190. **connection_request** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)**
  191. Emitted to the GraphEdit when the connection between the ``from_port`` of the ``from_node`` :ref:`GraphNode<class_GraphNode>` and the ``to_port`` of the ``to_node`` :ref:`GraphNode<class_GraphNode>` is attempted to be created.
  192. .. rst-class:: classref-item-separator
  193. ----
  194. .. _class_GraphEdit_signal_connection_to_empty:
  195. .. rst-class:: classref-signal
  196. **connection_to_empty** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`Vector2<class_Vector2>` release_position **)**
  197. Emitted when user drags a connection from an output port into the empty space of the graph.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_GraphEdit_signal_copy_nodes_request:
  201. .. rst-class:: classref-signal
  202. **copy_nodes_request** **(** **)**
  203. Emitted when the user presses :kbd:`Ctrl + C`.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_GraphEdit_signal_delete_nodes_request:
  207. .. rst-class:: classref-signal
  208. **delete_nodes_request** **(** :ref:`StringName[]<class_StringName>` nodes **)**
  209. Emitted when attempting to remove a GraphNode from the GraphEdit. Provides a list of node names to be removed (all selected nodes, excluding nodes without closing button).
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_GraphEdit_signal_disconnection_request:
  213. .. rst-class:: classref-signal
  214. **disconnection_request** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)**
  215. Emitted to the GraphEdit when the connection between ``from_port`` of ``from_node`` :ref:`GraphNode<class_GraphNode>` and ``to_port`` of ``to_node`` :ref:`GraphNode<class_GraphNode>` is attempted to be removed.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_GraphEdit_signal_duplicate_nodes_request:
  219. .. rst-class:: classref-signal
  220. **duplicate_nodes_request** **(** **)**
  221. Emitted when a GraphNode is attempted to be duplicated in the GraphEdit.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_GraphEdit_signal_end_node_move:
  225. .. rst-class:: classref-signal
  226. **end_node_move** **(** **)**
  227. Emitted at the end of a GraphNode movement.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_GraphEdit_signal_node_deselected:
  231. .. rst-class:: classref-signal
  232. **node_deselected** **(** :ref:`Node<class_Node>` node **)**
  233. .. container:: contribute
  234. There is currently no description for this signal. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  235. .. rst-class:: classref-item-separator
  236. ----
  237. .. _class_GraphEdit_signal_node_selected:
  238. .. rst-class:: classref-signal
  239. **node_selected** **(** :ref:`Node<class_Node>` node **)**
  240. Emitted when a GraphNode is selected.
  241. .. rst-class:: classref-item-separator
  242. ----
  243. .. _class_GraphEdit_signal_paste_nodes_request:
  244. .. rst-class:: classref-signal
  245. **paste_nodes_request** **(** **)**
  246. Emitted when the user presses :kbd:`Ctrl + V`.
  247. .. rst-class:: classref-item-separator
  248. ----
  249. .. _class_GraphEdit_signal_popup_request:
  250. .. rst-class:: classref-signal
  251. **popup_request** **(** :ref:`Vector2<class_Vector2>` position **)**
  252. Emitted when a popup is requested. Happens on right-clicking in the GraphEdit. ``position`` is the position of the mouse pointer when the signal is sent.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_GraphEdit_signal_scroll_offset_changed:
  256. .. rst-class:: classref-signal
  257. **scroll_offset_changed** **(** :ref:`Vector2<class_Vector2>` offset **)**
  258. Emitted when the scroll offset is changed by the user. It will not be emitted when changed in code.
  259. .. rst-class:: classref-section-separator
  260. ----
  261. .. rst-class:: classref-descriptions-group
  262. Enumerations
  263. ------------
  264. .. _enum_GraphEdit_PanningScheme:
  265. .. rst-class:: classref-enumeration
  266. enum **PanningScheme**:
  267. .. _class_GraphEdit_constant_SCROLL_ZOOMS:
  268. .. rst-class:: classref-enumeration-constant
  269. :ref:`PanningScheme<enum_GraphEdit_PanningScheme>` **SCROLL_ZOOMS** = ``0``
  270. :kbd:`Mouse Wheel` will zoom, :kbd:`Ctrl + Mouse Wheel` will move the view.
  271. .. _class_GraphEdit_constant_SCROLL_PANS:
  272. .. rst-class:: classref-enumeration-constant
  273. :ref:`PanningScheme<enum_GraphEdit_PanningScheme>` **SCROLL_PANS** = ``1``
  274. :kbd:`Mouse Wheel` will move the view, :kbd:`Ctrl + Mouse Wheel` will zoom.
  275. .. rst-class:: classref-section-separator
  276. ----
  277. .. rst-class:: classref-descriptions-group
  278. Property Descriptions
  279. ---------------------
  280. .. _class_GraphEdit_property_connection_lines_antialiased:
  281. .. rst-class:: classref-property
  282. :ref:`bool<class_bool>` **connection_lines_antialiased** = ``true``
  283. .. rst-class:: classref-property-setget
  284. - void **set_connection_lines_antialiased** **(** :ref:`bool<class_bool>` value **)**
  285. - :ref:`bool<class_bool>` **is_connection_lines_antialiased** **(** **)**
  286. If ``true``, the lines between nodes will use antialiasing.
  287. .. rst-class:: classref-item-separator
  288. ----
  289. .. _class_GraphEdit_property_connection_lines_curvature:
  290. .. rst-class:: classref-property
  291. :ref:`float<class_float>` **connection_lines_curvature** = ``0.5``
  292. .. rst-class:: classref-property-setget
  293. - void **set_connection_lines_curvature** **(** :ref:`float<class_float>` value **)**
  294. - :ref:`float<class_float>` **get_connection_lines_curvature** **(** **)**
  295. The curvature of the lines between the nodes. 0 results in straight lines.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_GraphEdit_property_connection_lines_thickness:
  299. .. rst-class:: classref-property
  300. :ref:`float<class_float>` **connection_lines_thickness** = ``2.0``
  301. .. rst-class:: classref-property-setget
  302. - void **set_connection_lines_thickness** **(** :ref:`float<class_float>` value **)**
  303. - :ref:`float<class_float>` **get_connection_lines_thickness** **(** **)**
  304. The thickness of the lines between the nodes.
  305. .. rst-class:: classref-item-separator
  306. ----
  307. .. _class_GraphEdit_property_minimap_enabled:
  308. .. rst-class:: classref-property
  309. :ref:`bool<class_bool>` **minimap_enabled** = ``true``
  310. .. rst-class:: classref-property-setget
  311. - void **set_minimap_enabled** **(** :ref:`bool<class_bool>` value **)**
  312. - :ref:`bool<class_bool>` **is_minimap_enabled** **(** **)**
  313. If ``true``, the minimap is visible.
  314. .. rst-class:: classref-item-separator
  315. ----
  316. .. _class_GraphEdit_property_minimap_opacity:
  317. .. rst-class:: classref-property
  318. :ref:`float<class_float>` **minimap_opacity** = ``0.65``
  319. .. rst-class:: classref-property-setget
  320. - void **set_minimap_opacity** **(** :ref:`float<class_float>` value **)**
  321. - :ref:`float<class_float>` **get_minimap_opacity** **(** **)**
  322. The opacity of the minimap rectangle.
  323. .. rst-class:: classref-item-separator
  324. ----
  325. .. _class_GraphEdit_property_minimap_size:
  326. .. rst-class:: classref-property
  327. :ref:`Vector2<class_Vector2>` **minimap_size** = ``Vector2(240, 160)``
  328. .. rst-class:: classref-property-setget
  329. - void **set_minimap_size** **(** :ref:`Vector2<class_Vector2>` value **)**
  330. - :ref:`Vector2<class_Vector2>` **get_minimap_size** **(** **)**
  331. The size of the minimap rectangle. The map itself is based on the size of the grid area and is scaled to fit this rectangle.
  332. .. rst-class:: classref-item-separator
  333. ----
  334. .. _class_GraphEdit_property_panning_scheme:
  335. .. rst-class:: classref-property
  336. :ref:`PanningScheme<enum_GraphEdit_PanningScheme>` **panning_scheme** = ``0``
  337. .. rst-class:: classref-property-setget
  338. - void **set_panning_scheme** **(** :ref:`PanningScheme<enum_GraphEdit_PanningScheme>` value **)**
  339. - :ref:`PanningScheme<enum_GraphEdit_PanningScheme>` **get_panning_scheme** **(** **)**
  340. Defines the control scheme for panning with mouse wheel.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_GraphEdit_property_right_disconnects:
  344. .. rst-class:: classref-property
  345. :ref:`bool<class_bool>` **right_disconnects** = ``false``
  346. .. rst-class:: classref-property-setget
  347. - void **set_right_disconnects** **(** :ref:`bool<class_bool>` value **)**
  348. - :ref:`bool<class_bool>` **is_right_disconnects_enabled** **(** **)**
  349. If ``true``, enables disconnection of existing connections in the GraphEdit by dragging the right end.
  350. .. rst-class:: classref-item-separator
  351. ----
  352. .. _class_GraphEdit_property_scroll_offset:
  353. .. rst-class:: classref-property
  354. :ref:`Vector2<class_Vector2>` **scroll_offset** = ``Vector2(0, 0)``
  355. .. rst-class:: classref-property-setget
  356. - void **set_scroll_offset** **(** :ref:`Vector2<class_Vector2>` value **)**
  357. - :ref:`Vector2<class_Vector2>` **get_scroll_offset** **(** **)**
  358. The scroll offset.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_GraphEdit_property_show_arrange_button:
  362. .. rst-class:: classref-property
  363. :ref:`bool<class_bool>` **show_arrange_button** = ``true``
  364. .. rst-class:: classref-property-setget
  365. - void **set_show_arrange_button** **(** :ref:`bool<class_bool>` value **)**
  366. - :ref:`bool<class_bool>` **is_showing_arrange_button** **(** **)**
  367. If ``true``, the button to automatically arrange graph nodes is visible.
  368. .. rst-class:: classref-item-separator
  369. ----
  370. .. _class_GraphEdit_property_show_grid:
  371. .. rst-class:: classref-property
  372. :ref:`bool<class_bool>` **show_grid** = ``true``
  373. .. rst-class:: classref-property-setget
  374. - void **set_show_grid** **(** :ref:`bool<class_bool>` value **)**
  375. - :ref:`bool<class_bool>` **is_showing_grid** **(** **)**
  376. If ``true``, the grid is visible.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_GraphEdit_property_show_grid_buttons:
  380. .. rst-class:: classref-property
  381. :ref:`bool<class_bool>` **show_grid_buttons** = ``true``
  382. .. rst-class:: classref-property-setget
  383. - void **set_show_grid_buttons** **(** :ref:`bool<class_bool>` value **)**
  384. - :ref:`bool<class_bool>` **is_showing_grid_buttons** **(** **)**
  385. If ``true``, buttons that allow to configure grid and snapping options are visible.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_GraphEdit_property_show_menu:
  389. .. rst-class:: classref-property
  390. :ref:`bool<class_bool>` **show_menu** = ``true``
  391. .. rst-class:: classref-property-setget
  392. - void **set_show_menu** **(** :ref:`bool<class_bool>` value **)**
  393. - :ref:`bool<class_bool>` **is_showing_menu** **(** **)**
  394. If ``true``, the menu toolbar is visible.
  395. .. rst-class:: classref-item-separator
  396. ----
  397. .. _class_GraphEdit_property_show_minimap_button:
  398. .. rst-class:: classref-property
  399. :ref:`bool<class_bool>` **show_minimap_button** = ``true``
  400. .. rst-class:: classref-property-setget
  401. - void **set_show_minimap_button** **(** :ref:`bool<class_bool>` value **)**
  402. - :ref:`bool<class_bool>` **is_showing_minimap_button** **(** **)**
  403. If ``true``, the button to toggle the minimap is visible.
  404. .. rst-class:: classref-item-separator
  405. ----
  406. .. _class_GraphEdit_property_show_zoom_buttons:
  407. .. rst-class:: classref-property
  408. :ref:`bool<class_bool>` **show_zoom_buttons** = ``true``
  409. .. rst-class:: classref-property-setget
  410. - void **set_show_zoom_buttons** **(** :ref:`bool<class_bool>` value **)**
  411. - :ref:`bool<class_bool>` **is_showing_zoom_buttons** **(** **)**
  412. If ``true``, buttons that allow to change and reset the zoom level are visible.
  413. .. rst-class:: classref-item-separator
  414. ----
  415. .. _class_GraphEdit_property_show_zoom_label:
  416. .. rst-class:: classref-property
  417. :ref:`bool<class_bool>` **show_zoom_label** = ``false``
  418. .. rst-class:: classref-property-setget
  419. - void **set_show_zoom_label** **(** :ref:`bool<class_bool>` value **)**
  420. - :ref:`bool<class_bool>` **is_showing_zoom_label** **(** **)**
  421. If ``true``, the label with the current zoom level is visible. The zoom level is displayed in percents.
  422. .. rst-class:: classref-item-separator
  423. ----
  424. .. _class_GraphEdit_property_snapping_distance:
  425. .. rst-class:: classref-property
  426. :ref:`int<class_int>` **snapping_distance** = ``20``
  427. .. rst-class:: classref-property-setget
  428. - void **set_snapping_distance** **(** :ref:`int<class_int>` value **)**
  429. - :ref:`int<class_int>` **get_snapping_distance** **(** **)**
  430. The snapping distance in pixels, also determines the grid line distance.
  431. .. rst-class:: classref-item-separator
  432. ----
  433. .. _class_GraphEdit_property_snapping_enabled:
  434. .. rst-class:: classref-property
  435. :ref:`bool<class_bool>` **snapping_enabled** = ``true``
  436. .. rst-class:: classref-property-setget
  437. - void **set_snapping_enabled** **(** :ref:`bool<class_bool>` value **)**
  438. - :ref:`bool<class_bool>` **is_snapping_enabled** **(** **)**
  439. If ``true``, enables snapping.
  440. .. rst-class:: classref-item-separator
  441. ----
  442. .. _class_GraphEdit_property_zoom:
  443. .. rst-class:: classref-property
  444. :ref:`float<class_float>` **zoom** = ``1.0``
  445. .. rst-class:: classref-property-setget
  446. - void **set_zoom** **(** :ref:`float<class_float>` value **)**
  447. - :ref:`float<class_float>` **get_zoom** **(** **)**
  448. The current zoom value.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _class_GraphEdit_property_zoom_max:
  452. .. rst-class:: classref-property
  453. :ref:`float<class_float>` **zoom_max** = ``2.0736``
  454. .. rst-class:: classref-property-setget
  455. - void **set_zoom_max** **(** :ref:`float<class_float>` value **)**
  456. - :ref:`float<class_float>` **get_zoom_max** **(** **)**
  457. The upper zoom limit.
  458. .. rst-class:: classref-item-separator
  459. ----
  460. .. _class_GraphEdit_property_zoom_min:
  461. .. rst-class:: classref-property
  462. :ref:`float<class_float>` **zoom_min** = ``0.232568``
  463. .. rst-class:: classref-property-setget
  464. - void **set_zoom_min** **(** :ref:`float<class_float>` value **)**
  465. - :ref:`float<class_float>` **get_zoom_min** **(** **)**
  466. The lower zoom limit.
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_GraphEdit_property_zoom_step:
  470. .. rst-class:: classref-property
  471. :ref:`float<class_float>` **zoom_step** = ``1.2``
  472. .. rst-class:: classref-property-setget
  473. - void **set_zoom_step** **(** :ref:`float<class_float>` value **)**
  474. - :ref:`float<class_float>` **get_zoom_step** **(** **)**
  475. The step of each zoom level.
  476. .. rst-class:: classref-section-separator
  477. ----
  478. .. rst-class:: classref-descriptions-group
  479. Method Descriptions
  480. -------------------
  481. .. _class_GraphEdit_private_method__get_connection_line:
  482. .. rst-class:: classref-method
  483. :ref:`PackedVector2Array<class_PackedVector2Array>` **_get_connection_line** **(** :ref:`Vector2<class_Vector2>` from_position, :ref:`Vector2<class_Vector2>` to_position **)** |virtual| |const|
  484. Virtual method which can be overridden to customize how connections are drawn.
  485. .. rst-class:: classref-item-separator
  486. ----
  487. .. _class_GraphEdit_private_method__is_in_input_hotzone:
  488. .. rst-class:: classref-method
  489. :ref:`bool<class_bool>` **_is_in_input_hotzone** **(** :ref:`Object<class_Object>` in_node, :ref:`int<class_int>` in_port, :ref:`Vector2<class_Vector2>` mouse_position **)** |virtual|
  490. Returns whether the ``mouse_position`` is in the input hot zone.
  491. By default, a hot zone is a :ref:`Rect2<class_Rect2>` positioned such that its center is at ``in_node``.\ :ref:`GraphNode.get_input_port_position<class_GraphNode_method_get_input_port_position>`\ (``in_port``) (For output's case, call :ref:`GraphNode.get_output_port_position<class_GraphNode_method_get_output_port_position>` instead). The hot zone's width is twice the Theme Property ``port_grab_distance_horizontal``, and its height is twice the ``port_grab_distance_vertical``.
  492. Below is a sample code to help get started:
  493. ::
  494. func _is_in_input_hotzone(in_node, in_port, mouse_position):
  495. var port_size: Vector2 = Vector2(get_theme_constant("port_grab_distance_horizontal"), get_theme_constant("port_grab_distance_vertical"))
  496. var port_pos: Vector2 = in_node.get_position() + in_node.get_input_port_position(in_port) - port_size / 2
  497. var rect = Rect2(port_pos, port_size)
  498. return rect.has_point(mouse_position)
  499. .. rst-class:: classref-item-separator
  500. ----
  501. .. _class_GraphEdit_private_method__is_in_output_hotzone:
  502. .. rst-class:: classref-method
  503. :ref:`bool<class_bool>` **_is_in_output_hotzone** **(** :ref:`Object<class_Object>` in_node, :ref:`int<class_int>` in_port, :ref:`Vector2<class_Vector2>` mouse_position **)** |virtual|
  504. Returns whether the ``mouse_position`` is in the output hot zone. For more information on hot zones, see :ref:`_is_in_input_hotzone<class_GraphEdit_private_method__is_in_input_hotzone>`.
  505. Below is a sample code to help get started:
  506. ::
  507. func _is_in_output_hotzone(in_node, in_port, mouse_position):
  508. var port_size: Vector2 = Vector2(get_theme_constant("port_grab_distance_horizontal"), get_theme_constant("port_grab_distance_vertical"))
  509. var port_pos: Vector2 = in_node.get_position() + in_node.get_output_port_position(in_port) - port_size / 2
  510. var rect = Rect2(port_pos, port_size)
  511. return rect.has_point(mouse_position)
  512. .. rst-class:: classref-item-separator
  513. ----
  514. .. _class_GraphEdit_private_method__is_node_hover_valid:
  515. .. rst-class:: classref-method
  516. :ref:`bool<class_bool>` **_is_node_hover_valid** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)** |virtual|
  517. This virtual method can be used to insert additional error detection while the user is dragging a connection over a valid port.
  518. Return ``true`` if the connection is indeed valid or return ``false`` if the connection is impossible. If the connection is impossible, no snapping to the port and thus no connection request to that port will happen.
  519. In this example a connection to same node is suppressed:
  520. .. tabs::
  521. .. code-tab:: gdscript
  522. func _is_node_hover_valid(from, from_port, to, to_port):
  523. return from != to
  524. .. code-tab:: csharp
  525. public override bool _IsNodeHoverValid(StringName fromNode, int fromPort, StringName toNode, int toPort)
  526. {
  527. return fromNode != toNode;
  528. }
  529. .. rst-class:: classref-item-separator
  530. ----
  531. .. _class_GraphEdit_method_add_valid_connection_type:
  532. .. rst-class:: classref-method
  533. void **add_valid_connection_type** **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)**
  534. Allows the connection between two different port types. The port type is defined individually for the left and the right port of each slot with the :ref:`GraphNode.set_slot<class_GraphNode_method_set_slot>` method.
  535. See also :ref:`is_valid_connection_type<class_GraphEdit_method_is_valid_connection_type>` and :ref:`remove_valid_connection_type<class_GraphEdit_method_remove_valid_connection_type>`.
  536. .. rst-class:: classref-item-separator
  537. ----
  538. .. _class_GraphEdit_method_add_valid_left_disconnect_type:
  539. .. rst-class:: classref-method
  540. void **add_valid_left_disconnect_type** **(** :ref:`int<class_int>` type **)**
  541. Allows to disconnect nodes when dragging from the left port of the :ref:`GraphNode<class_GraphNode>`'s slot if it has the specified type. See also :ref:`remove_valid_left_disconnect_type<class_GraphEdit_method_remove_valid_left_disconnect_type>`.
  542. .. rst-class:: classref-item-separator
  543. ----
  544. .. _class_GraphEdit_method_add_valid_right_disconnect_type:
  545. .. rst-class:: classref-method
  546. void **add_valid_right_disconnect_type** **(** :ref:`int<class_int>` type **)**
  547. Allows to disconnect nodes when dragging from the right port of the :ref:`GraphNode<class_GraphNode>`'s slot if it has the specified type. See also :ref:`remove_valid_right_disconnect_type<class_GraphEdit_method_remove_valid_right_disconnect_type>`.
  548. .. rst-class:: classref-item-separator
  549. ----
  550. .. _class_GraphEdit_method_arrange_nodes:
  551. .. rst-class:: classref-method
  552. void **arrange_nodes** **(** **)**
  553. Rearranges selected nodes in a layout with minimum crossings between connections and uniform horizontal and vertical gap between nodes.
  554. .. rst-class:: classref-item-separator
  555. ----
  556. .. _class_GraphEdit_method_clear_connections:
  557. .. rst-class:: classref-method
  558. void **clear_connections** **(** **)**
  559. Removes all connections between nodes.
  560. .. rst-class:: classref-item-separator
  561. ----
  562. .. _class_GraphEdit_method_connect_node:
  563. .. rst-class:: classref-method
  564. :ref:`Error<enum_@GlobalScope_Error>` **connect_node** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)**
  565. Create a connection between the ``from_port`` of the ``from_node`` :ref:`GraphNode<class_GraphNode>` and the ``to_port`` of the ``to_node`` :ref:`GraphNode<class_GraphNode>`. If the connection already exists, no connection is created.
  566. .. rst-class:: classref-item-separator
  567. ----
  568. .. _class_GraphEdit_method_disconnect_node:
  569. .. rst-class:: classref-method
  570. void **disconnect_node** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)**
  571. Removes the connection between the ``from_port`` of the ``from_node`` :ref:`GraphNode<class_GraphNode>` and the ``to_port`` of the ``to_node`` :ref:`GraphNode<class_GraphNode>`. If the connection does not exist, no connection is removed.
  572. .. rst-class:: classref-item-separator
  573. ----
  574. .. _class_GraphEdit_method_force_connection_drag_end:
  575. .. rst-class:: classref-method
  576. void **force_connection_drag_end** **(** **)**
  577. Ends the creation of the current connection. In other words, if you are dragging a connection you can use this method to abort the process and remove the line that followed your cursor.
  578. This is best used together with :ref:`connection_drag_started<class_GraphEdit_signal_connection_drag_started>` and :ref:`connection_drag_ended<class_GraphEdit_signal_connection_drag_ended>` to add custom behavior like node addition through shortcuts.
  579. \ **Note:** This method suppresses any other connection request signals apart from :ref:`connection_drag_ended<class_GraphEdit_signal_connection_drag_ended>`.
  580. .. rst-class:: classref-item-separator
  581. ----
  582. .. _class_GraphEdit_method_get_connection_line:
  583. .. rst-class:: classref-method
  584. :ref:`PackedVector2Array<class_PackedVector2Array>` **get_connection_line** **(** :ref:`Vector2<class_Vector2>` from_node, :ref:`Vector2<class_Vector2>` to_node **)**
  585. Returns the points which would make up a connection between ``from_node`` and ``to_node``.
  586. .. rst-class:: classref-item-separator
  587. ----
  588. .. _class_GraphEdit_method_get_connection_list:
  589. .. rst-class:: classref-method
  590. :ref:`Dictionary[]<class_Dictionary>` **get_connection_list** **(** **)** |const|
  591. Returns an Array containing the list of connections. A connection consists in a structure of the form ``{ from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }``.
  592. .. rst-class:: classref-item-separator
  593. ----
  594. .. _class_GraphEdit_method_get_menu_hbox:
  595. .. rst-class:: classref-method
  596. :ref:`HBoxContainer<class_HBoxContainer>` **get_menu_hbox** **(** **)**
  597. Gets the :ref:`HBoxContainer<class_HBoxContainer>` that contains the zooming and grid snap controls in the top left of the graph. You can use this method to reposition the toolbar or to add your own custom controls to it.
  598. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  599. .. rst-class:: classref-item-separator
  600. ----
  601. .. _class_GraphEdit_method_is_node_connected:
  602. .. rst-class:: classref-method
  603. :ref:`bool<class_bool>` **is_node_connected** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port **)**
  604. Returns ``true`` if the ``from_port`` of the ``from_node`` :ref:`GraphNode<class_GraphNode>` is connected to the ``to_port`` of the ``to_node`` :ref:`GraphNode<class_GraphNode>`.
  605. .. rst-class:: classref-item-separator
  606. ----
  607. .. _class_GraphEdit_method_is_valid_connection_type:
  608. .. rst-class:: classref-method
  609. :ref:`bool<class_bool>` **is_valid_connection_type** **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)** |const|
  610. Returns whether it's possible to make a connection between two different port types. The port type is defined individually for the left and the right port of each slot with the :ref:`GraphNode.set_slot<class_GraphNode_method_set_slot>` method.
  611. See also :ref:`add_valid_connection_type<class_GraphEdit_method_add_valid_connection_type>` and :ref:`remove_valid_connection_type<class_GraphEdit_method_remove_valid_connection_type>`.
  612. .. rst-class:: classref-item-separator
  613. ----
  614. .. _class_GraphEdit_method_remove_valid_connection_type:
  615. .. rst-class:: classref-method
  616. void **remove_valid_connection_type** **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)**
  617. Disallows the connection between two different port types previously allowed by :ref:`add_valid_connection_type<class_GraphEdit_method_add_valid_connection_type>`. The port type is defined individually for the left and the right port of each slot with the :ref:`GraphNode.set_slot<class_GraphNode_method_set_slot>` method.
  618. See also :ref:`is_valid_connection_type<class_GraphEdit_method_is_valid_connection_type>`.
  619. .. rst-class:: classref-item-separator
  620. ----
  621. .. _class_GraphEdit_method_remove_valid_left_disconnect_type:
  622. .. rst-class:: classref-method
  623. void **remove_valid_left_disconnect_type** **(** :ref:`int<class_int>` type **)**
  624. Disallows to disconnect nodes when dragging from the left port of the :ref:`GraphNode<class_GraphNode>`'s slot if it has the specified type. Use this to disable disconnection previously allowed with :ref:`add_valid_left_disconnect_type<class_GraphEdit_method_add_valid_left_disconnect_type>`.
  625. .. rst-class:: classref-item-separator
  626. ----
  627. .. _class_GraphEdit_method_remove_valid_right_disconnect_type:
  628. .. rst-class:: classref-method
  629. void **remove_valid_right_disconnect_type** **(** :ref:`int<class_int>` type **)**
  630. Disallows to disconnect nodes when dragging from the right port of the :ref:`GraphNode<class_GraphNode>`'s slot if it has the specified type. Use this to disable disconnection previously allowed with :ref:`add_valid_right_disconnect_type<class_GraphEdit_method_add_valid_right_disconnect_type>`.
  631. .. rst-class:: classref-item-separator
  632. ----
  633. .. _class_GraphEdit_method_set_connection_activity:
  634. .. rst-class:: classref-method
  635. void **set_connection_activity** **(** :ref:`StringName<class_StringName>` from_node, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to_node, :ref:`int<class_int>` to_port, :ref:`float<class_float>` amount **)**
  636. Sets the coloration of the connection between ``from_node``'s ``from_port`` and ``to_node``'s ``to_port`` with the color provided in the :ref:`activity<class_GraphEdit_theme_color_activity>` theme property. The color is linearly interpolated between the connection color and the activity color using ``amount`` as weight.
  637. .. rst-class:: classref-item-separator
  638. ----
  639. .. _class_GraphEdit_method_set_selected:
  640. .. rst-class:: classref-method
  641. void **set_selected** **(** :ref:`Node<class_Node>` node **)**
  642. Sets the specified ``node`` as the one selected.
  643. .. rst-class:: classref-section-separator
  644. ----
  645. .. rst-class:: classref-descriptions-group
  646. Theme Property Descriptions
  647. ---------------------------
  648. .. _class_GraphEdit_theme_color_activity:
  649. .. rst-class:: classref-themeproperty
  650. :ref:`Color<class_Color>` **activity** = ``Color(1, 1, 1, 1)``
  651. Color of the connection's activity (see :ref:`set_connection_activity<class_GraphEdit_method_set_connection_activity>`).
  652. .. rst-class:: classref-item-separator
  653. ----
  654. .. _class_GraphEdit_theme_color_grid_major:
  655. .. rst-class:: classref-themeproperty
  656. :ref:`Color<class_Color>` **grid_major** = ``Color(1, 1, 1, 0.2)``
  657. Color of major grid lines.
  658. .. rst-class:: classref-item-separator
  659. ----
  660. .. _class_GraphEdit_theme_color_grid_minor:
  661. .. rst-class:: classref-themeproperty
  662. :ref:`Color<class_Color>` **grid_minor** = ``Color(1, 1, 1, 0.05)``
  663. Color of minor grid lines.
  664. .. rst-class:: classref-item-separator
  665. ----
  666. .. _class_GraphEdit_theme_color_selection_fill:
  667. .. rst-class:: classref-themeproperty
  668. :ref:`Color<class_Color>` **selection_fill** = ``Color(1, 1, 1, 0.3)``
  669. The fill color of the selection rectangle.
  670. .. rst-class:: classref-item-separator
  671. ----
  672. .. _class_GraphEdit_theme_color_selection_stroke:
  673. .. rst-class:: classref-themeproperty
  674. :ref:`Color<class_Color>` **selection_stroke** = ``Color(1, 1, 1, 0.8)``
  675. The outline color of the selection rectangle.
  676. .. rst-class:: classref-item-separator
  677. ----
  678. .. _class_GraphEdit_theme_constant_port_hotzone_inner_extent:
  679. .. rst-class:: classref-themeproperty
  680. :ref:`int<class_int>` **port_hotzone_inner_extent** = ``22``
  681. The horizontal range within which a port can be grabbed (inner side).
  682. .. rst-class:: classref-item-separator
  683. ----
  684. .. _class_GraphEdit_theme_constant_port_hotzone_outer_extent:
  685. .. rst-class:: classref-themeproperty
  686. :ref:`int<class_int>` **port_hotzone_outer_extent** = ``26``
  687. The horizontal range within which a port can be grabbed (outer side).
  688. .. rst-class:: classref-item-separator
  689. ----
  690. .. _class_GraphEdit_theme_icon_grid_toggle:
  691. .. rst-class:: classref-themeproperty
  692. :ref:`Texture2D<class_Texture2D>` **grid_toggle**
  693. The icon for the grid toggle button.
  694. .. rst-class:: classref-item-separator
  695. ----
  696. .. _class_GraphEdit_theme_icon_layout:
  697. .. rst-class:: classref-themeproperty
  698. :ref:`Texture2D<class_Texture2D>` **layout**
  699. The icon for the layout button for auto-arranging the graph.
  700. .. rst-class:: classref-item-separator
  701. ----
  702. .. _class_GraphEdit_theme_icon_minimap_toggle:
  703. .. rst-class:: classref-themeproperty
  704. :ref:`Texture2D<class_Texture2D>` **minimap_toggle**
  705. The icon for the minimap toggle button.
  706. .. rst-class:: classref-item-separator
  707. ----
  708. .. _class_GraphEdit_theme_icon_snapping_toggle:
  709. .. rst-class:: classref-themeproperty
  710. :ref:`Texture2D<class_Texture2D>` **snapping_toggle**
  711. The icon for the snapping toggle button.
  712. .. rst-class:: classref-item-separator
  713. ----
  714. .. _class_GraphEdit_theme_icon_zoom_in:
  715. .. rst-class:: classref-themeproperty
  716. :ref:`Texture2D<class_Texture2D>` **zoom_in**
  717. The icon for the zoom in button.
  718. .. rst-class:: classref-item-separator
  719. ----
  720. .. _class_GraphEdit_theme_icon_zoom_out:
  721. .. rst-class:: classref-themeproperty
  722. :ref:`Texture2D<class_Texture2D>` **zoom_out**
  723. The icon for the zoom out button.
  724. .. rst-class:: classref-item-separator
  725. ----
  726. .. _class_GraphEdit_theme_icon_zoom_reset:
  727. .. rst-class:: classref-themeproperty
  728. :ref:`Texture2D<class_Texture2D>` **zoom_reset**
  729. The icon for the zoom reset button.
  730. .. rst-class:: classref-item-separator
  731. ----
  732. .. _class_GraphEdit_theme_style_menu_panel:
  733. .. rst-class:: classref-themeproperty
  734. :ref:`StyleBox<class_StyleBox>` **menu_panel**
  735. .. container:: contribute
  736. There is currently no description for this theme property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  737. .. rst-class:: classref-item-separator
  738. ----
  739. .. _class_GraphEdit_theme_style_panel:
  740. .. rst-class:: classref-themeproperty
  741. :ref:`StyleBox<class_StyleBox>` **panel**
  742. The background drawn under the grid.
  743. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  744. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  745. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  746. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  747. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  748. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  749. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`