class_graphedit.rst 41 KB

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