class_visualscript.rst 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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/modules/visual_script/doc_classes/VisualScript.xml.
  6. .. _class_VisualScript:
  7. VisualScript
  8. ============
  9. **Inherits:** :ref:`Script<class_Script>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. A script implemented in the Visual Script programming environment.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A script implemented in the Visual Script programming environment. The script extends the functionality of all objects that instance it.
  15. \ :ref:`Object.set_script<class_Object_method_set_script>` extends an existing object, if that object's class matches one of the script's base classes.
  16. You are most likely to use this class via the Visual Script editor or when writing plugins for it.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`../tutorials/scripting/visual_script/index`
  21. .. rst-class:: classref-reftable-group
  22. Methods
  23. -------
  24. .. table::
  25. :widths: auto
  26. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`add_custom_signal<class_VisualScript_method_add_custom_signal>` **(** :ref:`String<class_String>` name **)** |
  28. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`add_function<class_VisualScript_method_add_function>` **(** :ref:`String<class_String>` name **)** |
  30. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`add_node<class_VisualScript_method_add_node>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id, :ref:`VisualScriptNode<class_VisualScriptNode>` node, :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)** |
  32. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`add_variable<class_VisualScript_method_add_variable>` **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` default_value=null, :ref:`bool<class_bool>` export=false **)** |
  34. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`custom_signal_add_argument<class_VisualScript_method_custom_signal_add_argument>` **(** :ref:`String<class_String>` name, :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` type, :ref:`String<class_String>` argname, :ref:`int<class_int>` index=-1 **)** |
  36. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`custom_signal_get_argument_count<class_VisualScript_method_custom_signal_get_argument_count>` **(** :ref:`String<class_String>` name **)** |const| |
  38. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`String<class_String>` | :ref:`custom_signal_get_argument_name<class_VisualScript_method_custom_signal_get_argument_name>` **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx **)** |const| |
  40. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` | :ref:`custom_signal_get_argument_type<class_VisualScript_method_custom_signal_get_argument_type>` **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx **)** |const| |
  42. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`custom_signal_remove_argument<class_VisualScript_method_custom_signal_remove_argument>` **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx **)** |
  44. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`custom_signal_set_argument_name<class_VisualScript_method_custom_signal_set_argument_name>` **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx, :ref:`String<class_String>` argname **)** |
  46. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`custom_signal_set_argument_type<class_VisualScript_method_custom_signal_set_argument_type>` **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx, :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` type **)** |
  48. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`custom_signal_swap_argument<class_VisualScript_method_custom_signal_swap_argument>` **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx, :ref:`int<class_int>` withidx **)** |
  50. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`data_connect<class_VisualScript_method_data_connect>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_port, :ref:`int<class_int>` to_node, :ref:`int<class_int>` to_port **)** |
  52. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`data_disconnect<class_VisualScript_method_data_disconnect>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_port, :ref:`int<class_int>` to_node, :ref:`int<class_int>` to_port **)** |
  54. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`int<class_int>` | :ref:`get_function_node_id<class_VisualScript_method_get_function_node_id>` **(** :ref:`String<class_String>` name **)** |const| |
  56. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`Vector2<class_Vector2>` | :ref:`get_function_scroll<class_VisualScript_method_get_function_scroll>` **(** :ref:`String<class_String>` name **)** |const| |
  58. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`VisualScriptNode<class_VisualScriptNode>` | :ref:`get_node<class_VisualScript_method_get_node>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)** |const| |
  60. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Vector2<class_Vector2>` | :ref:`get_node_position<class_VisualScript_method_get_node_position>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)** |const| |
  62. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Variant<class_Variant>` | :ref:`get_variable_default_value<class_VisualScript_method_get_variable_default_value>` **(** :ref:`String<class_String>` name **)** |const| |
  64. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`get_variable_export<class_VisualScript_method_get_variable_export>` **(** :ref:`String<class_String>` name **)** |const| |
  66. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_variable_info<class_VisualScript_method_get_variable_info>` **(** :ref:`String<class_String>` name **)** |const| |
  68. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`bool<class_bool>` | :ref:`has_custom_signal<class_VisualScript_method_has_custom_signal>` **(** :ref:`String<class_String>` name **)** |const| |
  70. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`bool<class_bool>` | :ref:`has_data_connection<class_VisualScript_method_has_data_connection>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_port, :ref:`int<class_int>` to_node, :ref:`int<class_int>` to_port **)** |const| |
  72. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`bool<class_bool>` | :ref:`has_function<class_VisualScript_method_has_function>` **(** :ref:`String<class_String>` name **)** |const| |
  74. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`bool<class_bool>` | :ref:`has_node<class_VisualScript_method_has_node>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)** |const| |
  76. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`bool<class_bool>` | :ref:`has_sequence_connection<class_VisualScript_method_has_sequence_connection>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_output, :ref:`int<class_int>` to_node **)** |const| |
  78. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`bool<class_bool>` | :ref:`has_variable<class_VisualScript_method_has_variable>` **(** :ref:`String<class_String>` name **)** |const| |
  80. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`remove_custom_signal<class_VisualScript_method_remove_custom_signal>` **(** :ref:`String<class_String>` name **)** |
  82. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`remove_function<class_VisualScript_method_remove_function>` **(** :ref:`String<class_String>` name **)** |
  84. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`remove_node<class_VisualScript_method_remove_node>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)** |
  86. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`remove_variable<class_VisualScript_method_remove_variable>` **(** :ref:`String<class_String>` name **)** |
  88. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`rename_custom_signal<class_VisualScript_method_rename_custom_signal>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)** |
  90. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | void | :ref:`rename_function<class_VisualScript_method_rename_function>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)** |
  92. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | void | :ref:`rename_variable<class_VisualScript_method_rename_variable>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)** |
  94. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | void | :ref:`sequence_connect<class_VisualScript_method_sequence_connect>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_output, :ref:`int<class_int>` to_node **)** |
  96. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`sequence_disconnect<class_VisualScript_method_sequence_disconnect>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_output, :ref:`int<class_int>` to_node **)** |
  98. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`set_function_scroll<class_VisualScript_method_set_function_scroll>` **(** :ref:`String<class_String>` name, :ref:`Vector2<class_Vector2>` ofs **)** |
  100. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`set_instance_base_type<class_VisualScript_method_set_instance_base_type>` **(** :ref:`String<class_String>` type **)** |
  102. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | void | :ref:`set_node_position<class_VisualScript_method_set_node_position>` **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id, :ref:`Vector2<class_Vector2>` position **)** |
  104. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`set_variable_default_value<class_VisualScript_method_set_variable_default_value>` **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value **)** |
  106. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | void | :ref:`set_variable_export<class_VisualScript_method_set_variable_export>` **(** :ref:`String<class_String>` name, :ref:`bool<class_bool>` enable **)** |
  108. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | void | :ref:`set_variable_info<class_VisualScript_method_set_variable_info>` **(** :ref:`String<class_String>` name, :ref:`Dictionary<class_Dictionary>` value **)** |
  110. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. .. rst-class:: classref-section-separator
  112. ----
  113. .. rst-class:: classref-descriptions-group
  114. Signals
  115. -------
  116. .. _class_VisualScript_signal_node_ports_changed:
  117. .. rst-class:: classref-signal
  118. **node_ports_changed** **(** :ref:`String<class_String>` function, :ref:`int<class_int>` id **)**
  119. Emitted when the ports of a node are changed.
  120. .. rst-class:: classref-section-separator
  121. ----
  122. .. rst-class:: classref-descriptions-group
  123. Method Descriptions
  124. -------------------
  125. .. _class_VisualScript_method_add_custom_signal:
  126. .. rst-class:: classref-method
  127. void **add_custom_signal** **(** :ref:`String<class_String>` name **)**
  128. Add a custom signal with the specified name to the VisualScript.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_VisualScript_method_add_function:
  132. .. rst-class:: classref-method
  133. void **add_function** **(** :ref:`String<class_String>` name **)**
  134. Add a function with the specified name to the VisualScript.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_VisualScript_method_add_node:
  138. .. rst-class:: classref-method
  139. void **add_node** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id, :ref:`VisualScriptNode<class_VisualScriptNode>` node, :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)**
  140. Add a node to a function of the VisualScript.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_VisualScript_method_add_variable:
  144. .. rst-class:: classref-method
  145. void **add_variable** **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` default_value=null, :ref:`bool<class_bool>` export=false **)**
  146. Add a variable to the VisualScript, optionally giving it a default value or marking it as exported.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_VisualScript_method_custom_signal_add_argument:
  150. .. rst-class:: classref-method
  151. void **custom_signal_add_argument** **(** :ref:`String<class_String>` name, :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` type, :ref:`String<class_String>` argname, :ref:`int<class_int>` index=-1 **)**
  152. Add an argument to a custom signal added with :ref:`add_custom_signal<class_VisualScript_method_add_custom_signal>`.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_VisualScript_method_custom_signal_get_argument_count:
  156. .. rst-class:: classref-method
  157. :ref:`int<class_int>` **custom_signal_get_argument_count** **(** :ref:`String<class_String>` name **)** |const|
  158. Get the count of a custom signal's arguments.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_VisualScript_method_custom_signal_get_argument_name:
  162. .. rst-class:: classref-method
  163. :ref:`String<class_String>` **custom_signal_get_argument_name** **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx **)** |const|
  164. Get the name of a custom signal's argument.
  165. .. rst-class:: classref-item-separator
  166. ----
  167. .. _class_VisualScript_method_custom_signal_get_argument_type:
  168. .. rst-class:: classref-method
  169. :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` **custom_signal_get_argument_type** **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx **)** |const|
  170. Get the type of a custom signal's argument.
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_VisualScript_method_custom_signal_remove_argument:
  174. .. rst-class:: classref-method
  175. void **custom_signal_remove_argument** **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx **)**
  176. Remove a specific custom signal's argument.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_VisualScript_method_custom_signal_set_argument_name:
  180. .. rst-class:: classref-method
  181. void **custom_signal_set_argument_name** **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx, :ref:`String<class_String>` argname **)**
  182. Rename a custom signal's argument.
  183. .. rst-class:: classref-item-separator
  184. ----
  185. .. _class_VisualScript_method_custom_signal_set_argument_type:
  186. .. rst-class:: classref-method
  187. void **custom_signal_set_argument_type** **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx, :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` type **)**
  188. Change the type of a custom signal's argument.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_VisualScript_method_custom_signal_swap_argument:
  192. .. rst-class:: classref-method
  193. void **custom_signal_swap_argument** **(** :ref:`String<class_String>` name, :ref:`int<class_int>` argidx, :ref:`int<class_int>` withidx **)**
  194. Swap two of the arguments of a custom signal.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_VisualScript_method_data_connect:
  198. .. rst-class:: classref-method
  199. void **data_connect** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_port, :ref:`int<class_int>` to_node, :ref:`int<class_int>` to_port **)**
  200. Connect two data ports. The value of ``from_node``'s ``from_port`` would be fed into ``to_node``'s ``to_port``.
  201. .. rst-class:: classref-item-separator
  202. ----
  203. .. _class_VisualScript_method_data_disconnect:
  204. .. rst-class:: classref-method
  205. void **data_disconnect** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_port, :ref:`int<class_int>` to_node, :ref:`int<class_int>` to_port **)**
  206. Disconnect two data ports previously connected with :ref:`data_connect<class_VisualScript_method_data_connect>`.
  207. .. rst-class:: classref-item-separator
  208. ----
  209. .. _class_VisualScript_method_get_function_node_id:
  210. .. rst-class:: classref-method
  211. :ref:`int<class_int>` **get_function_node_id** **(** :ref:`String<class_String>` name **)** |const|
  212. Returns the id of a function's entry point node.
  213. .. rst-class:: classref-item-separator
  214. ----
  215. .. _class_VisualScript_method_get_function_scroll:
  216. .. rst-class:: classref-method
  217. :ref:`Vector2<class_Vector2>` **get_function_scroll** **(** :ref:`String<class_String>` name **)** |const|
  218. Returns the position of the center of the screen for a given function.
  219. .. rst-class:: classref-item-separator
  220. ----
  221. .. _class_VisualScript_method_get_node:
  222. .. rst-class:: classref-method
  223. :ref:`VisualScriptNode<class_VisualScriptNode>` **get_node** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)** |const|
  224. Returns a node given its id and its function.
  225. .. rst-class:: classref-item-separator
  226. ----
  227. .. _class_VisualScript_method_get_node_position:
  228. .. rst-class:: classref-method
  229. :ref:`Vector2<class_Vector2>` **get_node_position** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)** |const|
  230. Returns a node's position in pixels.
  231. .. rst-class:: classref-item-separator
  232. ----
  233. .. _class_VisualScript_method_get_variable_default_value:
  234. .. rst-class:: classref-method
  235. :ref:`Variant<class_Variant>` **get_variable_default_value** **(** :ref:`String<class_String>` name **)** |const|
  236. Returns the default (initial) value of a variable.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_VisualScript_method_get_variable_export:
  240. .. rst-class:: classref-method
  241. :ref:`bool<class_bool>` **get_variable_export** **(** :ref:`String<class_String>` name **)** |const|
  242. Returns whether a variable is exported.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_VisualScript_method_get_variable_info:
  246. .. rst-class:: classref-method
  247. :ref:`Dictionary<class_Dictionary>` **get_variable_info** **(** :ref:`String<class_String>` name **)** |const|
  248. Returns the information for a given variable as a dictionary. The information includes its name, type, hint and usage.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_VisualScript_method_has_custom_signal:
  252. .. rst-class:: classref-method
  253. :ref:`bool<class_bool>` **has_custom_signal** **(** :ref:`String<class_String>` name **)** |const|
  254. Returns whether a signal exists with the specified name.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_VisualScript_method_has_data_connection:
  258. .. rst-class:: classref-method
  259. :ref:`bool<class_bool>` **has_data_connection** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_port, :ref:`int<class_int>` to_node, :ref:`int<class_int>` to_port **)** |const|
  260. Returns whether the specified data ports are connected.
  261. .. rst-class:: classref-item-separator
  262. ----
  263. .. _class_VisualScript_method_has_function:
  264. .. rst-class:: classref-method
  265. :ref:`bool<class_bool>` **has_function** **(** :ref:`String<class_String>` name **)** |const|
  266. Returns whether a function exists with the specified name.
  267. .. rst-class:: classref-item-separator
  268. ----
  269. .. _class_VisualScript_method_has_node:
  270. .. rst-class:: classref-method
  271. :ref:`bool<class_bool>` **has_node** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)** |const|
  272. Returns whether a node exists with the given id.
  273. .. rst-class:: classref-item-separator
  274. ----
  275. .. _class_VisualScript_method_has_sequence_connection:
  276. .. rst-class:: classref-method
  277. :ref:`bool<class_bool>` **has_sequence_connection** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_output, :ref:`int<class_int>` to_node **)** |const|
  278. Returns whether the specified sequence ports are connected.
  279. .. rst-class:: classref-item-separator
  280. ----
  281. .. _class_VisualScript_method_has_variable:
  282. .. rst-class:: classref-method
  283. :ref:`bool<class_bool>` **has_variable** **(** :ref:`String<class_String>` name **)** |const|
  284. Returns whether a variable exists with the specified name.
  285. .. rst-class:: classref-item-separator
  286. ----
  287. .. _class_VisualScript_method_remove_custom_signal:
  288. .. rst-class:: classref-method
  289. void **remove_custom_signal** **(** :ref:`String<class_String>` name **)**
  290. Remove a custom signal with the given name.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_VisualScript_method_remove_function:
  294. .. rst-class:: classref-method
  295. void **remove_function** **(** :ref:`String<class_String>` name **)**
  296. Remove a specific function and its nodes from the script.
  297. .. rst-class:: classref-item-separator
  298. ----
  299. .. _class_VisualScript_method_remove_node:
  300. .. rst-class:: classref-method
  301. void **remove_node** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id **)**
  302. Remove a specific node.
  303. .. rst-class:: classref-item-separator
  304. ----
  305. .. _class_VisualScript_method_remove_variable:
  306. .. rst-class:: classref-method
  307. void **remove_variable** **(** :ref:`String<class_String>` name **)**
  308. Remove a variable with the given name.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_VisualScript_method_rename_custom_signal:
  312. .. rst-class:: classref-method
  313. void **rename_custom_signal** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)**
  314. Change the name of a custom signal.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_VisualScript_method_rename_function:
  318. .. rst-class:: classref-method
  319. void **rename_function** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)**
  320. Change the name of a function.
  321. .. rst-class:: classref-item-separator
  322. ----
  323. .. _class_VisualScript_method_rename_variable:
  324. .. rst-class:: classref-method
  325. void **rename_variable** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)**
  326. Change the name of a variable.
  327. .. rst-class:: classref-item-separator
  328. ----
  329. .. _class_VisualScript_method_sequence_connect:
  330. .. rst-class:: classref-method
  331. void **sequence_connect** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_output, :ref:`int<class_int>` to_node **)**
  332. Connect two sequence ports. The execution will flow from of ``from_node``'s ``from_output`` into ``to_node``.
  333. Unlike :ref:`data_connect<class_VisualScript_method_data_connect>`, there isn't a ``to_port``, since the target node can have only one sequence port.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_VisualScript_method_sequence_disconnect:
  337. .. rst-class:: classref-method
  338. void **sequence_disconnect** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` from_node, :ref:`int<class_int>` from_output, :ref:`int<class_int>` to_node **)**
  339. Disconnect two sequence ports previously connected with :ref:`sequence_connect<class_VisualScript_method_sequence_connect>`.
  340. .. rst-class:: classref-item-separator
  341. ----
  342. .. _class_VisualScript_method_set_function_scroll:
  343. .. rst-class:: classref-method
  344. void **set_function_scroll** **(** :ref:`String<class_String>` name, :ref:`Vector2<class_Vector2>` ofs **)**
  345. Position the center of the screen for a function.
  346. .. rst-class:: classref-item-separator
  347. ----
  348. .. _class_VisualScript_method_set_instance_base_type:
  349. .. rst-class:: classref-method
  350. void **set_instance_base_type** **(** :ref:`String<class_String>` type **)**
  351. Set the base type of the script.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_VisualScript_method_set_node_position:
  355. .. rst-class:: classref-method
  356. void **set_node_position** **(** :ref:`String<class_String>` func, :ref:`int<class_int>` id, :ref:`Vector2<class_Vector2>` position **)**
  357. Position a node on the screen.
  358. .. rst-class:: classref-item-separator
  359. ----
  360. .. _class_VisualScript_method_set_variable_default_value:
  361. .. rst-class:: classref-method
  362. void **set_variable_default_value** **(** :ref:`String<class_String>` name, :ref:`Variant<class_Variant>` value **)**
  363. Change the default (initial) value of a variable.
  364. .. rst-class:: classref-item-separator
  365. ----
  366. .. _class_VisualScript_method_set_variable_export:
  367. .. rst-class:: classref-method
  368. void **set_variable_export** **(** :ref:`String<class_String>` name, :ref:`bool<class_bool>` enable **)**
  369. Change whether a variable is exported.
  370. .. rst-class:: classref-item-separator
  371. ----
  372. .. _class_VisualScript_method_set_variable_info:
  373. .. rst-class:: classref-method
  374. void **set_variable_info** **(** :ref:`String<class_String>` name, :ref:`Dictionary<class_Dictionary>` value **)**
  375. Set a variable's info, using the same format as :ref:`get_variable_info<class_VisualScript_method_get_variable_info>`.
  376. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  377. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  378. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  379. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`