diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-06 20:25:38 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-06 20:25:38 +0400 |
commit | e276a7c8058d146f81ce08f12a0c45f77906515b (patch) | |
tree | ceee87fd479fd5ed1e0c8b7cb983d34c65a19ad5 /source/blender | |
parent | db6c4ba11ec3dbfc1711cdb1870629655e8ea8ee (diff) |
Fix for Reroute nodes: Reloading could change socket types without updating the socket data structs, leading to crash. This is caused by the node verification procedure, which resets any socket type to the initial type defined in the socket templates. Adding sockets dynamically without templates solves this (the sockets are then ignored by verification).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/intern/node_common.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 150bede4b7c..463c938f6b7 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -547,15 +547,6 @@ void register_node_type_frame(bNodeTreeType *ttype) /* **************** REROUTE ******************** */ -static bNodeSocketTemplate node_reroute_in[]= { - { SOCK_RGBA, 1, "Input", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } -}; -static bNodeSocketTemplate node_reroute_out[]= { - { SOCK_RGBA, 0, "Output", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } -}; - /* simple, only a single input and output here */ static ListBase node_reroute_internal_connect(bNodeTree *ntree, bNode *node) { @@ -580,6 +571,15 @@ static ListBase node_reroute_internal_connect(bNodeTree *ntree, bNode *node) return ret; } +static void node_reroute_init(bNodeTree *ntree, bNode* node, bNodeTemplate *UNUSED(ntemp)) +{ + /* Note: Cannot use socket templates for this, since it would reset the socket type + * on each file read via the template verification procedure. + */ + nodeAddSocket(ntree, node, SOCK_IN, "Input", SOCK_RGBA); + nodeAddSocket(ntree, node, SOCK_OUT, "Output", SOCK_RGBA); +} + static void node_reroute_update(bNodeTree *UNUSED(ntree), bNode *node) { bNodeSocket *input = node->inputs.first; @@ -603,7 +603,7 @@ void register_node_type_reroute(bNodeTreeType *ttype) bNodeType *ntype= MEM_callocN(sizeof(bNodeType), "frame node type"); node_type_base(ttype, ntype, NODE_REROUTE, "Reroute", NODE_CLASS_LAYOUT, 0); - node_type_socket_templates(ntype, node_reroute_in, node_reroute_out); + node_type_init(ntype, node_reroute_init); node_type_internal_connect(ntype, node_reroute_internal_connect); node_type_update(ntype, node_reroute_update, NULL); |