Class reference

VisualShaderNode

Inherits Resource

Base class for VisualShader nodes. Not related to scene nodes.

Description

Visual shader graphs consist of various nodes. Each node in the graph is a separate object and they are represented as a rectangular boxes with title and a set of properties. Each node also has connection ports that allow to connect it to another nodes and control the flow of the shader.

Properties

int linked_parent_graph_frame = -1

Represents the index of the frame this node is linked to. If set to -1 the node is not linked to any frame.

int output_port_for_preview = -1

Sets the output port index which will be showed for preview. If set to -1 no port will be open for preview.

Methods

void clear_default_input_values()

Clears the default input ports value.

int get_default_input_port(int type) const

Returns the input port which should be connected by default when this node is created as a result of dragging a connection from an existing node to the empty space on the graph.

Array get_default_input_values() const

Returns an Array containing default values for all of the input ports of the node in the form [index0, value0, index1, value1, ...].

Variant get_input_port_default_value(int port) const

Returns the default value of the input port.

void remove_input_port_default_value(int port)

Removes the default value of the input port.

void set_default_input_values(Array values)

Sets the default input ports values using an Array of the form [index0, value0, index1, value1, ...]. For example: [0, Vector3(0, 0, 0), 1, Vector3(0, 0, 0)].

void set_input_port_default_value(int port, Variant value, Variant prev_value = null)

Sets the default value for the selected input port.

Constants

PORT_TYPE_SCALAR = 0

Enum: PortType

Floating-point scalar. Translated to [code skip-lint]float[/code] type in shader code.

PORT_TYPE_SCALAR_INT = 1

Enum: PortType

Integer scalar. Translated to [code skip-lint]int[/code] type in shader code.

PORT_TYPE_SCALAR_UINT = 2

Enum: PortType

Unsigned integer scalar. Translated to [code skip-lint]uint[/code] type in shader code.

PORT_TYPE_VECTOR_2D = 3

Enum: PortType

2D vector of floating-point values. Translated to [code skip-lint]vec2[/code] type in shader code.

PORT_TYPE_VECTOR_3D = 4

Enum: PortType

3D vector of floating-point values. Translated to [code skip-lint]vec3[/code] type in shader code.

PORT_TYPE_VECTOR_4D = 5

Enum: PortType

4D vector of floating-point values. Translated to [code skip-lint]vec4[/code] type in shader code.

PORT_TYPE_BOOLEAN = 6

Enum: PortType

Boolean type. Translated to [code skip-lint]bool[/code] type in shader code.

PORT_TYPE_TRANSFORM = 7

Enum: PortType

Transform type. Translated to [code skip-lint]mat4[/code] type in shader code.

PORT_TYPE_SAMPLER = 8

Enum: PortType

Sampler type. Translated to reference of sampler uniform in shader code. Can only be used for input ports in non-uniform nodes.

PORT_TYPE_MAX = 9

Enum: PortType

Represents the size of the PortType enum.

Tutorials

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.