VoxelGraphFunction¶
Inherits: Resource
Graph for generating or processing voxels.
Description:¶
Contains a graph that can be used to generate voxel data (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. To generate voxels with it, see VoxelGeneratorGraph.
Properties:¶
Type | Name | Default |
---|---|---|
Array |
input_definitions | [] |
Array |
output_definitions | [] |
Methods:¶
Signals:¶
- compiled( )
Emitted after the graph finished compiling, even if compiling failed.
- node_name_changed( int node_id )
Enumerations:¶
enum NodeTypeID:
- NODE_CONSTANT = 0
- NODE_INPUT_X = 1
- NODE_INPUT_Y = 2
- NODE_INPUT_Z = 3
- NODE_OUTPUT_SDF = 4
- NODE_CUSTOM_INPUT = 54
- NODE_CUSTOM_OUTPUT = 55
- NODE_ADD = 5
- NODE_SUBTRACT = 6
- NODE_MULTIPLY = 7
- NODE_DIVIDE = 8
- NODE_SIN = 9
- NODE_FLOOR = 10
- NODE_ABS = 11
- NODE_SQRT = 12
- NODE_FRACT = 13
- NODE_STEPIFY = 14
- NODE_WRAP = 15
- NODE_MIN = 16
- NODE_MAX = 17
- NODE_DISTANCE_2D = 18
- NODE_DISTANCE_3D = 19
- NODE_CLAMP = 20
- NODE_MIX = 22
- NODE_REMAP = 23
- NODE_SMOOTHSTEP = 24
- NODE_CURVE = 25
- NODE_SELECT = 26
- NODE_NOISE_2D = 27
- NODE_NOISE_3D = 28
- NODE_IMAGE_2D = 29
- NODE_SDF_PLANE = 30
- NODE_SDF_BOX = 31
- NODE_SDF_SPHERE = 32
- NODE_SDF_TORUS = 33
- NODE_SDF_PREVIEW = 34
- NODE_SDF_SPHERE_HEIGHTMAP = 35
- NODE_SDF_SMOOTH_UNION = 36
- NODE_SDF_SMOOTH_SUBTRACT = 37
- NODE_NORMALIZE_3D = 38
- NODE_FAST_NOISE_2D = 39
- NODE_FAST_NOISE_3D = 40
- NODE_FAST_NOISE_GRADIENT_2D = 41
- NODE_FAST_NOISE_GRADIENT_3D = 42
- NODE_OUTPUT_WEIGHT = 43
- NODE_FAST_NOISE_2_2D = 45
- NODE_FAST_NOISE_2_3D = 46
- NODE_OUTPUT_SINGLE_TEXTURE = 47
- NODE_EXPRESSION = 48
- NODE_POWI = 49
- NODE_POW = 50
- NODE_INPUT_SDF = 51
- NODE_COMMENT = 52
- NODE_FUNCTION = 53
- NODE_RELAY = 56
- NODE_SPOTS_2D = 57
- NODE_SPOTS_3D = 58
- NODE_TYPE_COUNT = 59
Property Descriptions¶
Method Descriptions¶
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.
Tests if two ports can be connected together.
- void clear( )
Removes all nodes from the graph. Input and output definitions will not be cleared.
- int create_function_node( VoxelGraphFunction function, Vector2 position, int id=0 )
Creates a node based on an existing graph (creates a "sub-graph instance").
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.
-
int find_node_by_name( StringName name )
-
Array get_connections( )
-
Variant get_node_default_input( int node_id, int input_index )
-
PackedInt32Array get_node_ids( )
-
StringName get_node_name( int node_id )
-
int get_node_type_count( )
Get how many types of nodes exist in the graph system.
Get the ID of the type of a node in the graph.
-
Dictionary get_node_type_info( int type_id )
-
void paste_graph_with_pre_generated_ids( VoxelGraphFunction graph, PackedInt32Array node_ids, Vector2 gui_offset )
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 of copied nodes. Otherwise, they are generated.
Removes an existing connection between two nodes of the graph.
Removes a node from the graph.
- void set_expression_node_inputs( int node_id, PackedStringArray names )
Configures inputs for an Expression node. names
is the list of input names used in the expression.
value
must be a float
for now.
-
void set_node_default_input( int node_id, int input_index, Variant value )
-
void set_node_default_inputs_autoconnect( int node_id, 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. On other nodes, it has no effect.
Sets the visual position of a node of the graph, as it will appear in the editor.
-
void set_node_name( int node_id, StringName name )
Sets a custom name for a node.
Generated on Sep 12, 2023