Class VisualShader
- Namespace
- Godot
- Assembly
- GodotSharp.dll
This class provides a graph-like visual editor for creating a Shader. Although VisualShaders do not require coding, they share the same logic with script shaders. They use VisualShaderNodes 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.
public class VisualShader : Shader, IDisposable
- Inheritance
-
VisualShader
- Implements
- Inherited Members
Constructors
VisualShader()
public VisualShader()
Fields
NodeIdInvalid
Indicates an invalid VisualShader node.
public const long NodeIdInvalid = -1
Field Value
NodeIdOutput
Indicates an output node of VisualShader.
public const long NodeIdOutput = 0
Field Value
Properties
GraphOffset
The offset vector of the whole graph.
public Vector2 GraphOffset { get; set; }
Property Value
Methods
AddNode(Type, VisualShaderNode, Vector2, int)
Adds the specified node to the shader.
public void AddNode(VisualShader.Type type, VisualShaderNode node, Vector2 position, int id)
Parameters
typeVisualShader.TypenodeVisualShaderNodepositionVector2idint
AddVarying(string, VaryingMode, VaryingType)
Adds a new varying value node to the shader.
public void AddVarying(string name, VisualShader.VaryingMode mode, VisualShader.VaryingType type)
Parameters
namestringmodeVisualShader.VaryingModetypeVisualShader.VaryingType
AttachNodeToFrame(Type, int, int)
Attaches the given node to the given frame.
public void AttachNodeToFrame(VisualShader.Type type, int id, int frame)
Parameters
typeVisualShader.Typeidintframeint
CanConnectNodes(Type, int, int, int, int)
Returns true if the specified nodes and ports can be connected together.
public bool CanConnectNodes(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort)
Parameters
Returns
ConnectNodes(Type, int, int, int, int)
Connects the specified nodes and ports.
public Error ConnectNodes(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort)
Parameters
Returns
ConnectNodesForced(Type, int, int, int, int)
Connects the specified nodes and ports, even if they can't be connected. Such connection is invalid and will not function properly.
public void ConnectNodesForced(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort)
Parameters
DetachNodeFromFrame(Type, int)
Detaches the given node from the frame it is attached to.
public void DetachNodeFromFrame(VisualShader.Type type, int id)
Parameters
typeVisualShader.Typeidint
DisconnectNodes(Type, int, int, int, int)
Connects the specified nodes and ports.
public void DisconnectNodes(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort)
Parameters
GetNode(Type, int)
Returns the shader node instance with specified type and id.
public VisualShaderNode GetNode(VisualShader.Type type, int id)
Parameters
typeVisualShader.Typeidint
Returns
GetNodeConnections(Type)
Returns the list of connected nodes with the specified type.
public Array<Dictionary> GetNodeConnections(VisualShader.Type type)
Parameters
typeVisualShader.Type
Returns
GetNodeList(Type)
Returns the list of all nodes in the shader with the specified type.
public int[] GetNodeList(VisualShader.Type type)
Parameters
typeVisualShader.Type
Returns
- int[]
GetNodePosition(Type, int)
Returns the position of the specified node within the shader graph.
public Vector2 GetNodePosition(VisualShader.Type type, int id)
Parameters
typeVisualShader.Typeidint
Returns
GetValidNodeId(Type)
Returns next valid node ID that can be added to the shader graph.
public int GetValidNodeId(VisualShader.Type type)
Parameters
typeVisualShader.Type
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
methodgodot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signalgodot_string_nameName of the signal to check for.
Returns
HasVarying(string)
Returns true if the shader has a varying with the given name.
public bool HasVarying(string name)
Parameters
namestring
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
methodgodot_string_nameName of the method to invoke.
argsNativeVariantPtrArgsArguments to use with the invoked method.
retgodot_variantValue returned by the invoked method.
Returns
IsNodeConnection(Type, int, int, int, int)
Returns true if the specified node and port connection exist.
public bool IsNodeConnection(VisualShader.Type type, int fromNode, int fromPort, int toNode, int toPort)
Parameters
Returns
RemoveNode(Type, int)
Removes the specified node from the shader.
public void RemoveNode(VisualShader.Type type, int id)
Parameters
typeVisualShader.Typeidint
RemoveVarying(string)
Removes a varying value node with the given name. Prints an error if a node with this name is not found.
public void RemoveVarying(string name)
Parameters
namestring
ReplaceNode(Type, int, StringName)
Replaces the specified node with a node of new class type.
public void ReplaceNode(VisualShader.Type type, int id, StringName newClass)
Parameters
typeVisualShader.TypeidintnewClassStringName
SetMode(Mode)
Sets the mode of this shader.
public void SetMode(Shader.Mode mode)
Parameters
SetNodePosition(Type, int, Vector2)
Sets the position of the specified node.
public void SetNodePosition(VisualShader.Type type, int id, Vector2 position)
Parameters
typeVisualShader.TypeidintpositionVector2