Blender Git Commit Log

Git Commits -> Revision 4af555a

Revision 4af555a by Lukas Toenne (temp-runtime-node-def)
August 22, 2021, 16:05 (GMT)
Utility classes for compact node definitions in C++.

Node definitions in C++ are currently spread out over a large number of
files all over the code base (nodes, DNA, RNA, UI). By contrast, python
nodes are very compact and can be added much more easily. To make node
definitions in C++ more convenient, this patch adds some utility
functions that allow defining type properties and callbacks of a node
in a single file.

The NodeDefinition template takes a struct (which should usually also be
a child class of the template) and finds static fields and functions of
the template argument to use for the node type. The "Mesh Primitive
Ellipse" node has been added as an example case, it may not end up being
used. Other existing node types are unaffected, this patch only provides
alternative ways to define a node.

Known limitations:
- Only ID properties can be added in the node source files without
additional DNA structs. This should be sufficient for the vast
majority of nodes, but can be augmented with conventional DNA structs
in node->storage if necessary.
- Runtime node definitions are identified only by their idname, they do
not have a fixed integer type. This has to be taken into account for
versioning.
- Sockets are currently added in the init function. The "template"
system is not supported and a better alternative should be added
eventually.

Commit Details:

Full Hash: 4af555a0311665f8b45d69ac5fffb6ba0243df28
Parent Commit: 721fad3
Lines Changed: +751, -41

3 Added Paths:

/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ellipse.cc (+278, -0) (View)
/source/blender/nodes/intern/node_runtime_types.cc (+116, -0) (View)
/source/blender/nodes/NOD_runtime_types.hh (+266, -0) (View)

7 Modified Paths:

/release/scripts/startup/nodeitems_builtins.py (+1, -0) (Diff)
/source/blender/blenkernel/intern/node.cc (+1, -0) (Diff)
/source/blender/makesdna/DNA_node_types.h (+43, -41) (Diff)
/source/blender/nodes/CMakeLists.txt (+3, -0) (Diff)
/source/blender/nodes/geometry/node_geometry_util.hh (+34, -0) (Diff)
/source/blender/nodes/NOD_geometry.h (+1, -0) (Diff)
/source/blender/nodes/NOD_geometry_exec.hh (+8, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021