class_visualshader.rst 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/VisualShader.xml.
  6. .. _class_VisualShader:
  7. VisualShader
  8. ============
  9. **Inherits:** :ref:`Shader<class_Shader>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A custom shader program with a visual editor.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This class provides a graph-like visual editor for creating a :ref:`Shader<class_Shader>`. Although **VisualShader**\ s do not require coding, they share the same logic with script shaders. They use :ref:`VisualShaderNode<class_VisualShaderNode>`\ s that can be connected to each other to control the flow of the shader. The visual shader graph is converted to a script shader behind the scenes.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`Using VisualShaders <../tutorials/shaders/visual_shaders>`
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-------------------------------+---------------------------------------------------------------+-------------------+
  25. | :ref:`Vector2<class_Vector2>` | :ref:`graph_offset<class_VisualShader_property_graph_offset>` | ``Vector2(0, 0)`` |
  26. +-------------------------------+---------------------------------------------------------------+-------------------+
  27. .. rst-class:: classref-reftable-group
  28. Methods
  29. -------
  30. .. table::
  31. :widths: auto
  32. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | |void| | :ref:`add_node<class_VisualShader_method_add_node>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, node\: :ref:`VisualShaderNode<class_VisualShaderNode>`, position\: :ref:`Vector2<class_Vector2>`, id\: :ref:`int<class_int>`\ ) |
  34. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | |void| | :ref:`add_varying<class_VisualShader_method_add_varying>`\ (\ name\: :ref:`String<class_String>`, mode\: :ref:`VaryingMode<enum_VisualShader_VaryingMode>`, type\: :ref:`VaryingType<enum_VisualShader_VaryingType>`\ ) |
  36. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | |void| | :ref:`attach_node_to_frame<class_VisualShader_method_attach_node_to_frame>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`, frame\: :ref:`int<class_int>`\ ) |
  38. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`can_connect_nodes<class_VisualShader_method_can_connect_nodes>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) |const| |
  40. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`connect_nodes<class_VisualShader_method_connect_nodes>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) |
  42. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | |void| | :ref:`connect_nodes_forced<class_VisualShader_method_connect_nodes_forced>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) |
  44. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | |void| | :ref:`detach_node_from_frame<class_VisualShader_method_detach_node_from_frame>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) |
  46. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | |void| | :ref:`disconnect_nodes<class_VisualShader_method_disconnect_nodes>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) |
  48. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`VisualShaderNode<class_VisualShaderNode>` | :ref:`get_node<class_VisualShader_method_get_node>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) |const| |
  50. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] | :ref:`get_node_connections<class_VisualShader_method_get_node_connections>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`\ ) |const| |
  52. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_node_list<class_VisualShader_method_get_node_list>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`\ ) |const| |
  54. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Vector2<class_Vector2>` | :ref:`get_node_position<class_VisualShader_method_get_node_position>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) |const| |
  56. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`get_valid_node_id<class_VisualShader_method_get_valid_node_id>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`\ ) |const| |
  58. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`has_varying<class_VisualShader_method_has_varying>`\ (\ name\: :ref:`String<class_String>`\ ) |const| |
  60. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`is_node_connection<class_VisualShader_method_is_node_connection>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) |const| |
  62. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | |void| | :ref:`remove_node<class_VisualShader_method_remove_node>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) |
  64. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | |void| | :ref:`remove_varying<class_VisualShader_method_remove_varying>`\ (\ name\: :ref:`String<class_String>`\ ) |
  66. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | |void| | :ref:`replace_node<class_VisualShader_method_replace_node>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`, new_class\: :ref:`StringName<class_StringName>`\ ) |
  68. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | |void| | :ref:`set_mode<class_VisualShader_method_set_mode>`\ (\ mode\: :ref:`Mode<enum_Shader_Mode>`\ ) |
  70. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | |void| | :ref:`set_node_position<class_VisualShader_method_set_node_position>`\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`, position\: :ref:`Vector2<class_Vector2>`\ ) |
  72. +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. .. rst-class:: classref-section-separator
  74. ----
  75. .. rst-class:: classref-descriptions-group
  76. Enumerations
  77. ------------
  78. .. _enum_VisualShader_Type:
  79. .. rst-class:: classref-enumeration
  80. enum **Type**: :ref:`🔗<enum_VisualShader_Type>`
  81. .. _class_VisualShader_constant_TYPE_VERTEX:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`Type<enum_VisualShader_Type>` **TYPE_VERTEX** = ``0``
  84. A vertex shader, operating on vertices.
  85. .. _class_VisualShader_constant_TYPE_FRAGMENT:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`Type<enum_VisualShader_Type>` **TYPE_FRAGMENT** = ``1``
  88. A fragment shader, operating on fragments (pixels).
  89. .. _class_VisualShader_constant_TYPE_LIGHT:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`Type<enum_VisualShader_Type>` **TYPE_LIGHT** = ``2``
  92. A shader for light calculations.
  93. .. _class_VisualShader_constant_TYPE_START:
  94. .. rst-class:: classref-enumeration-constant
  95. :ref:`Type<enum_VisualShader_Type>` **TYPE_START** = ``3``
  96. A function for the "start" stage of particle shader.
  97. .. _class_VisualShader_constant_TYPE_PROCESS:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`Type<enum_VisualShader_Type>` **TYPE_PROCESS** = ``4``
  100. A function for the "process" stage of particle shader.
  101. .. _class_VisualShader_constant_TYPE_COLLIDE:
  102. .. rst-class:: classref-enumeration-constant
  103. :ref:`Type<enum_VisualShader_Type>` **TYPE_COLLIDE** = ``5``
  104. A function for the "collide" stage (particle collision handler) of particle shader.
  105. .. _class_VisualShader_constant_TYPE_START_CUSTOM:
  106. .. rst-class:: classref-enumeration-constant
  107. :ref:`Type<enum_VisualShader_Type>` **TYPE_START_CUSTOM** = ``6``
  108. A function for the "start" stage of particle shader, with customized output.
  109. .. _class_VisualShader_constant_TYPE_PROCESS_CUSTOM:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`Type<enum_VisualShader_Type>` **TYPE_PROCESS_CUSTOM** = ``7``
  112. A function for the "process" stage of particle shader, with customized output.
  113. .. _class_VisualShader_constant_TYPE_SKY:
  114. .. rst-class:: classref-enumeration-constant
  115. :ref:`Type<enum_VisualShader_Type>` **TYPE_SKY** = ``8``
  116. A shader for 3D environment's sky.
  117. .. _class_VisualShader_constant_TYPE_FOG:
  118. .. rst-class:: classref-enumeration-constant
  119. :ref:`Type<enum_VisualShader_Type>` **TYPE_FOG** = ``9``
  120. A compute shader that runs for each froxel of the volumetric fog map.
  121. .. _class_VisualShader_constant_TYPE_MAX:
  122. .. rst-class:: classref-enumeration-constant
  123. :ref:`Type<enum_VisualShader_Type>` **TYPE_MAX** = ``10``
  124. Represents the size of the :ref:`Type<enum_VisualShader_Type>` enum.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _enum_VisualShader_VaryingMode:
  128. .. rst-class:: classref-enumeration
  129. enum **VaryingMode**: :ref:`🔗<enum_VisualShader_VaryingMode>`
  130. .. _class_VisualShader_constant_VARYING_MODE_VERTEX_TO_FRAG_LIGHT:
  131. .. rst-class:: classref-enumeration-constant
  132. :ref:`VaryingMode<enum_VisualShader_VaryingMode>` **VARYING_MODE_VERTEX_TO_FRAG_LIGHT** = ``0``
  133. Varying is passed from ``Vertex`` function to ``Fragment`` and ``Light`` functions.
  134. .. _class_VisualShader_constant_VARYING_MODE_FRAG_TO_LIGHT:
  135. .. rst-class:: classref-enumeration-constant
  136. :ref:`VaryingMode<enum_VisualShader_VaryingMode>` **VARYING_MODE_FRAG_TO_LIGHT** = ``1``
  137. Varying is passed from ``Fragment`` function to ``Light`` function.
  138. .. _class_VisualShader_constant_VARYING_MODE_MAX:
  139. .. rst-class:: classref-enumeration-constant
  140. :ref:`VaryingMode<enum_VisualShader_VaryingMode>` **VARYING_MODE_MAX** = ``2``
  141. Represents the size of the :ref:`VaryingMode<enum_VisualShader_VaryingMode>` enum.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _enum_VisualShader_VaryingType:
  145. .. rst-class:: classref-enumeration
  146. enum **VaryingType**: :ref:`🔗<enum_VisualShader_VaryingType>`
  147. .. _class_VisualShader_constant_VARYING_TYPE_FLOAT:
  148. .. rst-class:: classref-enumeration-constant
  149. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_FLOAT** = ``0``
  150. Varying is of type :ref:`float<class_float>`.
  151. .. _class_VisualShader_constant_VARYING_TYPE_INT:
  152. .. rst-class:: classref-enumeration-constant
  153. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_INT** = ``1``
  154. Varying is of type :ref:`int<class_int>`.
  155. .. _class_VisualShader_constant_VARYING_TYPE_UINT:
  156. .. rst-class:: classref-enumeration-constant
  157. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_UINT** = ``2``
  158. Varying is of type unsigned :ref:`int<class_int>`.
  159. .. _class_VisualShader_constant_VARYING_TYPE_VECTOR_2D:
  160. .. rst-class:: classref-enumeration-constant
  161. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_VECTOR_2D** = ``3``
  162. Varying is of type :ref:`Vector2<class_Vector2>`.
  163. .. _class_VisualShader_constant_VARYING_TYPE_VECTOR_3D:
  164. .. rst-class:: classref-enumeration-constant
  165. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_VECTOR_3D** = ``4``
  166. Varying is of type :ref:`Vector3<class_Vector3>`.
  167. .. _class_VisualShader_constant_VARYING_TYPE_VECTOR_4D:
  168. .. rst-class:: classref-enumeration-constant
  169. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_VECTOR_4D** = ``5``
  170. Varying is of type :ref:`Vector4<class_Vector4>`.
  171. .. _class_VisualShader_constant_VARYING_TYPE_BOOLEAN:
  172. .. rst-class:: classref-enumeration-constant
  173. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_BOOLEAN** = ``6``
  174. Varying is of type :ref:`bool<class_bool>`.
  175. .. _class_VisualShader_constant_VARYING_TYPE_TRANSFORM:
  176. .. rst-class:: classref-enumeration-constant
  177. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_TRANSFORM** = ``7``
  178. Varying is of type :ref:`Transform3D<class_Transform3D>`.
  179. .. _class_VisualShader_constant_VARYING_TYPE_MAX:
  180. .. rst-class:: classref-enumeration-constant
  181. :ref:`VaryingType<enum_VisualShader_VaryingType>` **VARYING_TYPE_MAX** = ``8``
  182. Represents the size of the :ref:`VaryingType<enum_VisualShader_VaryingType>` enum.
  183. .. rst-class:: classref-section-separator
  184. ----
  185. .. rst-class:: classref-descriptions-group
  186. Constants
  187. ---------
  188. .. _class_VisualShader_constant_NODE_ID_INVALID:
  189. .. rst-class:: classref-constant
  190. **NODE_ID_INVALID** = ``-1`` :ref:`🔗<class_VisualShader_constant_NODE_ID_INVALID>`
  191. Indicates an invalid **VisualShader** node.
  192. .. _class_VisualShader_constant_NODE_ID_OUTPUT:
  193. .. rst-class:: classref-constant
  194. **NODE_ID_OUTPUT** = ``0`` :ref:`🔗<class_VisualShader_constant_NODE_ID_OUTPUT>`
  195. Indicates an output node of **VisualShader**.
  196. .. rst-class:: classref-section-separator
  197. ----
  198. .. rst-class:: classref-descriptions-group
  199. Property Descriptions
  200. ---------------------
  201. .. _class_VisualShader_property_graph_offset:
  202. .. rst-class:: classref-property
  203. :ref:`Vector2<class_Vector2>` **graph_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_VisualShader_property_graph_offset>`
  204. .. rst-class:: classref-property-setget
  205. - |void| **set_graph_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  206. - :ref:`Vector2<class_Vector2>` **get_graph_offset**\ (\ )
  207. The offset vector of the whole graph.
  208. .. rst-class:: classref-section-separator
  209. ----
  210. .. rst-class:: classref-descriptions-group
  211. Method Descriptions
  212. -------------------
  213. .. _class_VisualShader_method_add_node:
  214. .. rst-class:: classref-method
  215. |void| **add_node**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, node\: :ref:`VisualShaderNode<class_VisualShaderNode>`, position\: :ref:`Vector2<class_Vector2>`, id\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShader_method_add_node>`
  216. Adds the specified ``node`` to the shader.
  217. .. rst-class:: classref-item-separator
  218. ----
  219. .. _class_VisualShader_method_add_varying:
  220. .. rst-class:: classref-method
  221. |void| **add_varying**\ (\ name\: :ref:`String<class_String>`, mode\: :ref:`VaryingMode<enum_VisualShader_VaryingMode>`, type\: :ref:`VaryingType<enum_VisualShader_VaryingType>`\ ) :ref:`🔗<class_VisualShader_method_add_varying>`
  222. Adds a new varying value node to the shader.
  223. .. rst-class:: classref-item-separator
  224. ----
  225. .. _class_VisualShader_method_attach_node_to_frame:
  226. .. rst-class:: classref-method
  227. |void| **attach_node_to_frame**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`, frame\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShader_method_attach_node_to_frame>`
  228. Attaches the given node to the given frame.
  229. .. rst-class:: classref-item-separator
  230. ----
  231. .. _class_VisualShader_method_can_connect_nodes:
  232. .. rst-class:: classref-method
  233. :ref:`bool<class_bool>` **can_connect_nodes**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_VisualShader_method_can_connect_nodes>`
  234. Returns ``true`` if the specified nodes and ports can be connected together.
  235. .. rst-class:: classref-item-separator
  236. ----
  237. .. _class_VisualShader_method_connect_nodes:
  238. .. rst-class:: classref-method
  239. :ref:`Error<enum_@GlobalScope_Error>` **connect_nodes**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShader_method_connect_nodes>`
  240. Connects the specified nodes and ports.
  241. .. rst-class:: classref-item-separator
  242. ----
  243. .. _class_VisualShader_method_connect_nodes_forced:
  244. .. rst-class:: classref-method
  245. |void| **connect_nodes_forced**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShader_method_connect_nodes_forced>`
  246. Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.
  247. .. rst-class:: classref-item-separator
  248. ----
  249. .. _class_VisualShader_method_detach_node_from_frame:
  250. .. rst-class:: classref-method
  251. |void| **detach_node_from_frame**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShader_method_detach_node_from_frame>`
  252. Detaches the given node from the frame it is attached to.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_VisualShader_method_disconnect_nodes:
  256. .. rst-class:: classref-method
  257. |void| **disconnect_nodes**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShader_method_disconnect_nodes>`
  258. Connects the specified nodes and ports.
  259. .. rst-class:: classref-item-separator
  260. ----
  261. .. _class_VisualShader_method_get_node:
  262. .. rst-class:: classref-method
  263. :ref:`VisualShaderNode<class_VisualShaderNode>` **get_node**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_VisualShader_method_get_node>`
  264. Returns the shader node instance with specified ``type`` and ``id``.
  265. .. rst-class:: classref-item-separator
  266. ----
  267. .. _class_VisualShader_method_get_node_connections:
  268. .. rst-class:: classref-method
  269. :ref:`Array<class_Array>`\[:ref:`Dictionary<class_Dictionary>`\] **get_node_connections**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`\ ) |const| :ref:`🔗<class_VisualShader_method_get_node_connections>`
  270. Returns the list of connected nodes with the specified type.
  271. .. rst-class:: classref-item-separator
  272. ----
  273. .. _class_VisualShader_method_get_node_list:
  274. .. rst-class:: classref-method
  275. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_node_list**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`\ ) |const| :ref:`🔗<class_VisualShader_method_get_node_list>`
  276. Returns the list of all nodes in the shader with the specified type.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_VisualShader_method_get_node_position:
  280. .. rst-class:: classref-method
  281. :ref:`Vector2<class_Vector2>` **get_node_position**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_VisualShader_method_get_node_position>`
  282. Returns the position of the specified node within the shader graph.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _class_VisualShader_method_get_valid_node_id:
  286. .. rst-class:: classref-method
  287. :ref:`int<class_int>` **get_valid_node_id**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`\ ) |const| :ref:`🔗<class_VisualShader_method_get_valid_node_id>`
  288. Returns next valid node ID that can be added to the shader graph.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_VisualShader_method_has_varying:
  292. .. rst-class:: classref-method
  293. :ref:`bool<class_bool>` **has_varying**\ (\ name\: :ref:`String<class_String>`\ ) |const| :ref:`🔗<class_VisualShader_method_has_varying>`
  294. Returns ``true`` if the shader has a varying with the given ``name``.
  295. .. rst-class:: classref-item-separator
  296. ----
  297. .. _class_VisualShader_method_is_node_connection:
  298. .. rst-class:: classref-method
  299. :ref:`bool<class_bool>` **is_node_connection**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, from_node\: :ref:`int<class_int>`, from_port\: :ref:`int<class_int>`, to_node\: :ref:`int<class_int>`, to_port\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_VisualShader_method_is_node_connection>`
  300. Returns ``true`` if the specified node and port connection exist.
  301. .. rst-class:: classref-item-separator
  302. ----
  303. .. _class_VisualShader_method_remove_node:
  304. .. rst-class:: classref-method
  305. |void| **remove_node**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`\ ) :ref:`🔗<class_VisualShader_method_remove_node>`
  306. Removes the specified node from the shader.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_VisualShader_method_remove_varying:
  310. .. rst-class:: classref-method
  311. |void| **remove_varying**\ (\ name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_VisualShader_method_remove_varying>`
  312. Removes a varying value node with the given ``name``. Prints an error if a node with this name is not found.
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_VisualShader_method_replace_node:
  316. .. rst-class:: classref-method
  317. |void| **replace_node**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`, new_class\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_VisualShader_method_replace_node>`
  318. Replaces the specified node with a node of new class type.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_VisualShader_method_set_mode:
  322. .. rst-class:: classref-method
  323. |void| **set_mode**\ (\ mode\: :ref:`Mode<enum_Shader_Mode>`\ ) :ref:`🔗<class_VisualShader_method_set_mode>`
  324. Sets the mode of this shader.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_VisualShader_method_set_node_position:
  328. .. rst-class:: classref-method
  329. |void| **set_node_position**\ (\ type\: :ref:`Type<enum_VisualShader_Type>`, id\: :ref:`int<class_int>`, position\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_VisualShader_method_set_node_position>`
  330. Sets the position of the specified node.
  331. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  332. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  333. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  334. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  335. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  336. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  337. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  338. .. |void| replace:: :abbr:`void (No return value.)`