[Bf-blender-cvs] [3f71a17] object_nodes: Fix for dangling root sockets when skipping 'pass' nodes.
Lukas Tönne
noreply at git.blender.org
Wed Dec 2 12:05:55 CET 2015
Commit: 3f71a178e1f1ddc19195600ed4051a2d5decfddc
Author: Lukas Tönne
Date: Wed Dec 2 11:28:35 2015 +0100
Branches: object_nodes
https://developer.blender.org/rB3f71a178e1f1ddc19195600ed4051a2d5decfddc
Fix for dangling root sockets when skipping 'pass' nodes.
This can happen when proxies are created, and should always create
a 'value' node to act as a clean root terminator.
===================================================================
M source/blender/blenvm/compile/bvm_nodegraph.cc
===================================================================
diff --git a/source/blender/blenvm/compile/bvm_nodegraph.cc b/source/blender/blenvm/compile/bvm_nodegraph.cc
index 212f286..56863b6 100644
--- a/source/blender/blenvm/compile/bvm_nodegraph.cc
+++ b/source/blender/blenvm/compile/bvm_nodegraph.cc
@@ -779,11 +779,24 @@ void NodeGraph::remove_all_nodes()
SocketPair NodeGraph::find_root(const SocketPair &key)
{
SocketPair root = key;
+ /* value is used to create a valid root node if necessary */
+ Value *value = NULL;
while (root.node && root.node->type->is_pass_node()) {
+ value = root.node->has_input_value(0) ?
+ root.node->find_input_value(0) :
+ root.node->type->find_input(0)->default_value;
+
NodeInstance *link_node = root.node->find_input_link_node(0);
const NodeSocket *link_socket = root.node->find_input_link_socket(0);
root = SocketPair(link_node, link_socket ? link_socket->name : "");
}
+
+ /* create a value node as valid root if necessary */
+ if (!root.node) {
+ assert(value != NULL);
+ root = add_value_node(value);
+ }
+
return root;
}
@@ -813,18 +826,7 @@ void NodeGraph::skip_pass_nodes()
for (OutputList::iterator it_output = outputs.begin(); it_output != outputs.end(); ++it_output) {
Output &output = *it_output;
assert(output.key.node);
-
- SocketPair root_key = find_root(output.key);
-
- /* if the output only has NOOP inputs,
- * create a value node as valid root
- */
- if (!root_key.node) {
- Value *value = output.key.node->find_input_value(output.key.socket);
- root_key = add_value_node(value);
- }
-
- output.key = root_key;
+ output.key = find_root(output.key);
}
}
More information about the Bf-blender-cvs
mailing list