VisualShader.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="VisualShader" inherits="Shader" version="3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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="PoolIntArray" />
  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="set_mode">
  123. <return type="void" />
  124. <argument index="0" name="mode" type="int" enum="Shader.Mode" />
  125. <description>
  126. Sets the mode of this shader.
  127. </description>
  128. </method>
  129. <method name="set_node_position">
  130. <return type="void" />
  131. <argument index="0" name="type" type="int" enum="VisualShader.Type" />
  132. <argument index="1" name="id" type="int" />
  133. <argument index="2" name="position" type="Vector2" />
  134. <description>
  135. Sets the position of the specified node.
  136. </description>
  137. </method>
  138. </methods>
  139. <members>
  140. <member name="graph_offset" type="Vector2" setter="set_graph_offset" getter="get_graph_offset" default="Vector2( 0, 0 )">
  141. The offset vector of the whole graph.
  142. </member>
  143. </members>
  144. <constants>
  145. <constant name="TYPE_VERTEX" value="0" enum="Type">
  146. A vertex shader, operating on vertices.
  147. </constant>
  148. <constant name="TYPE_FRAGMENT" value="1" enum="Type">
  149. A fragment shader, operating on fragments (pixels).
  150. </constant>
  151. <constant name="TYPE_LIGHT" value="2" enum="Type">
  152. A shader for light calculations.
  153. </constant>
  154. <constant name="TYPE_MAX" value="3" enum="Type">
  155. Represents the size of the [enum Type] enum.
  156. </constant>
  157. <constant name="NODE_ID_INVALID" value="-1">
  158. </constant>
  159. <constant name="NODE_ID_OUTPUT" value="0">
  160. </constant>
  161. </constants>
  162. </class>