diff options
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_image.c')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_image.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 563ad2b74b2..f9f289297d7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -70,7 +70,7 @@ static bNodeSocket *cmp_node_image_add_render_pass_output(bNodeTree *ntree, bNod bNodeSocket *sock; NodeImageLayer *sockdata; - sock = node_add_output_from_template(ntree, node, &cmp_node_rlayers_out[rres_index]); + sock = node_add_socket_from_template(ntree, node, &cmp_node_rlayers_out[rres_index], SOCK_OUT); /* extra socket info */ sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer"); sock->storage = sockdata; @@ -157,7 +157,7 @@ static void cmp_node_image_add_multilayer_outputs(bNodeTree *ntree, bNode *node, else type = SOCK_RGBA; - sock = nodeAddSocket(ntree, node, SOCK_OUT, rpass->name, type); + sock = nodeAddStaticSocket(ntree, node, SOCK_OUT, type, PROP_NONE, rpass->name, rpass->name); /* extra socket info */ sockdata = MEM_callocN(sizeof(NodeImageLayer), "node image layer"); sock->storage = sockdata; @@ -240,9 +240,6 @@ static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node) /* XXX make callback */ cmp_node_image_create_outputs(ntree, node); - /* flag all new sockets as dynamic, to prevent removal by socket verification function */ - for (newsock=node->outputs.first; newsock; newsock=newsock->next) - newsock->flag |= SOCK_DYNAMIC; for (newsock=node->outputs.first; newsock; newsock=newsock->next) { /* XXX make callback */ @@ -284,7 +281,7 @@ static void cmp_node_image_update(bNodeTree *ntree, bNode *node) cmp_node_image_verify_outputs(ntree, node); } -static void node_composit_init_image(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp)) +static void node_composit_init_image(bNodeTree *ntree, bNode *node) { ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user"); node->storage= iuser; @@ -308,38 +305,48 @@ static void node_composit_free_image(bNode *node) MEM_freeN(node->storage); } -static void node_composit_copy_image(bNode *orig_node, bNode *new_node) +static void node_composit_copy_image(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, bNode *src_node) { bNodeSocket *sock; - new_node->storage= MEM_dupallocN(orig_node->storage); + dest_node->storage= MEM_dupallocN(src_node->storage); /* copy extra socket info */ - for (sock=orig_node->outputs.first; sock; sock=sock->next) + for (sock=src_node->outputs.first; sock; sock=sock->next) sock->new_sock->storage = MEM_dupallocN(sock->storage); } -void register_node_type_cmp_image(bNodeTreeType *ttype) +void register_node_type_cmp_image() { static bNodeType ntype; - node_type_base(ttype, &ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + cmp_node_type_base(&ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_init(&ntype, node_composit_init_image); node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image); node_type_update(&ntype, cmp_node_image_update, NULL); - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } /* **************** RENDER RESULT ******************** */ -void register_node_type_cmp_rlayers(bNodeTreeType *ttype) +static int node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree) +{ + PointerRNA ptr; + + /* render layers node can only be used in local scene->nodetree, since it directly links to the scene */ + RNA_id_pointer_create((ID *)ntree, &ptr); + return (strcmp(ntree->idname, "CompositorNodeTree")==0 && RNA_boolean_get(&ptr, "is_local_tree")); +} + +void register_node_type_cmp_rlayers() { static bNodeType ntype; - node_type_base(ttype, &ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); + cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS); node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out); + ntype.poll = node_composit_poll_rlayers; - nodeRegisterType(ttype, &ntype); + nodeRegisterType(&ntype); } |