This add-on adds a “native code” node, which allows you to write Geometry Nodes using a native programming language, such as C or C++.
The node takes a “file” input, which you can navigate to your compiled code, and sockets will automatically be populated from the function arguments and return type. For this to work, your code must have been compiled with debug information enabled (/ZI
flag).
A typical node looks like the following:
typedef struct {
int32_t some_integer_output;
geometry_t some_geometry_output;
float some_float_output;
int32_t more;
int32_t outputs;
int32_t here;
} node_graph_outputs_t;
node_graph_outputs_t main (alloc_t alloc, geometry_t some_geometry_parameter, int32_t some_integer_parameter, float some_float_parameter, int32_t more, int32_t parameters, int32_t here)
{
node_graph_outputs_t outputs = { 0 };
return outputs;
}
node_graph_outputs_t
is a struct that you define. An output socket is created for each field. Supported field types are int32_t
(paid version only), float
(paid version only) and geometry_t
.
The function must be called “main”. An input socket is created for each function parameter (besides the first one). The first parameter is a function pointer to Blender’s memory allocator, which is defined as follows:
typedef void *(alloc_t) (size_t len, char *str);
The second parameter is a user-defined debug name for the allocation.
Arrays in geometry_t
are passed directly to Blender, so they must be allocated using this allocator. You may also use the allocator for other allocations. Geometry is defined as follows:
typedef struct {
float3 *vertices;
int32_t number_of_vertices;
int2 *edges;
int32_t number_of_edges;
/* the index at `n` specifies the first face corner, and the index at `n+1`,
* the last face corner for face `n` */
int32_t *faces;
int32_t number_of_faces;
int32_t *corner_vertices;
int32_t *corner_edges;
int32_t number_of_face_corners;
} geometry_t;
Download the free version, with support for the “geometry” socket type.
There is a paid version available for $29.99, that adds support for the “float” and “integer” socket types.
Only Blender 4.1.0 and 4.2.0 are supported. Other versions are not supported, and will not work. Only Windows is supported. Linux and macOS are not supported, and will not work.