Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-02-27 21:38:16 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-02-27 21:38:16 +0400
commit050428049f1f10ac2c8b6ccf7d775c6d9dcfe2ba (patch)
tree36987af8cfe4c4401bdab6b5a99ea3097fa056fd /source/blender/nodes/composite/node_composite_tree.c
parentd55c1d59f91a919c8d4b935136454200adb0b8e8 (diff)
Implements a new operator for detaching nodes. In the process i overhauled the node muting system as well.
There are a number of features that use a kind of "internal linking" in nodes: 1. muting 2. delete + reconnect (restore link to/from node after delete) 3. the new detach operator (same as 2, but don't delete the node) The desired behavior in all cases is the same: find a sensible mapping of inputs-to-outputs of a node. In the case of muting these links are displayed in red on the node itself. For the other operators they are used to relink connections, such that one gets the best possible ongoing link between previous up- and downstream nodes. Muting previously used a complicated callback system to ensure consistent behavior in the editor as well as execution in compositor, shader cpu/gpu and texture nodes. This has been greatly simplified by moving the muting step into the node tree localization functions. Any muted node is now bypassed using the generalized nodeInternalRelink function and then removed from the local tree. This way the internal execution system doesn't have to deal with muted nodes at all, as if they are non-existent. The same function is also used by the delete_reconnect and the new links_detach operators (which work directly in the editor node tree). Detaching nodes is currently keymapped as a translation variant (macro operator): pressing ALTKEY + moving node first detaches and then continues with regular transform operator. The default key is ALT+DKEY though, instead ALT+GKEY, since the latter is already used for the ungroup operator.
Diffstat (limited to 'source/blender/nodes/composite/node_composite_tree.c')
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 8257b850010..0ebed7105f0 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -121,9 +121,9 @@ static void update_node(bNodeTree *ntree, bNode *node)
}
/* local tree then owns all compbufs */
-static void localize(bNodeTree *UNUSED(localtree), bNodeTree *ntree)
+static void localize(bNodeTree *localtree, bNodeTree *ntree)
{
- bNode *node;
+ bNode *node, *node_next;
bNodeSocket *sock;
for(node= ntree->nodes.first; node; node= node->next) {
@@ -150,6 +150,26 @@ static void localize(bNodeTree *UNUSED(localtree), bNodeTree *ntree)
sock->new_sock->new_sock= sock;
}
}
+
+ /* replace muted nodes by internal links */
+ for (node= localtree->nodes.first; node; node= node_next) {
+ node_next = node->next;
+
+ if (node->flag & NODE_MUTED) {
+ /* make sure the update tag isn't lost when removing the muted node.
+ * propagate this to all downstream nodes.
+ */
+ if (node->need_exec) {
+ bNodeLink *link;
+ for (link=localtree->links.first; link; link=link->next)
+ if (link->fromnode==node && link->tonode)
+ link->tonode->need_exec = 1;
+ }
+
+ nodeInternalRelink(localtree, node);
+ nodeFreeNode(localtree, node);
+ }
+ }
}
static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
@@ -230,9 +250,7 @@ bNodeTreeType ntreeType_Composite = {
/* update */ update,
/* update_node */ update_node,
/* validate_link */ NULL,
- /* mutefunc */ node_compo_pass_on,
- /* mutelinksfunc */ node_mute_get_links,
- /* gpumutefunc */ NULL
+ /* internal_connect */ node_internal_connect_default
};
@@ -360,9 +378,7 @@ static void *exec_composite_node(void *nodeexec_v)
node_get_stack(node, thd->stack, nsin, nsout);
- if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc)
- node->typeinfo->mutefunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
- else if(node->typeinfo->execfunc)
+ if(node->typeinfo->execfunc)
node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
else if (node->typeinfo->newexecfunc)
node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);