reckfellENGINE

VoxelGraphFunction

Graph for generating or processing series of 3D values.

On this page
class VoxelGraphFunctionReckfellSharpInherits Resource

Graph for generating or processing series of 3D values.

Contains a graph that can be used to process series of values, such as voxel positions (when used as main function of a generator), or to be re-used into other graphs (like a sub-graph). Currently this class only stores a graph, it cannot run actual processing on its own. It is usually embedded into another resource which then makes use of the graph in a specific way. To generate voxels with it, see VoxelGeneratorGraph. Nodes can be connected together from their outputs to the inputs of next nodes. Unconnected inputs can have default values or default implicit connections. Nodes can also have "parameters" which are constants setup per node. Nodes come in 3 main families: inputs (only have outputs), outputs (only have inputs), and others (which have both inputs and output to do some calculation). Entity types are identified with the enum VoxelGraphFunction.NodeTypeId. This enum shouldn't be used in persistent contexts (such as save files) as its values may change between versions. Graphs can only process 32-bit floating point values. Description of node types is present in the graph editor node dialog, or at [url]https://voxel-tools.readthedocs.io/en/latest/graph_nodes[/url].

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

Constructors1

VoxelGraphFunctionConstructor
# VoxelGraphFunction
C#
public VoxelGraphFunction();

Properties3

GraphDataProperty
# GraphData
C#
public Reckfell.Collections.Dictionary GraphData { get; set; }
InputDefinitionsProperty
# InputDefinitions
C#
public Reckfell.Collections.Array InputDefinitions { get; set; }
OutputDefinitionsProperty
# OutputDefinitions
C#
public Reckfell.Collections.Array OutputDefinitions { get; set; }

Methods34

AddConnectionvoid
# AddConnection
C#
public void AddConnection(uint srcNodeId, uint srcPortIndex, uint dstNodeId, uint dstPortIndex);

Connects the outputs of a node to the input of another node. Connecting a node to itself, or in a way that can lead it back to itself, is not supported.

Parameters
NameTypeDefault
srcNodeIduint—
srcPortIndexuint—
dstNodeIduint—
dstPortIndexuint—
CanConnectbool
# CanConnect
C#
public bool CanConnect(uint srcNodeId, uint srcPortIndex, uint dstNodeId, uint dstPortIndex);

Tests if two ports can be connected together.

Parameters
NameTypeDefault
srcNodeIduint—
srcPortIndexuint—
dstNodeIduint—
dstPortIndexuint—
Returns bool
Clearvoid
# Clear
C#
public void Clear();

Removes all nodes from the graph. Input and output definitions will not be cleared.

CreateFunctionNodeuint
# CreateFunctionNode
C#
public uint CreateFunctionNode(VoxelGraphFunction function, Vector2 position, uint id = 0);

Creates a node based on an existing graph (creates a "sub-graph instance").

Parameters
NameTypeDefault
functionVoxelGraphFunction—
positionVector2—
iduint0
Returns uint
CreateNodeuint
# CreateNode
C#
public uint CreateNode(VoxelGraphFunction.NodeTypeId typeId, Vector2 position, uint id = 0);

Creates a graph node of a given type at a specific visual position. The position parameter does not affect how the graph will perform, however it helps organizing nodes. An optional ID can be specified. If left to 0, the ID will be generated. This function then returns the ID of the node, which may be useful to modify other properties of the node later.

Parameters
NameTypeDefault
typeIdVoxelGraphFunction.NodeTypeId—
positionVector2—
iduint0
Returns uint
FindNodeByNameuint
# FindNodeByName
C#
public uint FindNodeByName(StringName name);

Finds a node with the specified name and returns its ID. If the node is not found, returns 0.

Parameters
NameTypeDefault
nameStringName—
Returns uint
GetConnectionsReckfell.Collections.Array
# GetConnections
C#
public Reckfell.Collections.Array GetConnections();

Gets an array describing all connections between nodes. The array has the following format:

Text
[
    {
        "src_node_id": int,
        "src_port_index": int,
        "dst_node_id": int,
        "dst_port_index": int
    },
    ...
]
Returns Reckfell.Collections.Array
GetNodeDefaultInputVariant
# GetNodeDefaultInput
C#
public Variant GetNodeDefaultInput(uint nodeId, int inputIndex);
Parameters
NameTypeDefault
nodeIduint—
inputIndexint—
Returns Variant
GetNodeDefaultInputsAutoconnectbool
# GetNodeDefaultInputsAutoconnect
C#
public bool GetNodeDefaultInputsAutoconnect(uint nodeId);
Parameters
NameTypeDefault
nodeIduint—
Returns bool
GetNodeGuiPositionVector2
# GetNodeGuiPosition
C#
public Vector2 GetNodeGuiPosition(uint nodeId);

Get the position of the node in the graph editor.

Parameters
NameTypeDefault
nodeIduint—
Returns Vector2
GetNodeGuiSizeVector2
# GetNodeGuiSize
C#
public Vector2 GetNodeGuiSize(uint nodeId);

Get the size of the node in the graph editor.

Parameters
NameTypeDefault
nodeIduint—
Returns Vector2
GetNodeIdsint[]
# GetNodeIds
C#
public int[] GetNodeIds();

Get a list of IDs of all the nodes in the graph. Note: the order in which IDs are returned is not guaranteed to be the same after nodes are added or removed.

Returns int[]
GetNodeInputIndexint
# GetNodeInputIndex
C#
public int GetNodeInputIndex(uint nodeId, string inputName);

Gets the input index of a node from the input's name.

Parameters
NameTypeDefault
nodeIduint—
inputNamestring—
Returns int
GetNodeNameStringName
# GetNodeName
C#
public StringName GetNodeName(uint nodeId);
Parameters
NameTypeDefault
nodeIduint—
Returns StringName
GetNodeOutputIndexint
# GetNodeOutputIndex
C#
public int GetNodeOutputIndex(uint nodeId, string outputName);

Gets the output index of a node from the output's name.

Parameters
NameTypeDefault
nodeIduint—
outputNamestring—
Returns int
GetNodeParamVariant
# GetNodeParam
C#
public Variant GetNodeParam(uint nodeId, int paramIndex);

Get a parameter of a node. The parameter index corresponds to the position that parameter comes in when seen in the editor.

Parameters
NameTypeDefault
nodeIduint—
paramIndexint—
Returns Variant
GetNodeTypeCountint
# GetNodeTypeCount
C#
public int GetNodeTypeCount();
Returns int
GetNodeTypeIdVoxelGraphFunction.NodeTypeId
# GetNodeTypeId
C#
public VoxelGraphFunction.NodeTypeId GetNodeTypeId(uint nodeId);

Get the ID of the type of a node in the graph.

Parameters
NameTypeDefault
nodeIduint—
Returns VoxelGraphFunction.NodeTypeId
GetNodeTypeInfoReckfell.Collections.Dictionary
# GetNodeTypeInfo
C#
public Reckfell.Collections.Dictionary GetNodeTypeInfo(int typeId);
Parameters
NameTypeDefault
typeIdint—
Returns Reckfell.Collections.Dictionary
PasteGraphWithPreGeneratedIds2 overloads
# PasteGraphWithPreGeneratedIds · 1/2
C#
public void PasteGraphWithPreGeneratedIds(VoxelGraphFunction graph, int[] nodeIds, Vector2 guiOffset);

Copies nodes into another graph, and connections between them only. Resources in node parameters will be duplicated if they don't have a file path. If node_ids is provided with non-zero size, defines the IDs copied nodes will have in the destination graph, in the same order as VoxelGraphFunction.GetNodeIds from the source graph. The array must have the same size as the number of copied nodes and IDs must not already exist in the destination graph. If the array is empty, they will be generated instead.

Parameters
NameTypeDefault
graphVoxelGraphFunction—
nodeIdsint[]—
guiOffsetVector2—
# PasteGraphWithPreGeneratedIds · 2/2
C#
public void PasteGraphWithPreGeneratedIds(VoxelGraphFunction graph, ReadOnlySpan<int> nodeIds, Vector2 guiOffset);

Copies nodes into another graph, and connections between them only. Resources in node parameters will be duplicated if they don't have a file path. If node_ids is provided with non-zero size, defines the IDs copied nodes will have in the destination graph, in the same order as VoxelGraphFunction.GetNodeIds from the source graph. The array must have the same size as the number of copied nodes and IDs must not already exist in the destination graph. If the array is empty, they will be generated instead.

Parameters
NameTypeDefault
graphVoxelGraphFunction—
nodeIdsReadOnlySpan<int>—
guiOffsetVector2—
RemoveConnectionvoid
# RemoveConnection
C#
public void RemoveConnection(uint srcNodeId, uint srcPortIndex, uint dstNodeId, uint dstPortIndex);

Removes an existing connection between two nodes of the graph.

Parameters
NameTypeDefault
srcNodeIduint—
srcPortIndexuint—
dstNodeIduint—
dstPortIndexuint—
RemoveNodevoid
# RemoveNode
C#
public void RemoveNode(uint nodeId);

Removes a node from the graph.

Parameters
NameTypeDefault
nodeIduint—
SetExpressionNodeInputs2 overloads
# SetExpressionNodeInputs · 1/2
C#
public void SetExpressionNodeInputs(uint nodeId, ReadOnlySpan<string> names);

Configures inputs for an Expression node. names is the list of input names used in the expression. If you create an Expression node from code, you should call this method afterwards.

Parameters
NameTypeDefault
nodeIduint—
namesReadOnlySpan<string>—
# SetExpressionNodeInputs · 2/2
C#
public void SetExpressionNodeInputs(uint nodeId, string[] names);

Configures inputs for an Expression node. names is the list of input names used in the expression. If you create an Expression node from code, you should call this method afterwards.

Parameters
NameTypeDefault
nodeIduint—
namesstring[]—
SetNodeDefaultInputvoid
# SetNodeDefaultInput
C#
public void SetNodeDefaultInput(uint nodeId, int inputIndex, Variant value);

Sets the value an input of a node will have when it is left unconnected.

Parameters
NameTypeDefault
nodeIduint—
inputIndexint—
valueVariant—
SetNodeDefaultInputByNamevoid
# SetNodeDefaultInputByName
C#
public void SetNodeDefaultInputByName(uint nodeId, string inputName, Variant value);

Sets the value an input of a node will have when it is left unconnected. The input is specified by its name as seen in the editor.

Parameters
NameTypeDefault
nodeIduint—
inputNamestring—
valueVariant—
SetNodeDefaultInputsAutoconnectvoid
# SetNodeDefaultInputsAutoconnect
C#
public void SetNodeDefaultInputsAutoconnect(uint nodeId, bool enabled);

Sets wether a node input with no inbound connection will automatically create a default connection when the graph is compiled. This is only available on specific nodes (for example, 2D or 3D noise defaults to XYZ inputs). On other nodes, it has no effect.

Parameters
NameTypeDefault
nodeIduint—
enabledbool—
SetNodeGuiPositionvoid
# SetNodeGuiPosition
C#
public void SetNodeGuiPosition(uint nodeId, Vector2 position);

Sets the visual position of a node of the graph, as it will appear in the editor.

Parameters
NameTypeDefault
nodeIduint—
positionVector2—
SetNodeGuiSizevoid
# SetNodeGuiSize
C#
public void SetNodeGuiSize(uint nodeId, Vector2 size);

Sets the visual size of a node of the graph, as it will appear in the editor.

Parameters
NameTypeDefault
nodeIduint—
sizeVector2—
SetNodeNamevoid
# SetNodeName
C#
public void SetNodeName(uint nodeId, StringName name);

Sets a custom name for a node.

Parameters
NameTypeDefault
nodeIduint—
nameStringName—
SetNodeParamvoid
# SetNodeParam
C#
public void SetNodeParam(uint nodeId, int paramIndex, Variant value);

Set a parameter of a node. The parameter index corresponds to the position that parameter comes in when seen in the editor.

Parameters
NameTypeDefault
nodeIduint—
paramIndexint—
valueVariant—
SetNodeParamByNamevoid
# SetNodeParamByName
C#
public void SetNodeParamByName(uint nodeId, string paramName, Variant value);

Set a parameter of a node, using its name as it appears in the editor.

Parameters
NameTypeDefault
nodeIduint—
paramNamestring—
valueVariant—
SetNodeParamNullvoid
# SetNodeParamNull
C#
public void SetNodeParamNull(int nodeId, int paramIndex);

Set a parameter of a node to null. This method only exists to workaround an issue with Reckfell's UndoRedo system. Prefer using VoxelGraphFunction.SetNodeParam.

Parameters
NameTypeDefault
nodeIdint—
paramIndexint—

Signals and events2

CompiledEvent
# Compiled
C#
public event Action Compiled;

Emitted after the graph finished compiling, even if compiling failed.

NodeNameChangedEvent
# NodeNameChanged
C#
public event VoxelGraphFunction.NodeNameChangedEventHandler NodeNameChanged;
Handler parameters
NameTypeDefault
nodeIdlong—

VoxelGraphFunction.NodeTypeId

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.