VisualShaderNodeCustom

Inherits: VisualShaderNode < Resource < RefCounted < Object

Virtual class to define custom VisualShaderNodes for use in the Visual Shader Editor.

Description

By inheriting this class you can create a custom VisualShader script addon which will be automatically added to the Visual Shader Editor. The VisualShaderNode's behavior is defined by overriding the provided virtual methods.

In order for the node to be registered as an editor addon, you must use the @tool annotation and provide a class_name for your custom script. For example:

@tool
extends VisualShaderNodeCustom
class_name VisualShaderNodeNoise

Tutorials

Methods

String

_get_category ( ) virtual const

String

_get_code ( String[] input_vars, String[] output_vars, Mode mode, Type type ) virtual const

int

_get_default_input_port ( PortType type ) virtual const

String

_get_description ( ) virtual const

String

_get_func_code ( Mode mode, Type type ) virtual const

String

_get_global_code ( Mode mode ) virtual const

int

_get_input_port_count ( ) virtual const

String

_get_input_port_name ( int port ) virtual const

PortType

_get_input_port_type ( int port ) virtual const

String

_get_name ( ) virtual const

int

_get_output_port_count ( ) virtual const

String

_get_output_port_name ( int port ) virtual const

PortType

_get_output_port_type ( int port ) virtual const

PortType

_get_return_icon_type ( ) virtual const

bool

_is_available ( Mode mode, Type type ) virtual const

bool

_is_highend ( ) virtual const


Method Descriptions

String _get_category ( ) virtual const

Override this method to define the path to the associated custom node in the Visual Shader Editor's members dialog. The path may look like "MyGame/MyFunctions/Noise".

Defining this method is optional. If not overridden, the node will be filed under the "Addons" category.


String _get_code ( String[] input_vars, String[] output_vars, Mode mode, Type type ) virtual const

Override this method to define the actual shader code of the associated custom node. The shader code should be returned as a string, which can have multiple lines (the """ multiline string construct can be used for convenience).

The input_vars and output_vars arrays contain the string names of the various input and output variables, as defined by _get_input_* and