reckfellENGINE

VisualShaderNodeCustom

A C# resource for a custom Visual Shader graph block.

On this page
class VisualShaderNodeCustomReckfellSharpInherits VisualShaderNode

Declare ports and generate shader statements through _GetInputPort*(), _GetOutputPort*() and _GetCode() overrides. Use [Tool, GlobalClass] for automatic editor discovery. A single block needs neither EditorPlugin nor plugin.cfg. A graph node is not a game Entity.

_GetCode() strings contain shader language, not C#. Use the supplied inputVars/outputVars and unique shared-function names. Do not Dispose() a live C# block after handing it to a graph: this detaches its scripted behavior.

Complete example, persistence and verification limits.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

VisualShaderNodeCustomConstructor
# VisualShaderNodeCustom
C#
public VisualShaderNodeCustom();

Properties2

InitializedProperty
# Initialized
C#
public bool Initialized { get; set; }

Internal editor-element initialization flag. Do not use it as evidence of GPU compilation or material readiness. When true, ordinary custom-node input-default mutation methods are restricted.

PropertiesProperty
# Properties
C#
public string Properties { get; set; }

Internal serialized dropdown-selection data. Declare choices through _GetProperty*() and read selections through GetOptionIndex(); do not construct this string manually.

Methods22

GetOptionIndexint
# GetOptionIndex
C#
public int GetOptionIndex(int option);

Read a stored dropdown selection for code generation. If no value is stored for that setting, the native implementation returns 0.

Parameters
NameTypeDefault
optionint—
option

The dropdown setting index, not an input port number.

Returns int

The selected choice index.

_GetCategorystring
# _GetCategory
C#
public virtual string _GetCategory();

Set the custom block category path, for example Reckfell/Color. The editor adds an Addons prefix; / separates subcategories. Do not apply block-name restrictions to the entire path.

Returns string

A category path; the Addons prefix need not be supplied.

_GetCodestring
# _GetCode
C#
public virtual string _GetCode(Reckfell.Collections.Array<string> inputVars, Reckfell.Collections.Array<string> outputVars, Shader.Mode mode, VisualShader.Type type);

Return Reckfell shader-language statements for one block instance. Use inputVars expressions and assign results to outputVars; port labels are not substitutes for these strings. Do not redeclare a shared function in every instance.

Parameters
NameTypeDefault
inputVarsReckfell.Collections.Array<string>—
outputVarsReckfell.Collections.Array<string>—
modeShader.Mode—
typeVisualShader.Type—
inputVars

Input expressions or variable names ordered by port index.

outputVars

Output variable names to assign results to.

mode

The shader mode, such as CanvasItem or Spatial.

type

The graph stage, such as Fragment.

Returns string

The calculation statements, such as result = mix(a, b, weight); using actual argument names.

_GetDefaultInputPortint
# _GetDefaultInputPort
C#
public virtual int _GetDefaultInputPort(VisualShaderNode.PortType type);

Choose an input when creating a block by dragging a connection into empty graph space. Return a suitable index for the supplied type. The 1.0.0 native fallback returns 0 when not overridden.

Parameters
NameTypeDefault
typeVisualShaderNode.PortType—
type

The dragged connection type.

Returns int

An input port index.

_GetDescriptionstring
# _GetDescription
C#
public virtual string _GetDescription();

Set the block description in the add dialog. Briefly state the operation, ranges and mode limitations.

Returns string

The description text.

_GetFuncCodestring
# _GetFuncCode
C#
public virtual string _GetFuncCode(Shader.Mode mode, VisualShader.Type type);

Add shared code at the beginning of shader functions for this block type. Insertion order across different custom types is unspecified; do not depend on that order.

Parameters
NameTypeDefault
modeShader.Mode—
typeVisualShader.Type—
mode

The shader mode.

type

The stage whose function receives code.

Returns string

Function-prefix statements, or an empty string.

_GetGlobalCodestring
# _GetGlobalCode
C#
public virtual string _GetGlobalCode(Shader.Mode mode);

Add shared declarations outside shader functions. The generator emits them once per used C# script, even with several instances. Use unique names and do not store instance-specific state here.

Parameters
NameTypeDefault
modeShader.Mode—
mode

The generated shader mode.

Returns string

Global shader-language declarations, or an empty string.

_GetInputPortCountint
# _GetInputPortCount
C#
public virtual int _GetInputPortCount();

Declare the number of input ports. Name, type and default callbacks receive indices from 0 through this count minus one.

Returns int

The input count; without an override there are no inputs.

_GetInputPortDefaultValueVariant
# _GetInputPortDefaultValue
C#
public virtual Variant _GetInputPortDefaultValue(int port);

Return an initial value for an unconnected input. The editor applies this callback when inserting through its UI. In 1.0.0, programmatic VisualShader.AddNode() does not write these defaults: explicitly call SetInputPortDefaultValue() after adding.

Parameters
NameTypeDefault
portint—
port

The zero-based port index.

Returns Variant

A Variant matching the port type; Nil means no declared value.

_GetInputPortNamestring
# _GetInputPortName
C#
public virtual string _GetInputPortName(int port);

Set an input port label. This is not a ready-to-use GPU variable name: use the supplied inputVars[port] expression in _GetCode().

Parameters
NameTypeDefault
portint—
port

The zero-based port index.

Returns string

The input label.

_GetInputPortTypeVisualShaderNode.PortType
# _GetInputPortType
C#
public virtual VisualShaderNode.PortType _GetInputPortType(int port);

Declare an input data type. Keep its default and shader expressions consistent; Vector3D corresponds to vec3 and Scalar to float.

Parameters
NameTypeDefault
portint—
port

The zero-based port index.

Returns VisualShaderNode.PortType

The requested input type.

_GetNamestring
# _GetName
C#
public virtual string _GetName();

Set the block name in the add dialog and graph. Editor registration requires a valid ASCII identifier without spaces, such as BlendTint.

Returns string

The block name.

_GetOutputPortCountint
# _GetOutputPortCount
C#
public virtual int _GetOutputPortCount();

Declare the number of output ports. Assign each calculated output in _GetCode().

Returns int

The output count; without an override there are no outputs.

_GetOutputPortNamestring
# _GetOutputPortName
C#
public virtual string _GetOutputPortName(int port);

Set an output port label. Assign to outputVars[port] in _GetCode(), not to the label string.

Parameters
NameTypeDefault
portint—
port

The zero-based port index.

Returns string

The output label.

_GetOutputPortTypeVisualShaderNode.PortType
# _GetOutputPortType
C#
public virtual VisualShaderNode.PortType _GetOutputPortType(int port);

Declare an output data type; its generated assignment must produce a compatible value.

Parameters
NameTypeDefault
portint—
port

The zero-based port index.

Returns VisualShaderNode.PortType

The requested output type.

_GetPropertyCountint
# _GetPropertyCount
C#
public virtual int _GetPropertyCount();

Declare the number of dropdown settings on the custom block; this is not the input port count. Supply each setting name, option list and, when needed, default index.

Returns int

The number of dropdown settings.

_GetPropertyDefaultIndexint
# _GetPropertyDefaultIndex
C#
public virtual int _GetPropertyDefaultIndex(int index);

Declare the initial selected index of a dropdown setting. It must match the array returned by _GetPropertyOptions().

Parameters
NameTypeDefault
indexint—
index

The zero-based dropdown setting index.

Returns int

The zero-based selected choice index.

_GetPropertyNamestring
# _GetPropertyName
C#
public virtual string _GetPropertyName(int index);

Set a block dropdown setting label.

Parameters
NameTypeDefault
indexint—
index

The zero-based dropdown setting index.

Returns string

The setting label.

_GetPropertyOptionsstring[]
# _GetPropertyOptions
C#
public virtual string[] _GetPropertyOptions(int index);

Declare the ordered choices of a dropdown setting. Read its selected index through GetOptionIndex().

Parameters
NameTypeDefault
indexint—
index

The zero-based dropdown setting index.

Returns string[]

An array of choice labels.

_GetReturnIconTypeVisualShaderNode.PortType
# _GetReturnIconType
C#
public virtual VisualShaderNode.PortType _GetReturnIconType();

Choose the result-type icon in the add dialog. This is UI metadata; _GetOutputPortType() defines actual output types.

Returns VisualShaderNode.PortType

The port type used for the icon.

_IsAvailablebool
# _IsAvailable
C#
public virtual bool _IsAvailable(Shader.Mode mode, VisualShader.Type type);

Filter block availability by shader mode and graph stage; true by default. This does not translate shader code between modes or prove GPU compatibility.

Parameters
NameTypeDefault
modeShader.Mode—
typeVisualShader.Type—
mode

The shader mode being checked.

type

The graph stage being checked.

Returns bool

true for a supported context; false to exclude it.

_IsHighendbool
# _IsHighend
C#
public virtual bool _IsHighend();

Mark the block as requiring Forward+ or Mobile features in the add dialog. The default is false. This is editor guidance, not a renderer switch or a substitute for checking GPU code.

Returns bool

true for the high-end marker; otherwise false.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.