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-10-24 14:00:28 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-10-24 14:00:28 +0400
commitcbae51bc9321a86aaf04bbd324086d09c0eac6cf (patch)
tree3ac3c25ee6041f3ea32046d4e2aa3713ec584ba4 /source/blender/nodes/intern/node_common.c
parentc9e489b53b66d1626ccfded2a3bd0c27a1ba6b19 (diff)
Removed the experimental (and commented-out) code for FOR and WHILE loops in nodes. This was a feature i tested a while back but was only partially supported by Blender Internal renderer and the old compositor. The main idea was to have nodes that automatically mirror input and output sockets to support incremental changes of "internal variables".
It is not a well-supported feature of the primary node systems (shader, compositor, texture) in Blender. If anybody wants to create a node system that has actual use for loops, they can do so much more elegantly with Python nodes, but it does not have to be a core node type in Blender. Removing this should ease node code maintenance a bit.
Diffstat (limited to 'source/blender/nodes/intern/node_common.c')
-rw-r--r--source/blender/nodes/intern/node_common.c162
1 files changed, 0 insertions, 162 deletions
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 301dea22c17..6ccf84b476c 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -354,168 +354,6 @@ static void UNUSED_FUNCTION(node_group_link)(bNodeTree *ntree, bNodeSocket *sock
node_group_expose_socket(ntree, sock, in_out);
}
-/**** For Loop ****/
-
-/* Essentially a group node with slightly different behavior.
- * The internal tree is executed several times, with each output being re-used
- * as an input in the next iteration. For this purpose, input and output socket
- * lists are kept identical!
- */
-
-bNodeTemplate node_forloop_template(bNode *node)
-{
- bNodeTemplate ntemp;
- ntemp.type = NODE_FORLOOP;
- ntemp.ngroup = (bNodeTree*)node->id;
- return ntemp;
-}
-
-void node_forloop_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
-{
- bNodeSocket *sock;
-
- node->id = (ID*)ntemp->ngroup;
-
- sock = nodeAddSocket(ntree, node, SOCK_IN, "Iterations", SOCK_FLOAT);
- node_socket_set_default_value_float(sock->default_value, PROP_UNSIGNED, 1, 0, 10000);
-
- /* NB: group socket input/output roles are inverted internally!
- * Group "inputs" work as outputs in links and vice versa.
- */
- if (ntemp->ngroup) {
- bNodeSocket *gsock;
- for (gsock=ntemp->ngroup->inputs.first; gsock; gsock=gsock->next)
- node_group_add_extern_socket(ntree, &node->inputs, SOCK_IN, gsock);
- for (gsock=ntemp->ngroup->outputs.first; gsock; gsock=gsock->next)
- node_group_add_extern_socket(ntree, &node->outputs, SOCK_OUT, gsock);
- }
-}
-
-void node_forloop_init_tree(bNodeTree *ntree)
-{
- bNodeSocket *sock;
- sock = node_group_add_socket(ntree, "Iteration", SOCK_FLOAT, SOCK_IN);
- sock->flag |= SOCK_INTERNAL;
-}
-
-static void loop_sync(bNodeTree *ntree, int sync_in_out)
-{
- bNodeSocket *sock, *sync, *nsync, *mirror;
- ListBase *sync_lb;
-
- if (sync_in_out==SOCK_IN) {
- sock = ntree->outputs.first;
-
- sync = ntree->inputs.first;
- sync_lb = &ntree->inputs;
- }
- else {
- sock = ntree->inputs.first;
-
- sync = ntree->outputs.first;
- sync_lb = &ntree->outputs;
- }
-
- /* NB: the sock->storage pointer is used here directly to store the own_index int
- * out the mirrored socket counterpart!
- */
-
- while (sock) {
- /* skip static and internal sockets on the sync side (preserves socket order!) */
- while (sync && ((sync->flag & SOCK_INTERNAL) || !(sync->flag & SOCK_DYNAMIC)))
- sync = sync->next;
-
- if (sync && !(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC)) {
- if (sock->storage==NULL) {
- /* if mirror index is 0, the sockets is newly added and a new mirror must be created. */
- mirror = node_group_expose_socket(ntree, sock, sync_in_out);
- /* store the mirror index */
- sock->storage = SET_INT_IN_POINTER(mirror->own_index);
- mirror->storage = SET_INT_IN_POINTER(sock->own_index);
- /* move mirror to the right place */
- BLI_remlink(sync_lb, mirror);
- if (sync)
- BLI_insertlinkbefore(sync_lb, sync, mirror);
- else
- BLI_addtail(sync_lb, mirror);
- }
- else {
- /* look up the mirror socket */
- for (mirror=sync; mirror; mirror=mirror->next)
- if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage))
- break;
- /* make sure the name is the same (only for identification by user, no deeper meaning) */
- BLI_strncpy(mirror->name, sock->name, sizeof(mirror->name));
- /* fix the socket order if necessary */
- if (mirror != sync) {
- BLI_remlink(sync_lb, mirror);
- BLI_insertlinkbefore(sync_lb, sync, mirror);
- }
- else
- sync = sync->next;
- }
- }
-
- sock = sock->next;
- }
-
- /* remaining sockets in sync_lb are leftovers from deleted sockets, remove them */
- while (sync) {
- nsync = sync->next;
- if (!(sync->flag & SOCK_INTERNAL) && (sync->flag & SOCK_DYNAMIC))
- node_group_remove_socket(ntree, sync, sync_in_out);
- sync = nsync;
- }
-}
-
-void node_loop_update_tree(bNodeTree *ngroup)
-{
- /* make sure inputs & outputs are identical */
- if (ngroup->update & NTREE_UPDATE_GROUP_IN)
- loop_sync(ngroup, SOCK_OUT);
- if (ngroup->update & NTREE_UPDATE_GROUP_OUT)
- loop_sync(ngroup, SOCK_IN);
-}
-
-void node_whileloop_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
-{
- bNodeSocket *sock;
-
- node->id = (ID*)ntemp->ngroup;
-
- sock = nodeAddSocket(ntree, node, SOCK_IN, "Condition", SOCK_FLOAT);
- node_socket_set_default_value_float(sock->default_value, PROP_NONE, 1, 0, 1);
-
- /* max iterations */
- node->custom1 = 10000;
-
- /* NB: group socket input/output roles are inverted internally!
- * Group "inputs" work as outputs in links and vice versa.
- */
- if (ntemp->ngroup) {
- bNodeSocket *gsock;
- for (gsock=ntemp->ngroup->inputs.first; gsock; gsock=gsock->next)
- node_group_add_extern_socket(ntree, &node->inputs, SOCK_IN, gsock);
- for (gsock=ntemp->ngroup->outputs.first; gsock; gsock=gsock->next)
- node_group_add_extern_socket(ntree, &node->outputs, SOCK_OUT, gsock);
- }
-}
-
-void node_whileloop_init_tree(bNodeTree *ntree)
-{
- bNodeSocket *sock;
- sock = node_group_add_socket(ntree, "Condition", SOCK_FLOAT, SOCK_OUT);
- sock->flag |= SOCK_INTERNAL;
-}
-
-bNodeTemplate node_whileloop_template(bNode *node)
-{
- bNodeTemplate ntemp;
- ntemp.type = NODE_WHILELOOP;
- ntemp.ngroup = (bNodeTree*)node->id;
- return ntemp;
-}
-
/**** FRAME ****/
static void node_frame_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))