2018-07-26 09:56:21 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 08:08:05 +00:00
<class name= "VisualShader" inherits= "Shader" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2018-07-26 09:56:21 +00:00
<brief_description >
2019-10-11 15:06:57 +00:00
A custom shader program with a visual editor.
2018-07-26 09:56:21 +00:00
</brief_description>
<description >
2023-06-24 11:19:58 +00:00
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.
2018-07-26 09:56:21 +00:00
</description>
<tutorials >
2023-06-24 11:19:58 +00:00
<link title= "Using VisualShaders" > $DOCS_URL/tutorials/shaders/visual_shaders.html</link>
2018-07-26 09:56:21 +00:00
</tutorials>
<methods >
<method name= "add_node" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "node" type= "VisualShaderNode" />
<param index= "2" name= "position" type= "Vector2" />
<param index= "3" name= "id" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2022-08-08 23:41:07 +00:00
Adds the specified [param node] to the shader.
2018-07-26 09:56:21 +00:00
</description>
</method>
2022-01-09 14:02:13 +00:00
<method name= "add_varying" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "String" />
<param index= "1" name= "mode" type= "int" enum= "VisualShader.VaryingMode" />
<param index= "2" name= "type" type= "int" enum= "VisualShader.VaryingType" />
2022-01-09 14:02:13 +00:00
<description >
2022-12-07 14:59:34 +00:00
Adds a new varying value node to the shader.
2022-01-09 14:02:13 +00:00
</description>
</method>
2018-07-26 09:56:21 +00:00
<method name= "can_connect_nodes" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "from_node" type= "int" />
<param index= "2" name= "from_port" type= "int" />
<param index= "3" name= "to_node" type= "int" />
<param index= "4" name= "to_port" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Returns [code]true[/code] if the specified nodes and ports can be connected together.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "connect_nodes" >
2021-07-30 13:28:05 +00:00
<return type= "int" enum= "Error" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "from_node" type= "int" />
<param index= "2" name= "from_port" type= "int" />
<param index= "3" name= "to_node" type= "int" />
<param index= "4" name= "to_port" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Connects the specified nodes and ports.
2018-07-26 09:56:21 +00:00
</description>
</method>
2019-05-28 16:08:13 +00:00
<method name= "connect_nodes_forced" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "from_node" type= "int" />
<param index= "2" name= "from_port" type= "int" />
<param index= "3" name= "to_node" type= "int" />
<param index= "4" name= "to_port" type= "int" />
2019-05-28 16:08:13 +00:00
<description >
2020-03-03 18:21:21 +00:00
Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.
2019-05-28 16:08:13 +00:00
</description>
</method>
2018-07-26 09:56:21 +00:00
<method name= "disconnect_nodes" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "from_node" type= "int" />
<param index= "2" name= "from_port" type= "int" />
<param index= "3" name= "to_node" type= "int" />
<param index= "4" name= "to_port" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Connects the specified nodes and ports.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_node" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "VisualShaderNode" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "id" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2022-08-08 23:41:07 +00:00
Returns the shader node instance with specified [param type] and [param id].
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_node_connections" qualifiers= "const" >
2022-08-05 18:35:08 +00:00
<return type= "Dictionary[]" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Returns the list of connected nodes with the specified type.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_node_list" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "PackedInt32Array" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Returns the list of all nodes in the shader with the specified type.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_node_position" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "id" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Returns the position of the specified node within the shader graph.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_valid_node_id" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
2018-07-26 09:56:21 +00:00
<description >
2022-12-07 14:59:34 +00:00
Returns next valid node ID that can be added to the shader graph.
2018-07-26 09:56:21 +00:00
</description>
</method>
2022-01-09 14:02:13 +00:00
<method name= "has_varying" qualifiers= "const" >
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "String" />
2022-01-09 14:02:13 +00:00
<description >
2022-12-07 14:59:34 +00:00
Returns [code]true[/code] if the shader has a varying with the given [param name].
2022-01-09 14:02:13 +00:00
</description>
</method>
2018-07-26 09:56:21 +00:00
<method name= "is_node_connection" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "from_node" type= "int" />
<param index= "2" name= "from_port" type= "int" />
<param index= "3" name= "to_node" type= "int" />
<param index= "4" name= "to_port" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Returns [code]true[/code] if the specified node and port connection exist.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "remove_node" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "id" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Removes the specified node from the shader.
2018-07-26 09:56:21 +00:00
</description>
</method>
2022-01-09 14:02:13 +00:00
<method name= "remove_varying" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "String" />
2022-01-09 14:02:13 +00:00
<description >
2022-12-07 14:59:34 +00:00
Removes a varying value node with the given [param name]. Prints an error if a node with this name is not found.
2022-01-09 14:02:13 +00:00
</description>
</method>
2020-12-30 08:45:31 +00:00
<method name= "replace_node" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "id" type= "int" />
<param index= "2" name= "new_class" type= "StringName" />
2020-12-30 08:45:31 +00:00
<description >
Replaces the specified node with a node of new class type.
</description>
</method>
2018-07-26 09:56:21 +00:00
<method name= "set_mode" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "mode" type= "int" enum= "Shader.Mode" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Sets the mode of this shader.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "set_node_position" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "type" type= "int" enum= "VisualShader.Type" />
<param index= "1" name= "id" type= "int" />
<param index= "2" name= "position" type= "Vector2" />
2018-07-26 09:56:21 +00:00
<description >
2020-03-03 18:21:21 +00:00
Sets the position of the specified node.
2018-07-26 09:56:21 +00:00
</description>
</method>
</methods>
<members >
2019-09-24 17:45:03 +00:00
<member name= "graph_offset" type= "Vector2" setter= "set_graph_offset" getter= "get_graph_offset" default= "Vector2(0, 0)" >
2020-03-03 18:21:21 +00:00
The offset vector of the whole graph.
2018-07-26 09:56:21 +00:00
</member>
</members>
<constants >
<constant name= "TYPE_VERTEX" value= "0" enum= "Type" >
2020-03-03 18:21:21 +00:00
A vertex shader, operating on vertices.
2018-07-26 09:56:21 +00:00
</constant>
<constant name= "TYPE_FRAGMENT" value= "1" enum= "Type" >
2020-03-03 18:21:21 +00:00
A fragment shader, operating on fragments (pixels).
2018-07-26 09:56:21 +00:00
</constant>
<constant name= "TYPE_LIGHT" value= "2" enum= "Type" >
2020-03-13 16:16:44 +00:00
A shader for light calculations.
2018-07-26 09:56:21 +00:00
</constant>
2020-09-15 07:57:40 +00:00
<constant name= "TYPE_START" value= "3" enum= "Type" >
2022-12-07 14:59:34 +00:00
A function for the "start" stage of particle shader.
2020-09-04 08:43:11 +00:00
</constant>
2020-09-11 10:22:10 +00:00
<constant name= "TYPE_PROCESS" value= "4" enum= "Type" >
2022-12-07 14:59:34 +00:00
A function for the "process" stage of particle shader.
2020-09-11 10:22:10 +00:00
</constant>
2020-09-15 07:57:40 +00:00
<constant name= "TYPE_COLLIDE" value= "5" enum= "Type" >
2022-12-07 14:59:34 +00:00
A function for the "collide" stage (particle collision handler) of particle shader.
2020-09-11 10:22:10 +00:00
</constant>
2020-09-15 07:57:40 +00:00
<constant name= "TYPE_START_CUSTOM" value= "6" enum= "Type" >
2022-12-07 14:59:34 +00:00
A function for the "start" stage of particle shader, with customized output.
2021-04-19 10:26:37 +00:00
</constant>
2020-09-15 07:57:40 +00:00
<constant name= "TYPE_PROCESS_CUSTOM" value= "7" enum= "Type" >
2022-12-07 14:59:34 +00:00
A function for the "process" stage of particle shader, with customized output.
2020-09-15 07:57:40 +00:00
</constant>
<constant name= "TYPE_SKY" value= "8" enum= "Type" >
2022-12-07 14:59:34 +00:00
A shader for 3D environment's sky.
2020-09-15 07:57:40 +00:00
</constant>
2021-10-03 11:28:55 +00:00
<constant name= "TYPE_FOG" value= "9" enum= "Type" >
A compute shader that runs for each froxel of the volumetric fog map.
</constant>
<constant name= "TYPE_MAX" value= "10" enum= "Type" >
2019-06-27 09:10:53 +00:00
Represents the size of the [enum Type] enum.
2018-07-26 09:56:21 +00:00
</constant>
2022-01-09 14:02:13 +00:00
<constant name= "VARYING_MODE_VERTEX_TO_FRAG_LIGHT" value= "0" enum= "VaryingMode" >
2022-12-07 14:59:34 +00:00
Varying is passed from [code]Vertex[/code] function to [code]Fragment[/code] and [code]Light[/code] functions.
2022-01-09 14:02:13 +00:00
</constant>
<constant name= "VARYING_MODE_FRAG_TO_LIGHT" value= "1" enum= "VaryingMode" >
2022-12-07 14:59:34 +00:00
Varying is passed from [code]Fragment[/code] function to [code]Light[/code] function.
2022-01-09 14:02:13 +00:00
</constant>
<constant name= "VARYING_MODE_MAX" value= "2" enum= "VaryingMode" >
2022-12-07 14:59:34 +00:00
Represents the size of the [enum VaryingMode] enum.
2022-01-09 14:02:13 +00:00
</constant>
<constant name= "VARYING_TYPE_FLOAT" value= "0" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type [float].
2022-01-09 14:02:13 +00:00
</constant>
2022-08-24 09:41:42 +00:00
<constant name= "VARYING_TYPE_INT" value= "1" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type [int].
2022-01-09 14:02:13 +00:00
</constant>
2022-12-27 17:49:11 +00:00
<constant name= "VARYING_TYPE_UINT" value= "2" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type unsigned [int].
2022-01-09 14:02:13 +00:00
</constant>
2022-12-27 17:49:11 +00:00
<constant name= "VARYING_TYPE_VECTOR_2D" value= "3" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type [Vector2].
2022-01-09 14:02:13 +00:00
</constant>
2022-12-27 17:49:11 +00:00
<constant name= "VARYING_TYPE_VECTOR_3D" value= "4" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type [Vector3].
2022-01-09 14:02:13 +00:00
</constant>
2022-12-27 17:49:11 +00:00
<constant name= "VARYING_TYPE_VECTOR_4D" value= "5" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type [Vector4].
2022-04-12 17:09:29 +00:00
</constant>
2022-12-27 17:49:11 +00:00
<constant name= "VARYING_TYPE_BOOLEAN" value= "6" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type [bool].
2022-08-24 09:41:42 +00:00
</constant>
2022-12-27 17:49:11 +00:00
<constant name= "VARYING_TYPE_TRANSFORM" value= "7" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Varying is of type [Transform3D].
2022-12-27 17:49:11 +00:00
</constant>
<constant name= "VARYING_TYPE_MAX" value= "8" enum= "VaryingType" >
2022-12-07 14:59:34 +00:00
Represents the size of the [enum VaryingType] enum.
2022-01-09 14:02:13 +00:00
</constant>
2018-07-26 09:56:21 +00:00
<constant name= "NODE_ID_INVALID" value= "-1" >
2024-02-29 23:59:28 +00:00
Indicates an invalid [VisualShader] node.
2018-07-26 09:56:21 +00:00
</constant>
<constant name= "NODE_ID_OUTPUT" value= "0" >
2024-02-29 23:59:28 +00:00
Indicates an output node of [VisualShader].
2018-07-26 09:56:21 +00:00
</constant>
</constants>
</class>