VisualShader.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisualShader" inherits="Shader" version="3.3">
  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. </return>
  16. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  17. </argument>
  18. <argument index="1" name="node" type="VisualShaderNode">
  19. </argument>
  20. <argument index="2" name="position" type="Vector2">
  21. </argument>
  22. <argument index="3" name="id" type="int">
  23. </argument>
  24. <description>
  25. Adds the specified node to the shader.
  26. </description>
  27. </method>
  28. <method name="can_connect_nodes" qualifiers="const">
  29. <return type="bool">
  30. </return>
  31. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  32. </argument>
  33. <argument index="1" name="from_node" type="int">
  34. </argument>
  35. <argument index="2" name="from_port" type="int">
  36. </argument>
  37. <argument index="3" name="to_node" type="int">
  38. </argument>
  39. <argument index="4" name="to_port" type="int">
  40. </argument>
  41. <description>
  42. Returns [code]true[/code] if the specified nodes and ports can be connected together.
  43. </description>
  44. </method>
  45. <method name="connect_nodes">
  46. <return type="int" enum="Error">
  47. </return>
  48. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  49. </argument>
  50. <argument index="1" name="from_node" type="int">
  51. </argument>
  52. <argument index="2" name="from_port" type="int">
  53. </argument>
  54. <argument index="3" name="to_node" type="int">
  55. </argument>
  56. <argument index="4" name="to_port" type="int">
  57. </argument>
  58. <description>
  59. Connects the specified nodes and ports.
  60. </description>
  61. </method>
  62. <method name="connect_nodes_forced">
  63. <return type="void">
  64. </return>
  65. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  66. </argument>
  67. <argument index="1" name="from_node" type="int">
  68. </argument>
  69. <argument index="2" name="from_port" type="int">
  70. </argument>
  71. <argument index="3" name="to_node" type="int">
  72. </argument>
  73. <argument index="4" name="to_port" type="int">
  74. </argument>
  75. <description>
  76. Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.
  77. </description>
  78. </method>
  79. <method name="disconnect_nodes">
  80. <return type="void">
  81. </return>
  82. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  83. </argument>
  84. <argument index="1" name="from_node" type="int">
  85. </argument>
  86. <argument index="2" name="from_port" type="int">
  87. </argument>
  88. <argument index="3" name="to_node" type="int">
  89. </argument>
  90. <argument index="4" name="to_port" type="int">
  91. </argument>
  92. <description>
  93. Connects the specified nodes and ports.
  94. </description>
  95. </method>
  96. <method name="get_node" qualifiers="const">
  97. <return type="VisualShaderNode">
  98. </return>
  99. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  100. </argument>
  101. <argument index="1" name="id" type="int">
  102. </argument>
  103. <description>
  104. Returns the shader node instance with specified [code]type[/code] and [code]id[/code].
  105. </description>
  106. </method>
  107. <method name="get_node_connections" qualifiers="const">
  108. <return type="Array">
  109. </return>
  110. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  111. </argument>
  112. <description>
  113. Returns the list of connected nodes with the specified type.
  114. </description>
  115. </method>
  116. <method name="get_node_list" qualifiers="const">
  117. <return type="PoolIntArray">
  118. </return>
  119. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  120. </argument>
  121. <description>
  122. Returns the list of all nodes in the shader with the specified type.
  123. </description>
  124. </method>
  125. <method name="get_node_position" qualifiers="const">
  126. <return type="Vector2">
  127. </return>
  128. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  129. </argument>
  130. <argument index="1" name="id" type="int">
  131. </argument>
  132. <description>
  133. Returns the position of the specified node within the shader graph.
  134. </description>
  135. </method>
  136. <method name="get_valid_node_id" qualifiers="const">
  137. <return type="int">
  138. </return>
  139. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  140. </argument>
  141. <description>
  142. </description>
  143. </method>
  144. <method name="is_node_connection" qualifiers="const">
  145. <return type="bool">
  146. </return>
  147. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  148. </argument>
  149. <argument index="1" name="from_node" type="int">
  150. </argument>
  151. <argument index="2" name="from_port" type="int">
  152. </argument>
  153. <argument index="3" name="to_node" type="int">
  154. </argument>
  155. <argument index="4" name="to_port" type="int">
  156. </argument>
  157. <description>
  158. Returns [code]true[/code] if the specified node and port connection exist.
  159. </description>
  160. </method>
  161. <method name="remove_node">
  162. <return type="void">
  163. </return>
  164. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  165. </argument>
  166. <argument index="1" name="id" type="int">
  167. </argument>
  168. <description>
  169. Removes the specified node from the shader.
  170. </description>
  171. </method>
  172. <method name="set_mode">
  173. <return type="void">
  174. </return>
  175. <argument index="0" name="mode" type="int" enum="Shader.Mode">
  176. </argument>
  177. <description>
  178. Sets the mode of this shader.
  179. </description>
  180. </method>
  181. <method name="set_node_position">
  182. <return type="void">
  183. </return>
  184. <argument index="0" name="type" type="int" enum="VisualShader.Type">
  185. </argument>
  186. <argument index="1" name="id" type="int">
  187. </argument>
  188. <argument index="2" name="position" type="Vector2">
  189. </argument>
  190. <description>
  191. Sets the position of the specified node.
  192. </description>
  193. </method>
  194. </methods>
  195. <members>
  196. <member name="graph_offset" type="Vector2" setter="set_graph_offset" getter="get_graph_offset" default="Vector2( 0, 0 )">
  197. The offset vector of the whole graph.
  198. </member>
  199. </members>
  200. <constants>
  201. <constant name="TYPE_VERTEX" value="0" enum="Type">
  202. A vertex shader, operating on vertices.
  203. </constant>
  204. <constant name="TYPE_FRAGMENT" value="1" enum="Type">
  205. A fragment shader, operating on fragments (pixels).
  206. </constant>
  207. <constant name="TYPE_LIGHT" value="2" enum="Type">
  208. A shader for light calculations.
  209. </constant>
  210. <constant name="TYPE_MAX" value="3" enum="Type">
  211. Represents the size of the [enum Type] enum.
  212. </constant>
  213. <constant name="NODE_ID_INVALID" value="-1">
  214. </constant>
  215. <constant name="NODE_ID_OUTPUT" value="0">
  216. </constant>
  217. </constants>
  218. </class>