VisualShader.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisualShader" inherits="Shader" version="4.0">
  3. <brief_description>
  4. A custom shader program with a visual editor.
  5. </brief_description>
  6. <description>
  7. This class allows you to define a custom shader program that can be used for various materials to render objects.
  8. The visual shader editor creates the shader.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="add_node">
  14. <return type="void" />
  15. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  16. <argument index="1" name="node" type="VisualShaderNode" />
  17. <argument index="2" name="position" type="Vector2" />
  18. <argument index="3" name="id" type="int" />
  19. <description>
  20. Adds the specified node to the shader.
  21. </description>
  22. </method>
  23. <method name="can_connect_nodes" qualifiers="const">
  24. <return type="bool" />
  25. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  26. <argument index="1" name="from_node" type="int" />
  27. <argument index="2" name="from_port" type="int" />
  28. <argument index="3" name="to_node" type="int" />
  29. <argument index="4" name="to_port" type="int" />
  30. <description>
  31. Returns [code]true[/code] if the specified nodes and ports can be connected together.
  32. </description>
  33. </method>
  34. <method name="connect_nodes">
  35. <return type="int" enum="Error" />
  36. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  37. <argument index="1" name="from_node" type="int" />
  38. <argument index="2" name="from_port" type="int" />
  39. <argument index="3" name="to_node" type="int" />
  40. <argument index="4" name="to_port" type="int" />
  41. <description>
  42. Connects the specified nodes and ports.
  43. </description>
  44. </method>
  45. <method name="connect_nodes_forced">
  46. <return type="void" />
  47. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  48. <argument index="1" name="from_node" type="int" />
  49. <argument index="2" name="from_port" type="int" />
  50. <argument index="3" name="to_node" type="int" />
  51. <argument index="4" name="to_port" type="int" />
  52. <description>
  53. Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.
  54. </description>
  55. </method>
  56. <method name="disconnect_nodes">
  57. <return type="void" />
  58. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  59. <argument index="1" name="from_node" type="int" />
  60. <argument index="2" name="from_port" type="int" />
  61. <argument index="3" name="to_node" type="int" />
  62. <argument index="4" name="to_port" type="int" />
  63. <description>
  64. Connects the specified nodes and ports.
  65. </description>
  66. </method>
  67. <method name="get_node" qualifiers="const">
  68. <return type="VisualShaderNode" />
  69. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  70. <argument index="1" name="id" type="int" />
  71. <description>
  72. Returns the shader node instance with specified [code]type[/code] and [code]id[/code].
  73. </description>
  74. </method>
  75. <method name="get_node_connections" qualifiers="const">
  76. <return type="Array" />
  77. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  78. <description>
  79. Returns the list of connected nodes with the specified type.
  80. </description>
  81. </method>
  82. <method name="get_node_list" qualifiers="const">
  83. <return type="PackedInt32Array" />
  84. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  85. <description>
  86. Returns the list of all nodes in the shader with the specified type.
  87. </description>
  88. </method>
  89. <method name="get_node_position" qualifiers="const">
  90. <return type="Vector2" />
  91. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  92. <argument index="1" name="id" type="int" />
  93. <description>
  94. Returns the position of the specified node within the shader graph.
  95. </description>
  96. </method>
  97. <method name="get_valid_node_id" qualifiers="const">
  98. <return type="int" />
  99. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  100. <description>
  101. </description>
  102. </method>
  103. <method name="is_node_connection" qualifiers="const">
  104. <return type="bool" />
  105. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  106. <argument index="1" name="from_node" type="int" />
  107. <argument index="2" name="from_port" type="int" />
  108. <argument index="3" name="to_node" type="int" />
  109. <argument index="4" name="to_port" type="int" />
  110. <description>
  111. Returns [code]true[/code] if the specified node and port connection exist.
  112. </description>
  113. </method>
  114. <method name="remove_node">
  115. <return type="void" />
  116. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  117. <argument index="1" name="id" type="int" />
  118. <description>
  119. Removes the specified node from the shader.
  120. </description>
  121. </method>
  122. <method name="replace_node">
  123. <return type="void" />
  124. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  125. <argument index="1" name="id" type="int" />
  126. <argument index="2" name="new_class" type="StringName" />
  127. <description>
  128. Replaces the specified node with a node of new class type.
  129. </description>
  130. </method>
  131. <method name="set_mode">
  132. <return type="void" />
  133. <argument index="0" name="mode" type="int" enum="Shader.Mode" />
  134. <description>
  135. Sets the mode of this shader.
  136. </description>
  137. </method>
  138. <method name="set_node_position">
  139. <return type="void" />
  140. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  141. <argument index="1" name="id" type="int" />
  142. <argument index="2" name="position" type="Vector2" />
  143. <description>
  144. Sets the position of the specified node.
  145. </description>
  146. </method>
  147. </methods>
  148. <members>
  149. <member name="engine_version" type="Dictionary" setter="set_engine_version" getter="get_engine_version" default="{}">
  150. The Godot version this [VisualShader] was designed for, in the form of a [Dictionary] with [code]major[/code] and [code]minor[/code] keys with integer values. Example: [code]{"major": 4, "minor": 0}[/code]
  151. This is used by the editor to convert visual shaders from older Godot versions.
  152. </member>
  153. <member name="graph_offset" type="Vector2" setter="set_graph_offset" getter="get_graph_offset" default="Vector2(0, 0)">
  154. The offset vector of the whole graph.
  155. </member>
  156. </members>
  157. <constants>
  158. <constant name="TYPE_VERTEX" value="0" enum="Type">
  159. A vertex shader, operating on vertices.
  160. </constant>
  161. <constant name="TYPE_FRAGMENT" value="1" enum="Type">
  162. A fragment shader, operating on fragments (pixels).
  163. </constant>
  164. <constant name="TYPE_LIGHT" value="2" enum="Type">
  165. A shader for light calculations.
  166. </constant>
  167. <constant name="TYPE_START" value="3" enum="Type">
  168. </constant>
  169. <constant name="TYPE_PROCESS" value="4" enum="Type">
  170. </constant>
  171. <constant name="TYPE_COLLIDE" value="5" enum="Type">
  172. </constant>
  173. <constant name="TYPE_START_CUSTOM" value="6" enum="Type">
  174. </constant>
  175. <constant name="TYPE_PROCESS_CUSTOM" value="7" enum="Type">
  176. </constant>
  177. <constant name="TYPE_SKY" value="8" enum="Type">
  178. </constant>
  179. <constant name="TYPE_FOG" value="9" enum="Type">
  180. A compute shader that runs for each froxel of the volumetric fog map.
  181. </constant>
  182. <constant name="TYPE_MAX" value="10" enum="Type">
  183. Represents the size of the [enum Type] enum.
  184. </constant>
  185. <constant name="NODE_ID_INVALID" value="-1">
  186. </constant>
  187. <constant name="NODE_ID_OUTPUT" value="0">
  188. </constant>
  189. </constants>
  190. </class>