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.