Removed the experimental (and commented-out) code for FOR and WHILE loops in nodes...
authorLukas Toenne <lukas.toenne@googlemail.com>
Wed, 24 Oct 2012 10:00:28 +0000 (10:00 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Wed, 24 Oct 2012 10:00:28 +0000 (10:00 +0000)
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.

source/blender/blenkernel/BKE_node.h
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_header.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/nodes/composite/nodes/node_composite_common.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/intern/node_common.h
source/blender/nodes/shader/nodes/node_shader_common.c
source/blender/nodes/texture/nodes/node_texture_common.c

index 05de2bba5ca63667fc8a330865cd2e4102071df9..d4b2755495e826e9548bc52197d730a4066f63a5 100644 (file)
@@ -456,8 +456,8 @@ void            node_type_compatibility(struct bNodeType *ntype, short compatibi
 /* ************** COMMON NODES *************** */
 
 #define NODE_GROUP             2
-#define NODE_FORLOOP   3
-#define NODE_WHILELOOP 4
+#define __NODE_FORLOOP 3       /* deprecated */
+#define __NODE_WHILELOOP       4       /* deprecated */
 #define NODE_FRAME             5
 #define NODE_REROUTE   6
 
index 39f0a49e1d2f0252ad3b447bebf720b256e3c8a6..1ee78b09554c4aea9f663c1c7b8452f3e0d84e7c 100644 (file)
@@ -895,11 +895,6 @@ static void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
        uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL);
 }
 
-static void node_common_buts_whileloop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
-{
-       uiItemR(layout, ptr, "max_iterations", 0, NULL, ICON_NONE);
-}
-
 /* XXX Does a bounding box update by iterating over all children.
  * Not ideal to do this in every draw call, but doing as transform callback doesn't work,
  * since the child node totr rects are not updated properly at that point.
@@ -1179,16 +1174,6 @@ static void node_common_set_butfunc(bNodeType *ntype)
                        ntype->drawfunc = node_draw_group;
                        ntype->drawupdatefunc = node_update_group;
                        break;
-               case NODE_FORLOOP:
-//                     ntype->uifunc= node_common_buts_group;
-                       ntype->drawfunc = node_draw_group;
-                       ntype->drawupdatefunc = node_update_group;
-                       break;
-               case NODE_WHILELOOP:
-                       ntype->uifunc = node_common_buts_whileloop;
-                       ntype->drawfunc = node_draw_group;
-                       ntype->drawupdatefunc = node_update_group;
-                       break;
                case NODE_FRAME:
                        ntype->drawfunc = node_draw_frame;
                        ntype->drawupdatefunc = node_update_frame;
index 5ab698cd41557dcb997f762fea8363ce2825ac90..e82917feb2122b363c42482d09620078e53666e6 100644 (file)
@@ -138,12 +138,6 @@ static void do_node_add_group(bContext *C, void *UNUSED(arg), int event)
                        case NODE_GROUP:
                                ntemp.ngroup = ntreeAddTree("Group", snode->treetype, ntemp.type);
                                break;
-                       case NODE_FORLOOP:
-                               ntemp.ngroup = ntreeAddTree("For Loop", snode->treetype, ntemp.type);
-                               break;
-                       case NODE_WHILELOOP:
-                               ntemp.ngroup = ntreeAddTree("While Loop", snode->treetype, ntemp.type);
-                               break;
                        default:
                                ntemp.ngroup = NULL;
                }
@@ -199,15 +193,11 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
                /* XXX hack: negative numbers used for empty group types */
                if (node_tree_has_type(ntree->type, NODE_GROUP))
                        uiItemV(layout, IFACE_("New Group"), 0, -NODE_GROUP);
-               if (node_tree_has_type(ntree->type, NODE_FORLOOP))
-                       uiItemV(layout, IFACE_("New For Loop"), 0, -NODE_FORLOOP);
-               if (node_tree_has_type(ntree->type, NODE_WHILELOOP))
-                       uiItemV(layout, IFACE_("New While Loop"), 0, -NODE_WHILELOOP);
                uiItemS(layout);
                
                for (ngroup = bmain->nodetree.first, event = 0; ngroup; ngroup = ngroup->id.next, ++event) {
                        /* only use group trees */
-                       if (ngroup->type == ntree->type && ELEM3(ngroup->nodetype, NODE_GROUP, NODE_FORLOOP, NODE_WHILELOOP)) {
+                       if (ngroup->type == ntree->type && ngroup->nodetype == NODE_GROUP) {
                                uiItemV(layout, ngroup->id.name + 2, 0, event);
                        }
                }
index cd0ea107f501b43bdb777d16aa4aac6ab26e80cd..241ee8f9c9b4409af1b273b8e41720938c08c77a 100644 (file)
@@ -226,10 +226,6 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
                
                case NODE_GROUP:
                        return &RNA_NodeGroup;
-               case NODE_FORLOOP:
-                       return &RNA_NodeForLoop;
-               case NODE_WHILELOOP:
-                       return &RNA_NodeWhileLoop;
                case NODE_FRAME:
                        return &RNA_NodeFrame;
                case NODE_REROUTE:
@@ -1042,7 +1038,6 @@ static EnumPropertyItem node_glossy_items[] = {
 enum
 {
        Category_GroupNode,
-       Category_LoopNode,
        Category_LayoutNode,
        Category_ShaderNode,
        Category_CompositorNode,
@@ -1086,8 +1081,6 @@ static void init(void)
        #include "rna_nodetree_types.h"
        
        reg_node(NODE_GROUP, Category_GroupNode, "GROUP", "NodeGroup", "SpecialNode", "Group", "");
-       reg_node(NODE_FORLOOP, Category_LoopNode, "FORLOOP", "NodeForLoop", "SpecialNode", "ForLoop", "");
-       reg_node(NODE_WHILELOOP, Category_LoopNode, "WHILELOOP", "NodeWhileLoop", "SpecialNode", "WhileLoop", "");
        reg_node(NODE_FRAME, Category_LayoutNode, "FRAME", "NodeFrame", "SpecialNode", "Frame", "");
        reg_node(NODE_REROUTE, Category_LayoutNode, "REROUTE", "NodeReroute", "SpecialNode", "Reroute", "");
 }
@@ -1166,36 +1159,6 @@ static void def_group(StructRNA *srna)
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
 }
 
-static void def_forloop(StructRNA *srna)
-{
-       PropertyRNA *prop;
-       
-       prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
-       RNA_def_property_pointer_sdna(prop, NULL, "id");
-       RNA_def_property_struct_type(prop, "NodeTree");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Node Tree", "");
-       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
-}
-
-static void def_whileloop(StructRNA *srna)
-{
-       PropertyRNA *prop;
-       
-       prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
-       RNA_def_property_pointer_sdna(prop, NULL, "id");
-       RNA_def_property_struct_type(prop, "NodeTree");
-       RNA_def_property_flag(prop, PROP_EDITABLE);
-       RNA_def_property_ui_text(prop, "Node Tree", "");
-       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
-
-       prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "custom1");
-       RNA_def_property_range(prop, 0.0f, SHRT_MAX);
-       RNA_def_property_ui_text(prop, "Max. Iterations", "Limit for number of iterations");
-       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
-}
-
 static void def_frame(StructRNA *srna)
 {
        PropertyRNA *prop; 
@@ -3995,8 +3958,6 @@ static void rna_def_special_node(BlenderRNA *brna)
 
        static EnumPropertyItem specific_node_type_items[] = {
                {NODE_GROUP, "GROUP", ICON_NODE, "Group", ""},
-               {NODE_FORLOOP, "FORLOOP", ICON_NODE, "For Loop", ""},
-               {NODE_WHILELOOP, "WHILELOOP", ICON_NODE, "While Loop", ""},
                {NODE_FRAME, "FRAME", ICON_NODE, "Frame", ""},
                {NODE_REROUTE, "REROUTE", ICON_NODE, "Reroute", ""},
                {0, NULL, 0, NULL, NULL}
@@ -4619,8 +4580,6 @@ void RNA_def_nodetree(BlenderRNA *brna)
        #include "rna_nodetree_types.h"
        
        define_specific_node(brna, NODE_GROUP, def_group);
-       define_specific_node(brna, NODE_FORLOOP, def_forloop);
-       define_specific_node(brna, NODE_WHILELOOP, def_whileloop);
        define_specific_node(brna, NODE_FRAME, def_frame);
        define_specific_node(brna, NODE_REROUTE, 0);
        
index 2596248d696035734f94a93142acf09c37a3195a..10b81cdaaa0153dd9586874c7918859e3cf5f6c1 100644 (file)
@@ -231,153 +231,3 @@ void register_node_type_cmp_group(bNodeTreeType *ttype)
 
        nodeRegisterType(ttype, &ntype);
 }
-
-#ifdef WITH_COMPOSITOR_LEGACY
-
-/**** FOR LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-/* Move the results from the previous iteration back to the input sockets. */
-static void loop_iteration_reset(bNodeTree *ngroup, bNodeStack *gstack)
-{
-       bNodeSocket *gin, *gout;
-       bNodeStack *nsin, *nsout;
-       
-       gin = ngroup->inputs.first;
-       gout = ngroup->outputs.first;
-       
-       while (gin && gout) {
-               /* skip static (non-looping) sockets */
-               while (gin && !(gin->flag & SOCK_DYNAMIC))
-                       gin=gin->next;
-               while (gout && !(gout->flag & SOCK_DYNAMIC))
-                       gout=gout->next;
-               
-               if (gin && gout) {
-                       nsin = node_get_socket_stack(gstack, gin);
-                       nsout = node_get_socket_stack(gstack, gout);
-                       
-                       move_stack(nsin, nsout);
-                       
-                       gin=gin->next;
-                       gout=gout->next;
-               }
-       }
-}
-
-static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-       bNodeTreeExec *exec= (bNodeTreeExec *)nodedata;
-       int totiterations= (int)in[0]->vec[0];
-       bNodeSocket *sock;
-       bNodeStack *ns;
-       int iteration;
-       
-       /* XXX same behavior as trunk: all nodes inside group are executed.
-        * it's stupid, but just makes it work. compo redesign will do this better.
-        */
-       {
-               bNode *inode;
-               for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-                       inode->need_exec = 1;
-       }
-       
-       /* "Iteration" socket */
-       sock = exec->nodetree->inputs.first;
-       ns = node_get_socket_stack(exec->stack, sock);
-       
-       group_copy_inputs(node, in, exec->stack);
-       for (iteration=0; iteration < totiterations; ++iteration) {
-               /* first input contains current iteration counter */
-               ns->vec[0] = (float)iteration;
-               
-               if (iteration > 0)
-                       loop_iteration_reset(exec->nodetree, exec->stack);
-               ntreeExecNodes(exec, data, thread);
-               group_free_internal(exec);
-       }
-       group_move_outputs(node, out, exec->stack);
-}
-
-void register_node_type_cmp_forloop(bNodeTreeType *ttype)
-{
-       static bNodeType ntype;
-
-       node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
-       node_type_socket_templates(&ntype, NULL, NULL);
-       node_type_size(&ntype, 120, 60, 200);
-       node_type_label(&ntype, node_group_label);
-       node_type_init(&ntype, node_forloop_init);
-       node_type_valid(&ntype, node_group_valid);
-       node_type_template(&ntype, node_forloop_template);
-       node_type_update(&ntype, NULL, node_group_verify);
-       node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
-       node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-       node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
-       
-       nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-
-/**** WHILE LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-       bNodeTreeExec *exec= (bNodeTreeExec *)nodedata;
-       int condition= (in[0]->vec[0] > 0.0f);
-       bNodeSocket *sock;
-       bNodeStack *ns;
-       int iteration;
-       
-       /* XXX same behavior as trunk: all nodes inside group are executed.
-        * it's stupid, but just makes it work. compo redesign will do this better.
-        */
-       {
-               bNode *inode;
-               for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-                       inode->need_exec = 1;
-       }
-       
-       /* "Condition" socket */
-       sock = exec->nodetree->outputs.first;
-       ns = node_get_socket_stack(exec->stack, sock);
-       
-       iteration = 0;
-       group_copy_inputs(node, in, exec->stack);
-       while (condition && iteration < node->custom1) {
-               if (iteration > 0)
-                       loop_iteration_reset(exec->nodetree, exec->stack);
-               ntreeExecNodes(exec, data, thread);
-               group_free_internal(exec);
-               
-//             PRINT_BUFFERS(exec);
-               
-               condition = (ns->vec[0] > 0.0f);
-               ++iteration;
-       }
-       group_move_outputs(node, out, exec->stack);
-}
-
-void register_node_type_cmp_whileloop(bNodeTreeType *ttype)
-{
-       static bNodeType ntype;
-
-       node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
-       node_type_socket_templates(&ntype, NULL, NULL);
-       node_type_size(&ntype, 120, 60, 200);
-       node_type_label(&ntype, node_group_label);
-       node_type_init(&ntype, node_whileloop_init);
-       node_type_valid(&ntype, node_group_valid);
-       node_type_template(&ntype, node_whileloop_template);
-       node_type_update(&ntype, NULL, node_group_verify);
-       node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
-       node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-       node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
-       
-       nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-#endif  /* WITH_COMPOSITOR_LEGACY */
index 301dea22c17bfa26b37751d0c62289d286cdcf09..6ccf84b476c271e52f0a4d805b1fe8f1bd9ce227 100644 (file)
@@ -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))
index 00f72469b0ff7ec744974e29e3d241bf7a96803f..9e04a9e05f81f4e35a115f2dbcac39fc8b418972 100644 (file)
 struct bNodeTree;
 
 void node_group_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
-void node_forloop_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
-void node_whileloop_init(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp);
-
-void node_forloop_init_tree(struct bNodeTree *ntree);
-void node_whileloop_init_tree(struct bNodeTree *ntree);
-
 const char *node_group_label(struct bNode *node);
-
 struct bNodeTemplate node_group_template(struct bNode *node);
-struct bNodeTemplate node_forloop_template(struct bNode *node);
-struct bNodeTemplate node_whileloop_template(struct bNode *node);
-
 int node_group_valid(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 void node_group_verify(struct bNodeTree *ntree, struct bNode *node, struct ID *id);
 
@@ -57,8 +47,6 @@ struct bNodeTree *node_group_edit_get(struct bNode *node);
 struct bNodeTree *node_group_edit_set(struct bNode *node, int edit);
 void node_group_edit_clear(bNode *node);
 
-void node_loop_update_tree(struct bNodeTree *ngroup);
-
 void ntree_update_reroute_nodes(struct bNodeTree *ntree);
 
 #endif
index df369482a2ed64d4b16c8642b41cc8bb8dfbea39..688d77d83505822e848532e58b62718d95ef682c 100644 (file)
@@ -204,128 +204,3 @@ void register_node_type_sh_group(bNodeTreeType *ttype)
        
        nodeRegisterType(ttype, &ntype);
 }
-
-
-/**** FOR LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-       bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-       bNodeThreadStack *nts;
-       int iterations= (int)in[0]->vec[0];
-       bNodeSocket *sock;
-       bNodeStack *ns;
-       int iteration;
-       
-       /* XXX same behavior as trunk: all nodes inside group are executed.
-        * it's stupid, but just makes it work. compo redesign will do this better.
-        */
-       {
-               bNode *inode;
-               for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-                       inode->need_exec = 1;
-       }
-       
-       nts = ntreeGetThreadStack(exec, thread);
-       
-       /* "Iteration" socket */
-       sock = exec->nodetree->inputs.first;
-       ns = node_get_socket_stack(nts->stack, sock);
-       
-//     group_copy_inputs(node, in, nts->stack);
-       for (iteration=0; iteration < iterations; ++iteration) {
-               /* first input contains current iteration counter */
-               ns->vec[0] = (float)iteration;
-               ns->vec[1]=ns->vec[2]=ns->vec[3] = 0.0f;
-               
-//             if (iteration > 0)
-//                     loop_init_iteration(exec->nodetree, nts->stack);
-//             ntreeExecThreadNodes(exec, nts, data, thread);
-       }
-//     loop_copy_outputs(node, in, out, exec->stack);
-       
-       ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_sh_forloop(bNodeTreeType *ttype)
-{
-       static bNodeType ntype;
-
-       node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
-       node_type_socket_templates(&ntype, NULL, NULL);
-       node_type_size(&ntype, 120, 60, 200);
-       node_type_label(&ntype, node_group_label);
-       node_type_init(&ntype, node_forloop_init);
-       node_type_valid(&ntype, node_group_valid);
-       node_type_template(&ntype, node_forloop_template);
-       node_type_update(&ntype, NULL, node_group_verify);
-       node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
-       node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-       node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
-       
-       nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-/**** WHILE LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-       bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-       bNodeThreadStack *nts;
-       int condition= (in[0]->vec[0] > 0.0f);
-       bNodeSocket *sock;
-       bNodeStack *ns;
-       int iteration;
-       
-       /* XXX same behavior as trunk: all nodes inside group are executed.
-        * it's stupid, but just makes it work. compo redesign will do this better.
-        */
-       {
-               bNode *inode;
-               for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-                       inode->need_exec = 1;
-       }
-       
-       nts = ntreeGetThreadStack(exec, thread);
-       
-       /* "Condition" socket */
-       sock = exec->nodetree->outputs.first;
-       ns = node_get_socket_stack(nts->stack, sock);
-       
-       iteration = 0;
-//     group_copy_inputs(node, in, nts->stack);
-       while (condition && iteration < node->custom1) {
-//             if (iteration > 0)
-//                     loop_init_iteration(exec->nodetree, nts->stack);
-//             ntreeExecThreadNodes(exec, nts, data, thread);
-               
-               condition = (ns->vec[0] > 0.0f);
-               ++iteration;
-       }
-//     loop_copy_outputs(node, in, out, exec->stack);
-       
-       ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_sh_whileloop(bNodeTreeType *ttype)
-{
-       static bNodeType ntype;
-
-       node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
-       node_type_socket_templates(&ntype, NULL, NULL);
-       node_type_size(&ntype, 120, 60, 200);
-       node_type_label(&ntype, node_group_label);
-       node_type_init(&ntype, node_whileloop_init);
-       node_type_valid(&ntype, node_group_valid);
-       node_type_template(&ntype, node_whileloop_template);
-       node_type_update(&ntype, NULL, node_group_verify);
-       node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
-       node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-       node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
-       
-       nodeRegisterType(ttype, &ntype);
-}
-#endif
index 1eaf9b2b0fed2db12305c4a30af9b978de003e1f..41bfd0ae00a802537f1d2de7d4a178884aaf4746 100644 (file)
@@ -148,128 +148,3 @@ void register_node_type_tex_group(bNodeTreeType *ttype)
        
        nodeRegisterType(ttype, &ntype);
 }
-
-
-/**** FOR LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void forloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-       bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-       bNodeThreadStack *nts;
-       int iterations= (int)in[0]->vec[0];
-       bNodeSocket *sock;
-       bNodeStack *ns;
-       int iteration;
-       
-       /* XXX same behavior as trunk: all nodes inside group are executed.
-        * it's stupid, but just makes it work. compo redesign will do this better.
-        */
-       {
-               bNode *inode;
-               for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-                       inode->need_exec = 1;
-       }
-       
-       nts = ntreeGetThreadStack(exec, thread);
-       
-       /* "Iteration" socket */
-       sock = exec->nodetree->inputs.first;
-       ns = node_get_socket_stack(nts->stack, sock);
-       
-//     group_copy_inputs(node, in, nts->stack);
-       for (iteration=0; iteration < iterations; ++iteration) {
-               /* first input contains current iteration counter */
-               ns->vec[0] = (float)iteration;
-               ns->vec[1]=ns->vec[2]=ns->vec[3] = 0.0f;
-               
-//             if (iteration > 0)
-//                     loop_init_iteration(exec->nodetree, nts->stack);
-//             ntreeExecThreadNodes(exec, nts, data, thread);
-       }
-//     loop_copy_outputs(node, in, out, exec->stack);
-       
-       ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_tex_forloop(bNodeTreeType *ttype)
-{
-       static bNodeType ntype;
-
-       node_type_base(ttype, &ntype, NODE_FORLOOP, "For", NODE_CLASS_GROUP, NODE_OPTIONS);
-       node_type_socket_templates(&ntype, NULL, NULL);
-       node_type_size(&ntype, 120, 60, 200);
-       node_type_label(&ntype, node_group_label);
-       node_type_init(&ntype, node_forloop_init);
-       node_type_valid(&ntype, node_group_valid);
-       node_type_template(&ntype, node_forloop_template);
-       node_type_update(&ntype, NULL, node_group_verify);
-       node_type_tree(&ntype, node_forloop_init_tree, node_loop_update_tree);
-       node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-       node_type_exec_new(&ntype, group_initexec, group_freeexec, forloop_execute);
-       
-       nodeRegisterType(ttype, &ntype);
-}
-#endif
-
-/**** WHILE LOOP ****/
-
-#if 0 /* XXX loop nodes don't work nicely with current trees */
-static void whileloop_execute(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out)
-{
-       bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
-       bNodeThreadStack *nts;
-       int condition= (in[0]->vec[0] > 0.0f);
-       bNodeSocket *sock;
-       bNodeStack *ns;
-       int iteration;
-       
-       /* XXX same behavior as trunk: all nodes inside group are executed.
-        * it's stupid, but just makes it work. compo redesign will do this better.
-        */
-       {
-               bNode *inode;
-               for (inode=exec->nodetree->nodes.first; inode; inode=inode->next)
-                       inode->need_exec = 1;
-       }
-       
-       nts = ntreeGetThreadStack(exec, thread);
-       
-       /* "Condition" socket */
-       sock = exec->nodetree->outputs.first;
-       ns = node_get_socket_stack(nts->stack, sock);
-       
-       iteration = 0;
-//     group_copy_inputs(node, in, nts->stack);
-       while (condition && iteration < node->custom1) {
-//             if (iteration > 0)
-//                     loop_init_iteration(exec->nodetree, nts->stack);
-//             ntreeExecThreadNodes(exec, nts, data, thread);
-               
-               condition = (ns->vec[0] > 0.0f);
-               ++iteration;
-       }
-//     loop_copy_outputs(node, in, out, exec->stack);
-       
-       ntreeReleaseThreadStack(nts);
-}
-
-void register_node_type_tex_whileloop(bNodeTreeType *ttype)
-{
-       static bNodeType ntype;
-
-       node_type_base(ttype, &ntype, NODE_WHILELOOP, "While", NODE_CLASS_GROUP, NODE_OPTIONS);
-       node_type_socket_templates(&ntype, NULL, NULL);
-       node_type_size(&ntype, 120, 60, 200);
-       node_type_label(&ntype, node_group_label);
-       node_type_init(&ntype, node_whileloop_init);
-       node_type_valid(&ntype, node_group_valid);
-       node_type_template(&ntype, node_whileloop_template);
-       node_type_update(&ntype, NULL, node_group_verify);
-       node_type_tree(&ntype, node_whileloop_init_tree, node_loop_update_tree);
-       node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
-       node_type_exec_new(&ntype, group_initexec, group_freeexec, whileloop_execute);
-       
-       nodeRegisterType(ttype, &ntype);
-}
-#endif