class_graphedit.rst 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the GraphEdit.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_GraphEdit:
  6. GraphEdit
  7. =========
  8. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. GraphEdit is an area capable of showing various GraphNodes. It manages connection events between them.
  10. Description
  11. -----------
  12. GraphEdit manages the showing of GraphNodes it contains, as well as connections and disconnections between them. Signals are sent for each of these two events. Disconnection between GraphNode slots is disabled by default.
  13. 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.
  14. Properties
  15. ----------
  16. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`connection_lines_antialiased<class_GraphEdit_property_connection_lines_antialiased>` | ``true`` |
  18. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  19. | :ref:`float<class_float>` | :ref:`connection_lines_thickness<class_GraphEdit_property_connection_lines_thickness>` | ``2.0`` |
  20. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  21. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` *(parent override)* |
  22. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`minimap_enabled<class_GraphEdit_property_minimap_enabled>` | ``true`` |
  24. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  25. | :ref:`float<class_float>` | :ref:`minimap_opacity<class_GraphEdit_property_minimap_opacity>` | ``0.65`` |
  26. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  27. | :ref:`Vector2<class_Vector2>` | :ref:`minimap_size<class_GraphEdit_property_minimap_size>` | ``Vector2(240, 160)`` |
  28. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  29. | :ref:`bool<class_bool>` | rect_clip_content | ``true`` *(parent override)* |
  30. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`right_disconnects<class_GraphEdit_property_right_disconnects>` | ``false`` |
  32. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  33. | :ref:`Vector2<class_Vector2>` | :ref:`scroll_offset<class_GraphEdit_property_scroll_offset>` | ``Vector2(0, 0)`` |
  34. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`show_zoom_label<class_GraphEdit_property_show_zoom_label>` | ``false`` |
  36. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  37. | :ref:`int<class_int>` | :ref:`snap_distance<class_GraphEdit_property_snap_distance>` | ``20`` |
  38. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`use_snap<class_GraphEdit_property_use_snap>` | ``true`` |
  40. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  41. | :ref:`float<class_float>` | :ref:`zoom<class_GraphEdit_property_zoom>` | ``1.0`` |
  42. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  43. | :ref:`float<class_float>` | :ref:`zoom_max<class_GraphEdit_property_zoom_max>` | ``2.0736`` |
  44. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  45. | :ref:`float<class_float>` | :ref:`zoom_min<class_GraphEdit_property_zoom_min>` | ``0.232568`` |
  46. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  47. | :ref:`float<class_float>` | :ref:`zoom_step<class_GraphEdit_property_zoom_step>` | ``1.2`` |
  48. +------------------------------------------+--------------------------------------------------------------------------------------------+------------------------------+
  49. Methods
  50. -------
  51. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`_get_connection_line<class_GraphEdit_method__get_connection_line>` **(** :ref:`Vector2<class_Vector2>` from, :ref:`Vector2<class_Vector2>` to **)** |virtual| |const| |
  53. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | 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 **)** |
  55. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`add_valid_left_disconnect_type<class_GraphEdit_method_add_valid_left_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  57. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`add_valid_right_disconnect_type<class_GraphEdit_method_add_valid_right_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  59. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`arrange_nodes<class_GraphEdit_method_arrange_nodes>` **(** **)** |
  61. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`clear_connections<class_GraphEdit_method_clear_connections>` **(** **)** |
  63. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`connect_node<class_GraphEdit_method_connect_node>` **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port **)** |
  65. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | void | :ref:`disconnect_node<class_GraphEdit_method_disconnect_node>` **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port **)** |
  67. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_connection_line<class_GraphEdit_method_get_connection_line>` **(** :ref:`Vector2<class_Vector2>` from, :ref:`Vector2<class_Vector2>` to **)** |
  69. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Array<class_Array>` | :ref:`get_connection_list<class_GraphEdit_method_get_connection_list>` **(** **)** |const| |
  71. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`HBoxContainer<class_HBoxContainer>` | :ref:`get_zoom_hbox<class_GraphEdit_method_get_zoom_hbox>` **(** **)** |
  73. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`bool<class_bool>` | :ref:`is_node_connected<class_GraphEdit_method_is_node_connected>` **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port **)** |
  75. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :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| |
  77. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | 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 **)** |
  79. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`remove_valid_left_disconnect_type<class_GraphEdit_method_remove_valid_left_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  81. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`remove_valid_right_disconnect_type<class_GraphEdit_method_remove_valid_right_disconnect_type>` **(** :ref:`int<class_int>` type **)** |
  83. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`set_connection_activity<class_GraphEdit_method_set_connection_activity>` **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port, :ref:`float<class_float>` amount **)** |
  85. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`set_selected<class_GraphEdit_method_set_selected>` **(** :ref:`Node<class_Node>` node **)** |
  87. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. Theme Properties
  89. ----------------
  90. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  91. | :ref:`Color<class_Color>` | :ref:`activity<class_GraphEdit_theme_color_activity>` | ``Color(1, 1, 1, 1)`` |
  92. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  93. | :ref:`int<class_int>` | :ref:`bezier_len_neg<class_GraphEdit_theme_constant_bezier_len_neg>` | ``160`` |
  94. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  95. | :ref:`int<class_int>` | :ref:`bezier_len_pos<class_GraphEdit_theme_constant_bezier_len_pos>` | ``80`` |
  96. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  97. | :ref:`StyleBox<class_StyleBox>` | :ref:`bg<class_GraphEdit_theme_style_bg>` | |
  98. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  99. | :ref:`Color<class_Color>` | :ref:`grid_major<class_GraphEdit_theme_color_grid_major>` | ``Color(1, 1, 1, 0.2)`` |
  100. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  101. | :ref:`Color<class_Color>` | :ref:`grid_minor<class_GraphEdit_theme_color_grid_minor>` | ``Color(1, 1, 1, 0.05)`` |
  102. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  103. | :ref:`Texture2D<class_Texture2D>` | :ref:`layout<class_GraphEdit_theme_icon_layout>` | |
  104. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  105. | :ref:`Texture2D<class_Texture2D>` | :ref:`minimap<class_GraphEdit_theme_icon_minimap>` | |
  106. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  107. | :ref:`Texture2D<class_Texture2D>` | :ref:`minus<class_GraphEdit_theme_icon_minus>` | |
  108. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  109. | :ref:`Texture2D<class_Texture2D>` | :ref:`more<class_GraphEdit_theme_icon_more>` | |
  110. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  111. | :ref:`int<class_int>` | :ref:`port_grab_distance_horizontal<class_GraphEdit_theme_constant_port_grab_distance_horizontal>` | ``24`` |
  112. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  113. | :ref:`int<class_int>` | :ref:`port_grab_distance_vertical<class_GraphEdit_theme_constant_port_grab_distance_vertical>` | ``6`` |
  114. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  115. | :ref:`Texture2D<class_Texture2D>` | :ref:`reset<class_GraphEdit_theme_icon_reset>` | |
  116. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  117. | :ref:`Color<class_Color>` | :ref:`selection_fill<class_GraphEdit_theme_color_selection_fill>` | ``Color(1, 1, 1, 0.3)`` |
  118. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  119. | :ref:`Color<class_Color>` | :ref:`selection_stroke<class_GraphEdit_theme_color_selection_stroke>` | ``Color(1, 1, 1, 0.8)`` |
  120. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  121. | :ref:`Texture2D<class_Texture2D>` | :ref:`snap<class_GraphEdit_theme_icon_snap>` | |
  122. +-----------------------------------+----------------------------------------------------------------------------------------------------+--------------------------+
  123. Signals
  124. -------
  125. .. _class_GraphEdit_signal_begin_node_move:
  126. - **begin_node_move** **(** **)**
  127. Emitted at the beginning of a GraphNode movement.
  128. ----
  129. .. _class_GraphEdit_signal_connection_from_empty:
  130. - **connection_from_empty** **(** :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_slot, :ref:`Vector2<class_Vector2>` release_position **)**
  131. Emitted when user dragging connection from input port into empty space of the graph.
  132. ----
  133. .. _class_GraphEdit_signal_connection_request:
  134. - **connection_request** **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_slot, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_slot **)**
  135. Emitted to the GraphEdit when the connection between the ``from_slot`` slot of the ``from`` GraphNode and the ``to_slot`` slot of the ``to`` GraphNode is attempted to be created.
  136. ----
  137. .. _class_GraphEdit_signal_connection_to_empty:
  138. - **connection_to_empty** **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_slot, :ref:`Vector2<class_Vector2>` release_position **)**
  139. Emitted when user dragging connection from output port into empty space of the graph.
  140. ----
  141. .. _class_GraphEdit_signal_copy_nodes_request:
  142. - **copy_nodes_request** **(** **)**
  143. Emitted when the user presses :kbd:`Ctrl + C`.
  144. ----
  145. .. _class_GraphEdit_signal_delete_nodes_request:
  146. - **delete_nodes_request** **(** **)**
  147. Emitted when a GraphNode is attempted to be removed from the GraphEdit.
  148. ----
  149. .. _class_GraphEdit_signal_disconnection_request:
  150. - **disconnection_request** **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_slot, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_slot **)**
  151. Emitted to the GraphEdit when the connection between ``from_slot`` slot of ``from`` GraphNode and ``to_slot`` slot of ``to`` GraphNode is attempted to be removed.
  152. ----
  153. .. _class_GraphEdit_signal_duplicate_nodes_request:
  154. - **duplicate_nodes_request** **(** **)**
  155. Emitted when a GraphNode is attempted to be duplicated in the GraphEdit.
  156. ----
  157. .. _class_GraphEdit_signal_end_node_move:
  158. - **end_node_move** **(** **)**
  159. Emitted at the end of a GraphNode movement.
  160. ----
  161. .. _class_GraphEdit_signal_node_deselected:
  162. - **node_deselected** **(** :ref:`Node<class_Node>` node **)**
  163. ----
  164. .. _class_GraphEdit_signal_node_selected:
  165. - **node_selected** **(** :ref:`Node<class_Node>` node **)**
  166. Emitted when a GraphNode is selected.
  167. ----
  168. .. _class_GraphEdit_signal_paste_nodes_request:
  169. - **paste_nodes_request** **(** **)**
  170. Emitted when the user presses :kbd:`Ctrl + V`.
  171. ----
  172. .. _class_GraphEdit_signal_popup_request:
  173. - **popup_request** **(** :ref:`Vector2<class_Vector2>` position **)**
  174. 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.
  175. ----
  176. .. _class_GraphEdit_signal_scroll_offset_changed:
  177. - **scroll_offset_changed** **(** :ref:`Vector2<class_Vector2>` ofs **)**
  178. Emitted when the scroll offset is changed by the user. It will not be emitted when changed in code.
  179. Property Descriptions
  180. ---------------------
  181. .. _class_GraphEdit_property_connection_lines_antialiased:
  182. - :ref:`bool<class_bool>` **connection_lines_antialiased**
  183. +-----------+-----------------------------------------+
  184. | *Default* | ``true`` |
  185. +-----------+-----------------------------------------+
  186. | *Setter* | set_connection_lines_antialiased(value) |
  187. +-----------+-----------------------------------------+
  188. | *Getter* | is_connection_lines_antialiased() |
  189. +-----------+-----------------------------------------+
  190. If ``true``, the lines between nodes will use antialiasing.
  191. ----
  192. .. _class_GraphEdit_property_connection_lines_thickness:
  193. - :ref:`float<class_float>` **connection_lines_thickness**
  194. +-----------+---------------------------------------+
  195. | *Default* | ``2.0`` |
  196. +-----------+---------------------------------------+
  197. | *Setter* | set_connection_lines_thickness(value) |
  198. +-----------+---------------------------------------+
  199. | *Getter* | get_connection_lines_thickness() |
  200. +-----------+---------------------------------------+
  201. The thickness of the lines between the nodes.
  202. ----
  203. .. _class_GraphEdit_property_minimap_enabled:
  204. - :ref:`bool<class_bool>` **minimap_enabled**
  205. +-----------+----------------------------+
  206. | *Default* | ``true`` |
  207. +-----------+----------------------------+
  208. | *Setter* | set_minimap_enabled(value) |
  209. +-----------+----------------------------+
  210. | *Getter* | is_minimap_enabled() |
  211. +-----------+----------------------------+
  212. If ``true``, the minimap is visible.
  213. ----
  214. .. _class_GraphEdit_property_minimap_opacity:
  215. - :ref:`float<class_float>` **minimap_opacity**
  216. +-----------+----------------------------+
  217. | *Default* | ``0.65`` |
  218. +-----------+----------------------------+
  219. | *Setter* | set_minimap_opacity(value) |
  220. +-----------+----------------------------+
  221. | *Getter* | get_minimap_opacity() |
  222. +-----------+----------------------------+
  223. The opacity of the minimap rectangle.
  224. ----
  225. .. _class_GraphEdit_property_minimap_size:
  226. - :ref:`Vector2<class_Vector2>` **minimap_size**
  227. +-----------+-------------------------+
  228. | *Default* | ``Vector2(240, 160)`` |
  229. +-----------+-------------------------+
  230. | *Setter* | set_minimap_size(value) |
  231. +-----------+-------------------------+
  232. | *Getter* | get_minimap_size() |
  233. +-----------+-------------------------+
  234. 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.
  235. ----
  236. .. _class_GraphEdit_property_right_disconnects:
  237. - :ref:`bool<class_bool>` **right_disconnects**
  238. +-----------+--------------------------------+
  239. | *Default* | ``false`` |
  240. +-----------+--------------------------------+
  241. | *Setter* | set_right_disconnects(value) |
  242. +-----------+--------------------------------+
  243. | *Getter* | is_right_disconnects_enabled() |
  244. +-----------+--------------------------------+
  245. If ``true``, enables disconnection of existing connections in the GraphEdit by dragging the right end.
  246. ----
  247. .. _class_GraphEdit_property_scroll_offset:
  248. - :ref:`Vector2<class_Vector2>` **scroll_offset**
  249. +-----------+-----------------------+
  250. | *Default* | ``Vector2(0, 0)`` |
  251. +-----------+-----------------------+
  252. | *Setter* | set_scroll_ofs(value) |
  253. +-----------+-----------------------+
  254. | *Getter* | get_scroll_ofs() |
  255. +-----------+-----------------------+
  256. The scroll offset.
  257. ----
  258. .. _class_GraphEdit_property_show_zoom_label:
  259. - :ref:`bool<class_bool>` **show_zoom_label**
  260. +-----------+----------------------------+
  261. | *Default* | ``false`` |
  262. +-----------+----------------------------+
  263. | *Setter* | set_show_zoom_label(value) |
  264. +-----------+----------------------------+
  265. | *Getter* | is_showing_zoom_label() |
  266. +-----------+----------------------------+
  267. If ``true``, makes a label with the current zoom level visible. The zoom value is displayed in percents.
  268. ----
  269. .. _class_GraphEdit_property_snap_distance:
  270. - :ref:`int<class_int>` **snap_distance**
  271. +-----------+-----------------+
  272. | *Default* | ``20`` |
  273. +-----------+-----------------+
  274. | *Setter* | set_snap(value) |
  275. +-----------+-----------------+
  276. | *Getter* | get_snap() |
  277. +-----------+-----------------+
  278. The snapping distance in pixels.
  279. ----
  280. .. _class_GraphEdit_property_use_snap:
  281. - :ref:`bool<class_bool>` **use_snap**
  282. +-----------+---------------------+
  283. | *Default* | ``true`` |
  284. +-----------+---------------------+
  285. | *Setter* | set_use_snap(value) |
  286. +-----------+---------------------+
  287. | *Getter* | is_using_snap() |
  288. +-----------+---------------------+
  289. If ``true``, enables snapping.
  290. ----
  291. .. _class_GraphEdit_property_zoom:
  292. - :ref:`float<class_float>` **zoom**
  293. +-----------+-----------------+
  294. | *Default* | ``1.0`` |
  295. +-----------+-----------------+
  296. | *Setter* | set_zoom(value) |
  297. +-----------+-----------------+
  298. | *Getter* | get_zoom() |
  299. +-----------+-----------------+
  300. The current zoom value.
  301. ----
  302. .. _class_GraphEdit_property_zoom_max:
  303. - :ref:`float<class_float>` **zoom_max**
  304. +-----------+---------------------+
  305. | *Default* | ``2.0736`` |
  306. +-----------+---------------------+
  307. | *Setter* | set_zoom_max(value) |
  308. +-----------+---------------------+
  309. | *Getter* | get_zoom_max() |
  310. +-----------+---------------------+
  311. The upper zoom limit.
  312. ----
  313. .. _class_GraphEdit_property_zoom_min:
  314. - :ref:`float<class_float>` **zoom_min**
  315. +-----------+---------------------+
  316. | *Default* | ``0.232568`` |
  317. +-----------+---------------------+
  318. | *Setter* | set_zoom_min(value) |
  319. +-----------+---------------------+
  320. | *Getter* | get_zoom_min() |
  321. +-----------+---------------------+
  322. The lower zoom limit.
  323. ----
  324. .. _class_GraphEdit_property_zoom_step:
  325. - :ref:`float<class_float>` **zoom_step**
  326. +-----------+----------------------+
  327. | *Default* | ``1.2`` |
  328. +-----------+----------------------+
  329. | *Setter* | set_zoom_step(value) |
  330. +-----------+----------------------+
  331. | *Getter* | get_zoom_step() |
  332. +-----------+----------------------+
  333. The step of each zoom level.
  334. Method Descriptions
  335. -------------------
  336. .. _class_GraphEdit_method__get_connection_line:
  337. - :ref:`PackedVector2Array<class_PackedVector2Array>` **_get_connection_line** **(** :ref:`Vector2<class_Vector2>` from, :ref:`Vector2<class_Vector2>` to **)** |virtual| |const|
  338. Virtual method which can be overridden to customize how connections are drawn.
  339. ----
  340. .. _class_GraphEdit_method_add_valid_connection_type:
  341. - void **add_valid_connection_type** **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)**
  342. Makes possible the connection between two different slot types. The type is defined with the :ref:`GraphNode.set_slot<class_GraphNode_method_set_slot>` method.
  343. ----
  344. .. _class_GraphEdit_method_add_valid_left_disconnect_type:
  345. - void **add_valid_left_disconnect_type** **(** :ref:`int<class_int>` type **)**
  346. Makes possible to disconnect nodes when dragging from the slot at the left if it has the specified type.
  347. ----
  348. .. _class_GraphEdit_method_add_valid_right_disconnect_type:
  349. - void **add_valid_right_disconnect_type** **(** :ref:`int<class_int>` type **)**
  350. Makes possible to disconnect nodes when dragging from the slot at the right if it has the specified type.
  351. ----
  352. .. _class_GraphEdit_method_arrange_nodes:
  353. - void **arrange_nodes** **(** **)**
  354. Rearranges selected nodes in a layout with minimum crossings between connections and uniform horizontal and vertical gap between nodes.
  355. ----
  356. .. _class_GraphEdit_method_clear_connections:
  357. - void **clear_connections** **(** **)**
  358. Removes all connections between nodes.
  359. ----
  360. .. _class_GraphEdit_method_connect_node:
  361. - :ref:`Error<enum_@GlobalScope_Error>` **connect_node** **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port **)**
  362. Create a connection between the ``from_port`` slot of the ``from`` GraphNode and the ``to_port`` slot of the ``to`` GraphNode. If the connection already exists, no connection is created.
  363. ----
  364. .. _class_GraphEdit_method_disconnect_node:
  365. - void **disconnect_node** **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port **)**
  366. Removes the connection between the ``from_port`` slot of the ``from`` GraphNode and the ``to_port`` slot of the ``to`` GraphNode. If the connection does not exist, no connection is removed.
  367. ----
  368. .. _class_GraphEdit_method_get_connection_line:
  369. - :ref:`PackedVector2Array<class_PackedVector2Array>` **get_connection_line** **(** :ref:`Vector2<class_Vector2>` from, :ref:`Vector2<class_Vector2>` to **)**
  370. Returns the points which would make up a connection between ``from`` and ``to``.
  371. ----
  372. .. _class_GraphEdit_method_get_connection_list:
  373. - :ref:`Array<class_Array>` **get_connection_list** **(** **)** |const|
  374. 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" }``.
  375. ----
  376. .. _class_GraphEdit_method_get_zoom_hbox:
  377. - :ref:`HBoxContainer<class_HBoxContainer>` **get_zoom_hbox** **(** **)**
  378. 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.
  379. **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.
  380. ----
  381. .. _class_GraphEdit_method_is_node_connected:
  382. - :ref:`bool<class_bool>` **is_node_connected** **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port **)**
  383. Returns ``true`` if the ``from_port`` slot of the ``from`` GraphNode is connected to the ``to_port`` slot of the ``to`` GraphNode.
  384. ----
  385. .. _class_GraphEdit_method_is_valid_connection_type:
  386. - :ref:`bool<class_bool>` **is_valid_connection_type** **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)** |const|
  387. Returns whether it's possible to connect slots of the specified types.
  388. ----
  389. .. _class_GraphEdit_method_remove_valid_connection_type:
  390. - void **remove_valid_connection_type** **(** :ref:`int<class_int>` from_type, :ref:`int<class_int>` to_type **)**
  391. Makes it not possible to connect between two different slot types. The type is defined with the :ref:`GraphNode.set_slot<class_GraphNode_method_set_slot>` method.
  392. ----
  393. .. _class_GraphEdit_method_remove_valid_left_disconnect_type:
  394. - void **remove_valid_left_disconnect_type** **(** :ref:`int<class_int>` type **)**
  395. Removes the possibility to disconnect nodes when dragging from the slot at the left if it has the specified type.
  396. ----
  397. .. _class_GraphEdit_method_remove_valid_right_disconnect_type:
  398. - void **remove_valid_right_disconnect_type** **(** :ref:`int<class_int>` type **)**
  399. Removes the possibility to disconnect nodes when dragging from the slot at the right if it has the specified type.
  400. ----
  401. .. _class_GraphEdit_method_set_connection_activity:
  402. - void **set_connection_activity** **(** :ref:`StringName<class_StringName>` from, :ref:`int<class_int>` from_port, :ref:`StringName<class_StringName>` to, :ref:`int<class_int>` to_port, :ref:`float<class_float>` amount **)**
  403. Sets the coloration of the connection between ``from``'s ``from_port`` and ``to``'s ``to_port`` with the color provided in the :ref:`activity<class_GraphEdit_theme_color_activity>` theme property.
  404. ----
  405. .. _class_GraphEdit_method_set_selected:
  406. - void **set_selected** **(** :ref:`Node<class_Node>` node **)**
  407. Sets the specified ``node`` as the one selected.
  408. Theme Property Descriptions
  409. ---------------------------
  410. .. _class_GraphEdit_theme_color_activity:
  411. - :ref:`Color<class_Color>` **activity**
  412. +-----------+-----------------------+
  413. | *Default* | ``Color(1, 1, 1, 1)`` |
  414. +-----------+-----------------------+
  415. ----
  416. .. _class_GraphEdit_theme_constant_bezier_len_neg:
  417. - :ref:`int<class_int>` **bezier_len_neg**
  418. +-----------+---------+
  419. | *Default* | ``160`` |
  420. +-----------+---------+
  421. ----
  422. .. _class_GraphEdit_theme_constant_bezier_len_pos:
  423. - :ref:`int<class_int>` **bezier_len_pos**
  424. +-----------+--------+
  425. | *Default* | ``80`` |
  426. +-----------+--------+
  427. ----
  428. .. _class_GraphEdit_theme_style_bg:
  429. - :ref:`StyleBox<class_StyleBox>` **bg**
  430. The background drawn under the grid.
  431. ----
  432. .. _class_GraphEdit_theme_color_grid_major:
  433. - :ref:`Color<class_Color>` **grid_major**
  434. +-----------+-------------------------+
  435. | *Default* | ``Color(1, 1, 1, 0.2)`` |
  436. +-----------+-------------------------+
  437. Color of major grid lines.
  438. ----
  439. .. _class_GraphEdit_theme_color_grid_minor:
  440. - :ref:`Color<class_Color>` **grid_minor**
  441. +-----------+--------------------------+
  442. | *Default* | ``Color(1, 1, 1, 0.05)`` |
  443. +-----------+--------------------------+
  444. Color of minor grid lines.
  445. ----
  446. .. _class_GraphEdit_theme_icon_layout:
  447. - :ref:`Texture2D<class_Texture2D>` **layout**
  448. ----
  449. .. _class_GraphEdit_theme_icon_minimap:
  450. - :ref:`Texture2D<class_Texture2D>` **minimap**
  451. ----
  452. .. _class_GraphEdit_theme_icon_minus:
  453. - :ref:`Texture2D<class_Texture2D>` **minus**
  454. The icon for the zoom out button.
  455. ----
  456. .. _class_GraphEdit_theme_icon_more:
  457. - :ref:`Texture2D<class_Texture2D>` **more**
  458. The icon for the zoom in button.
  459. ----
  460. .. _class_GraphEdit_theme_constant_port_grab_distance_horizontal:
  461. - :ref:`int<class_int>` **port_grab_distance_horizontal**
  462. +-----------+--------+
  463. | *Default* | ``24`` |
  464. +-----------+--------+
  465. The horizontal range within which a port can be grabbed (on both sides).
  466. ----
  467. .. _class_GraphEdit_theme_constant_port_grab_distance_vertical:
  468. - :ref:`int<class_int>` **port_grab_distance_vertical**
  469. +-----------+-------+
  470. | *Default* | ``6`` |
  471. +-----------+-------+
  472. The vertical range within which a port can be grabbed (on both sides).
  473. ----
  474. .. _class_GraphEdit_theme_icon_reset:
  475. - :ref:`Texture2D<class_Texture2D>` **reset**
  476. The icon for the zoom reset button.
  477. ----
  478. .. _class_GraphEdit_theme_color_selection_fill:
  479. - :ref:`Color<class_Color>` **selection_fill**
  480. +-----------+-------------------------+
  481. | *Default* | ``Color(1, 1, 1, 0.3)`` |
  482. +-----------+-------------------------+
  483. The fill color of the selection rectangle.
  484. ----
  485. .. _class_GraphEdit_theme_color_selection_stroke:
  486. - :ref:`Color<class_Color>` **selection_stroke**
  487. +-----------+-------------------------+
  488. | *Default* | ``Color(1, 1, 1, 0.8)`` |
  489. +-----------+-------------------------+
  490. The outline color of the selection rectangle.
  491. ----
  492. .. _class_GraphEdit_theme_icon_snap:
  493. - :ref:`Texture2D<class_Texture2D>` **snap**
  494. The icon for the snap toggle button.
  495. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  496. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  497. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  498. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  499. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  500. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`