Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/node_composite_tree.c
| Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| bNode *node; | bNode *node; | ||||
| for (node = ntree->nodes.first; node; node = node->next) { | for (node = ntree->nodes.first; node; node = node->next) { | ||||
| free_node_cache(ntree, node); | free_node_cache(ntree, node); | ||||
| } | } | ||||
| } | } | ||||
| /* local tree then owns all compbufs */ | /* local tree then owns all compbufs */ | ||||
| static void localize(bNodeTree *UNUSED(localtree), bNodeTree *ntree) | static void localize(bNodeTree *localtree, bNodeTree *ntree) | ||||
| { | { | ||||
| bNode *node; | |||||
| bNodeSocket *sock; | |||||
| for (node = ntree->nodes.first; node; node = node->next) { | bNode *node = ntree->nodes.first; | ||||
| bNode *local_node = localtree->nodes.first; | |||||
| while (node != NULL) { | |||||
| local_node->original = node; | |||||
| /* ensure new user input gets handled ok */ | /* ensure new user input gets handled ok */ | ||||
| node->need_exec = 0; | node->need_exec = 0; | ||||
| node->new_node->original = node; | local_node->original = node; | ||||
| /* move over the compbufs */ | /* move over the compbufs */ | ||||
| /* right after ntreeCopyTree() oldsock pointers are valid */ | /* right after ntreeCopyTree() oldsock pointers are valid */ | ||||
| if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { | if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { | ||||
| if (node->id) { | if (node->id) { | ||||
| if (node->flag & NODE_DO_OUTPUT) { | if (node->flag & NODE_DO_OUTPUT) { | ||||
| node->new_node->id = (ID *)node->id; | local_node->id = (ID *)node->id; | ||||
| } | } | ||||
| else { | else { | ||||
| node->new_node->id = NULL; | local_node->id = NULL; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| for (sock = node->outputs.first; sock; sock = sock->next) { | bNodeSocket *output_sock = node->outputs.first; | ||||
| sock->new_sock->cache = sock->cache; | bNodeSocket *local_output_sock = local_node->outputs.first; | ||||
| sock->cache = NULL; | while (output_sock != NULL) { | ||||
| sock->new_sock->new_sock = sock; | local_output_sock->cache = output_sock->cache; | ||||
| output_sock->cache = NULL; | |||||
| /* This is actually link to original: someone was just lazy enough and tried to save few | |||||
| * bytes in the cost of readability. */ | |||||
| local_output_sock->new_sock = output_sock; | |||||
| output_sock = output_sock->next; | |||||
| local_output_sock = local_output_sock->next; | |||||
| } | } | ||||
| node = node->next; | |||||
| local_node = local_node->next; | |||||
| } | } | ||||
| } | } | ||||
| static void local_sync(bNodeTree *localtree, bNodeTree *ntree) | static void local_sync(bNodeTree *localtree, bNodeTree *ntree) | ||||
| { | { | ||||
| BKE_node_preview_sync_tree(ntree, localtree); | BKE_node_preview_sync_tree(ntree, localtree); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines | |||||