class_graphedit.rst 67 KB

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