| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="VisualShader" inherits="Shader" 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 provides a graph-like visual editor for creating a [Shader]. Although [VisualShader]s do not require coding, they share the same logic with script shaders. They use [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. |
| 8 | </description> |
| 9 | <tutorials> |
| 10 | <link title="Using VisualShaders">$DOCS_URL/tutorials/shaders/visual_shaders.html</link> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="add_node"> |
| 14 | <return type="void" /> |
| 15 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 16 | <param index="1" name="node" type="VisualShaderNode" /> |
| 17 | <param index="2" name="position" type="Vector2" /> |
| 18 | <param index="3" name="id" type="int" /> |
| 19 | <description> |
| 20 | Adds the specified [param node] to the shader. |
| 21 | </description> |
| 22 | </method> |
| 23 | <method name="add_varying"> |
| 24 | <return type="void" /> |
| 25 | <param index="0" name="name" type="String" /> |
| 26 | <param index="1" name="mode" type="int" enum="VisualShader.VaryingMode" /> |
| 27 | <param index="2" name="type" type="int" enum="VisualShader.VaryingType" /> |
| 28 | <description> |
| 29 | Adds a new varying value node to the shader. |
| 30 | </description> |
| 31 | </method> |
| 32 | <method name="attach_node_to_frame"> |
| 33 | <return type="void" /> |
| 34 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 35 | <param index="1" name="id" type="int" /> |
| 36 | <param index="2" name="frame" type="int" /> |
| 37 | <description> |
| 38 | Attaches the given node to the given frame. |
| 39 | </description> |
| 40 | </method> |
| 41 | <method name="can_connect_nodes" qualifiers="const"> |
| 42 | <return type="bool" /> |
| 43 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 44 | <param index="1" name="from_node" type="int" /> |
| 45 | <param index="2" name="from_port" type="int" /> |
| 46 | <param index="3" name="to_node" type="int" /> |
| 47 | <param index="4" name="to_port" type="int" /> |
| 48 | <description> |
| 49 | Returns [code]true[/code] if the specified nodes and ports can be connected together. |
| 50 | </description> |
| 51 | </method> |
| 52 | <method name="connect_nodes"> |
| 53 | <return type="int" enum="Error" /> |
| 54 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 55 | <param index="1" name="from_node" type="int" /> |
| 56 | <param index="2" name="from_port" type="int" /> |
| 57 | <param index="3" name="to_node" type="int" /> |
| 58 | <param index="4" name="to_port" type="int" /> |
| 59 | <description> |
| 60 | Connects the specified nodes and ports. |
| 61 | </description> |
| 62 | </method> |
| 63 | <method name="connect_nodes_forced"> |
| 64 | <return type="void" /> |
| 65 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 66 | <param index="1" name="from_node" type="int" /> |
| 67 | <param index="2" name="from_port" type="int" /> |
| 68 | <param index="3" name="to_node" type="int" /> |
| 69 | <param index="4" name="to_port" type="int" /> |
| 70 | <description> |
| 71 | Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly. |
| 72 | </description> |
| 73 | </method> |
| 74 | <method name="detach_node_from_frame"> |
| 75 | <return type="void" /> |
| 76 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 77 | <param index="1" name="id" type="int" /> |
| 78 | <description> |
| 79 | Detaches the given node from the frame it is attached to. |
| 80 | </description> |
| 81 | </method> |
| 82 | <method name="disconnect_nodes"> |
| 83 | <return type="void" /> |
| 84 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 85 | <param index="1" name="from_node" type="int" /> |
| 86 | <param index="2" name="from_port" type="int" /> |
| 87 | <param index="3" name="to_node" type="int" /> |
| 88 | <param index="4" name="to_port" type="int" /> |
| 89 | <description> |
| 90 | Connects the specified nodes and ports. |
| 91 | </description> |
| 92 | </method> |
| 93 | <method name="get_node" qualifiers="const"> |
| 94 | <return type="VisualShaderNode" /> |
| 95 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 96 | <param index="1" name="id" type="int" /> |
| 97 | <description> |
| 98 | Returns the shader node instance with specified [param type] and [param id]. |
| 99 | </description> |
| 100 | </method> |
| 101 | <method name="get_node_connections" qualifiers="const"> |
| 102 | <return type="Dictionary[]" /> |
| 103 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 104 | <description> |
| 105 | Returns the list of connected nodes with the specified type. |
| 106 | </description> |
| 107 | </method> |
| 108 | <method name="get_node_list" qualifiers="const"> |
| 109 | <return type="PackedInt32Array" /> |
| 110 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 111 | <description> |
| 112 | Returns the list of all nodes in the shader with the specified type. |
| 113 | </description> |
| 114 | </method> |
| 115 | <method name="get_node_position" qualifiers="const"> |
| 116 | <return type="Vector2" /> |
| 117 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 118 | <param index="1" name="id" type="int" /> |
| 119 | <description> |
| 120 | Returns the position of the specified node within the shader graph. |
| 121 | </description> |
| 122 | </method> |
| 123 | <method name="get_valid_node_id" qualifiers="const"> |
| 124 | <return type="int" /> |
| 125 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 126 | <description> |
| 127 | Returns next valid node ID that can be added to the shader graph. |
| 128 | </description> |
| 129 | </method> |
| 130 | <method name="has_varying" qualifiers="const"> |
| 131 | <return type="bool" /> |
| 132 | <param index="0" name="name" type="String" /> |
| 133 | <description> |
| 134 | Returns [code]true[/code] if the shader has a varying with the given [param name]. |
| 135 | </description> |
| 136 | </method> |
| 137 | <method name="is_node_connection" qualifiers="const"> |
| 138 | <return type="bool" /> |
| 139 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 140 | <param index="1" name="from_node" type="int" /> |
| 141 | <param index="2" name="from_port" type="int" /> |
| 142 | <param index="3" name="to_node" type="int" /> |
| 143 | <param index="4" name="to_port" type="int" /> |
| 144 | <description> |
| 145 | Returns [code]true[/code] if the specified node and port connection exist. |
| 146 | </description> |
| 147 | </method> |
| 148 | <method name="remove_node"> |
| 149 | <return type="void" /> |
| 150 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 151 | <param index="1" name="id" type="int" /> |
| 152 | <description> |
| 153 | Removes the specified node from the shader. |
| 154 | </description> |
| 155 | </method> |
| 156 | <method name="remove_varying"> |
| 157 | <return type="void" /> |
| 158 | <param index="0" name="name" type="String" /> |
| 159 | <description> |
| 160 | Removes a varying value node with the given [param name]. Prints an error if a node with this name is not found. |
| 161 | </description> |
| 162 | </method> |
| 163 | <method name="replace_node"> |
| 164 | <return type="void" /> |
| 165 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 166 | <param index="1" name="id" type="int" /> |
| 167 | <param index="2" name="new_class" type="StringName" /> |
| 168 | <description> |
| 169 | Replaces the specified node with a node of new class type. |
| 170 | </description> |
| 171 | </method> |
| 172 | <method name="set_mode"> |
| 173 | <return type="void" /> |
| 174 | <param index="0" name="mode" type="int" enum="Shader.Mode" /> |
| 175 | <description> |
| 176 | Sets the mode of this shader. |
| 177 | </description> |
| 178 | </method> |
| 179 | <method name="set_node_position"> |
| 180 | <return type="void" /> |
| 181 | <param index="0" name="type" type="int" enum="VisualShader.Type" /> |
| 182 | <param index="1" name="id" type="int" /> |
| 183 | <param index="2" name="position" type="Vector2" /> |
| 184 | <description> |
| 185 | Sets the position of the specified node. |
| 186 | </description> |
| 187 | </method> |
| 188 | </methods> |
| 189 | <members> |
| 190 | <member name="graph_offset" type="Vector2" setter="set_graph_offset" getter="get_graph_offset" deprecated="This property does nothing and always equals to zero."> |
| 191 | Deprecated. |
| 192 | </member> |
| 193 | </members> |
| 194 | <constants> |
| 195 | <constant name="TYPE_VERTEX" value="0" enum="Type"> |
| 196 | A vertex shader, operating on vertices. |
| 197 | </constant> |
| 198 | <constant name="TYPE_FRAGMENT" value="1" enum="Type"> |
| 199 | A fragment shader, operating on fragments (pixels). |
| 200 | </constant> |
| 201 | <constant name="TYPE_LIGHT" value="2" enum="Type"> |
| 202 | A shader for light calculations. |
| 203 | </constant> |
| 204 | <constant name="TYPE_START" value="3" enum="Type"> |
| 205 | A function for the "start" stage of particle shader. |
| 206 | </constant> |
| 207 | <constant name="TYPE_PROCESS" value="4" enum="Type"> |
| 208 | A function for the "process" stage of particle shader. |
| 209 | </constant> |
| 210 | <constant name="TYPE_COLLIDE" value="5" enum="Type"> |
| 211 | A function for the "collide" stage (particle collision handler) of particle shader. |
| 212 | </constant> |
| 213 | <constant name="TYPE_START_CUSTOM" value="6" enum="Type"> |
| 214 | A function for the "start" stage of particle shader, with customized output. |
| 215 | </constant> |
| 216 | <constant name="TYPE_PROCESS_CUSTOM" value="7" enum="Type"> |
| 217 | A function for the "process" stage of particle shader, with customized output. |
| 218 | </constant> |
| 219 | <constant name="TYPE_SKY" value="8" enum="Type"> |
| 220 | A shader for 3D environment's sky. |
| 221 | </constant> |
| 222 | <constant name="TYPE_FOG" value="9" enum="Type"> |
| 223 | A compute shader that runs for each froxel of the volumetric fog map. |
| 224 | </constant> |
| 225 | <constant name="TYPE_MAX" value="10" enum="Type"> |
| 226 | Represents the size of the [enum Type] enum. |
| 227 | </constant> |
| 228 | <constant name="VARYING_MODE_VERTEX_TO_FRAG_LIGHT" value="0" enum="VaryingMode"> |
| 229 | Varying is passed from [code]Vertex[/code] function to [code]Fragment[/code] and [code]Light[/code] functions. |
| 230 | </constant> |
| 231 | <constant name="VARYING_MODE_FRAG_TO_LIGHT" value="1" enum="VaryingMode"> |
| 232 | Varying is passed from [code]Fragment[/code] function to [code]Light[/code] function. |
| 233 | </constant> |
| 234 | <constant name="VARYING_MODE_MAX" value="2" enum="VaryingMode"> |
| 235 | Represents the size of the [enum VaryingMode] enum. |
| 236 | </constant> |
| 237 | <constant name="VARYING_TYPE_FLOAT" value="0" enum="VaryingType"> |
| 238 | Varying is of type [float]. |
| 239 | </constant> |
| 240 | <constant name="VARYING_TYPE_INT" value="1" enum="VaryingType"> |
| 241 | Varying is of type [int]. |
| 242 | </constant> |
| 243 | <constant name="VARYING_TYPE_UINT" value="2" enum="VaryingType"> |
| 244 | Varying is of type unsigned [int]. |
| 245 | </constant> |
| 246 | <constant name="VARYING_TYPE_VECTOR_2D" value="3" enum="VaryingType"> |
| 247 | Varying is of type [Vector2]. |
| 248 | </constant> |
| 249 | <constant name="VARYING_TYPE_VECTOR_3D" value="4" enum="VaryingType"> |
| 250 | Varying is of type [Vector3]. |
| 251 | </constant> |
| 252 | <constant name="VARYING_TYPE_VECTOR_4D" value="5" enum="VaryingType"> |
| 253 | Varying is of type [Vector4]. |
| 254 | </constant> |
| 255 | <constant name="VARYING_TYPE_BOOLEAN" value="6" enum="VaryingType"> |
| 256 | Varying is of type [bool]. |
| 257 | </constant> |
| 258 | <constant name="VARYING_TYPE_TRANSFORM" value="7" enum="VaryingType"> |
| 259 | Varying is of type [Transform3D]. |
| 260 | </constant> |
| 261 | <constant name="VARYING_TYPE_MAX" value="8" enum="VaryingType"> |
| 262 | Represents the size of the [enum VaryingType] enum. |
| 263 | </constant> |
| 264 | <constant name="NODE_ID_INVALID" value="-1"> |
| 265 | Indicates an invalid [VisualShader] node. |
| 266 | </constant> |
| 267 | <constant name="NODE_ID_OUTPUT" value="0"> |
| 268 | Indicates an output node of [VisualShader]. |
| 269 | </constant> |
| 270 | </constants> |
| 271 | </class> |