diff options
author | Jacques Lucke <jacques@blender.org> | 2021-08-30 18:13:46 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-08-30 18:23:05 +0300 |
commit | 1e69a25043120cc8dddc3f58622eb50e1443def1 (patch) | |
tree | 16bcb3eb98215dbbd5c54880cb3d14544e316d3f /source/blender/blenloader | |
parent | e8684eff301d09e25b4e7ef6221a5289661da2e3 (diff) |
Nodes: add more flexible method to declare sockets of a node
Previously, built-in nodes had to implement "socket templates"
(`bNodeSocketTemplate`) to tell Blender which sockets they have.
It was nice that this was declarative, but this approach was way
too rigid and was cumbersome to use in many cases.
This commit starts to move us away from this rigid structure
by letting nodes implement a function that declares the sockets
the node has. Right now this is used as a direct replacement
of the "socket template" approach to keep the refactor smaller.
It's just a bit easier to read and write.
In the future we want to support more complex features like
dynamic numbers of sockets and type inferencing. Those features
will be easier to build on this new approach.
This new approach can live side by side with `bNodeSocketTemplate`
for a while. That makes it easier to update nodes one by one.
Note: In `bNodeSocketTemplate` socket identifiers were made
unique automatically. In this new approach, one has to specify
unique identifiers manually (unless the name is unique already).
Differential Revision: https://developer.blender.org/D12335
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 6492f0d1f69..fa15e541e43 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -291,7 +291,7 @@ static void do_version_hue_sat_node(bNodeTree *ntree, bNode *node) } /* Make sure new sockets are properly created. */ - node_verify_socket_templates(ntree, node); + node_verify_sockets(ntree, node, false); /* Convert value from old storage to new sockets. */ NodeHueSat *nhs = node->storage; bNodeSocket *hue = nodeFindSocket(node, SOCK_IN, "Hue"), @@ -357,7 +357,7 @@ static void do_versions_compositor_render_passes(bNodeTree *ntree) */ do_versions_compositor_render_passes_storage(node); /* Make sure new sockets are properly created. */ - node_verify_socket_templates(ntree, node); + node_verify_sockets(ntree, node, false); /* Make sure all possibly created sockets have proper storage. */ do_versions_compositor_render_passes_storage(node); } |