VisualShaderGroup
A reusable group of VisualShaderNodes similar to a function in programming.
A reusable group of VisualShaderNodes similar to a function in programming.
A VisualShaderGroup encapsulates a graph of VisualShaderNodes into a reusable component. It defines its own input and output ports, which become the interface when the group is used as a VisualShaderNodeGroup node inside a VisualShader or another VisualShaderGroup.
Since an actual shader function is created for each VisualShaderGroup, you can only use global built-in variables. Parameter and Varying related nodes are not allowed.
If the group contains nodes that are incompatible with the shader context it is used in (e.g. particle nodes in a spatial shader), the group's outputs will silently fall back to default values.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VisualShaderGroupConstructor
public VisualShaderGroup();Properties3
GroupNameProperty
public string GroupName { get; set; }The display name of this group. This name is shown as the caption of the VisualShaderNodeGroup node in the editor.
InputPortCountProperty
public int InputPortCount { get; set; }The number of input ports defined for this group. Shrinking the array removes the trailing ports along with any connections made to them.
OutputPortCountProperty
public int OutputPortCount { get; set; }The number of output ports defined for this group. Shrinking the array removes the trailing ports along with any connections made to them.
Methods36
AddNodevoid
public void AddNode(VisualShaderNode node, Vector2 position, int id);| Name | Type | Default |
|---|---|---|
node | VisualShaderNode | — |
position | Vector2 | — |
id | int | — |
AttachNodeToFramevoid
public void AttachNodeToFrame(int id, int frame);Attaches the given node to the given frame.
| Name | Type | Default |
|---|---|---|
id | int | — |
frame | int | — |
CanConnectNodesbool
public bool CanConnectNodes(int fromNode, int fromPort, int toNode, int toPort);Returns true if the specified nodes and ports can be connected.
| Name | Type | Default |
|---|---|---|
fromNode | int | — |
fromPort | int | — |
toNode | int | — |
toPort | int | — |
boolConnectNodesError
public Error ConnectNodes(int fromNode, int fromPort, int toNode, int toPort);Connects the specified nodes and ports.
| Name | Type | Default |
|---|---|---|
fromNode | int | — |
fromPort | int | — |
toNode | int | — |
toPort | int | — |
ErrorConnectNodesForcedvoid
public void ConnectNodesForced(int fromNode, int fromPort, int toNode, int toPort);Connects the specified nodes and ports, even if they can't be connected.
| Name | Type | Default |
|---|---|---|
fromNode | int | — |
fromPort | int | — |
toNode | int | — |
toPort | int | — |
DetachNodeFromFramevoid
public void DetachNodeFromFrame(int id);Detaches the given node from the frame it is attached to.
| Name | Type | Default |
|---|---|---|
id | int | — |
DisconnectNodesvoid
public void DisconnectNodes(int fromNode, int fromPort, int toNode, int toPort);Disconnects the specified nodes and ports.
| Name | Type | Default |
|---|---|---|
fromNode | int | — |
fromPort | int | — |
toNode | int | — |
toPort | int | — |
GetGroupNamestring
public string GetGroupName();stringGetInputPortCountint
public int GetInputPortCount();intGetInputPortNamestring
public string GetInputPortName(int id);Returns the name of the input port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
stringGetInputPortTypeVisualShaderNode.PortType
public VisualShaderNode.PortType GetInputPortType(int id);Returns the type of the input port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
VisualShaderNode.PortTypeGetNodeVisualShaderNode
public VisualShaderNode GetNode(int id);| Name | Type | Default |
|---|---|---|
id | int | — |
VisualShaderNodeGetNodeConnectionsReckfell.Collections.Array<Reckfell.Collections.Dictionary>
public Reckfell.Collections.Array<Reckfell.Collections.Dictionary> GetNodeConnections();Returns the list of connected nodes.
Reckfell.Collections.Array<Reckfell.Collections.Dictionary>GetNodeListint[]
public int[] GetNodeList();Returns the list of all nodes in the group.
int[]GetNodePositionVector2
public Vector2 GetNodePosition(int id);Returns the position of the specified node within the shader graph.
| Name | Type | Default |
|---|---|---|
id | int | — |
Vector2GetOutputPortCountint
public int GetOutputPortCount();intGetOutputPortNamestring
public string GetOutputPortName(int id);Returns the name of the output port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
stringGetOutputPortTypeVisualShaderNode.PortType
public VisualShaderNode.PortType GetOutputPortType(int id);Returns the type of the output port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
VisualShaderNode.PortTypeGetValidNodeIdint
public int GetValidNodeId();Returns the next valid node ID that can be added to the shader graph.
intInsertInputPortstring
public string InsertInputPort(int id, VisualShaderNode.PortType type, string name);Inserts an input port at the given id with the specified type and name.
Returns the validated port name, which may differ from name if a port with the same name already exists. Port names must be unique across both input and output ports.
| Name | Type | Default |
|---|---|---|
id | int | — |
type | VisualShaderNode.PortType | — |
name | string | — |
stringInsertOutputPortstring
public string InsertOutputPort(int id, VisualShaderNode.PortType type, string name);Inserts an output port at the given id with the specified type and name.
Returns the validated port name, which may differ from name if a port with the same name already exists. Port names must be unique across both input and output ports.
| Name | Type | Default |
|---|---|---|
id | int | — |
type | VisualShaderNode.PortType | — |
name | string | — |
stringIsNodeConnectionbool
public bool IsNodeConnection(int fromNode, int fromPort, int toNode, int toPort);Returns true if the specified node and port connection exists.
| Name | Type | Default |
|---|---|---|
fromNode | int | — |
fromPort | int | — |
toNode | int | — |
toPort | int | — |
boolMoveInputPortvoid
public void MoveInputPort(int from, int to);Moves the input port at index from to index to. Connections from input nodes inside the group will be updated accordingly.
| Name | Type | Default |
|---|---|---|
from | int | — |
to | int | — |
MoveOutputPortvoid
public void MoveOutputPort(int from, int to);Moves the output port at index from to index to. Connections to output nodes inside the group will be updated accordingly.
| Name | Type | Default |
|---|---|---|
from | int | — |
to | int | — |
RemoveInputPortvoid
public void RemoveInputPort(int id);Removes the input port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
RemoveNodevoid
public void RemoveNode(int id);Removes the specified node from the group.
| Name | Type | Default |
|---|---|---|
id | int | — |
RemoveOutputPortvoid
public void RemoveOutputPort(int id);Removes the output port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
ReplaceNodevoid
public void ReplaceNode(int id, StringName newClass);Replaces the specified node with a node of the new class type.
| Name | Type | Default |
|---|---|---|
id | int | — |
newClass | StringName | — |
SetGroupNamevoid
public void SetGroupName(string name);| Name | Type | Default |
|---|---|---|
name | string | — |
SetInputPortCountvoid
public void SetInputPortCount(int count);| Name | Type | Default |
|---|---|---|
count | int | — |
SetInputPortNamevoid
public void SetInputPortName(int id, string name);Sets the name of the input port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
name | string | — |
SetInputPortTypevoid
public void SetInputPortType(int id, VisualShaderNode.PortType type);Sets the type of the input port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
type | VisualShaderNode.PortType | — |
SetNodePositionvoid
public void SetNodePosition(int id, Vector2 position);Sets the position of the specified node.
| Name | Type | Default |
|---|---|---|
id | int | — |
position | Vector2 | — |
SetOutputPortCountvoid
public void SetOutputPortCount(int count);| Name | Type | Default |
|---|---|---|
count | int | — |
SetOutputPortNamevoid
public void SetOutputPortName(int id, string name);Sets the name of the output port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
name | string | — |
SetOutputPortTypevoid
public void SetOutputPortType(int id, VisualShaderNode.PortType type);Sets the type of the output port at the given id.
| Name | Type | Default |
|---|---|---|
id | int | — |
type | VisualShaderNode.PortType | — |