Nodes that Iterate



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/11/2002 at 08:52, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.012 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;  XPRESSO  ;

    ---------
    Is there an example of a node that iterates through several indices while requesting the appropriate indexed data from a node wired to a iteration node's in port?
    Thanks!
    darf - bhodiNUT



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/11/2002 at 09:14, xxxxxxxx wrote:

    Parsing message: ............................ [PARSE FAILED!]
    Could you clarify what you mean? An example? (The answer is of course "no" by definition, since there are no GV examples at all, but if I understand what you mean I might be able to help... :-)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/11/2002 at 12:05, xxxxxxxx wrote:

    Well, I am trying to create a node that cycles through a loop executing for each index. Seems like those ITERATE enumerations running around in the headers would elude to an iterate functionality within the nodes. Is there a possibility of an example sometime?  ;-)
    Best Regards,
    darf - bhodiNUT



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/11/2002 at 13:36, xxxxxxxx wrote:

    Here's an example that outputs seven iterated vectors. It's a bit useless at the moment, since not very many nodes expect an iterated stream of vectors alone, but it should show the main principle.
    >

    \>     
    \>     
    \>     // gviteratortest.cpp  
    \>     >   
    \>     > #include "c4d.h"  
    \>     > #include "c4d_operatordata.h"
    \>     
    \>     
    \>     
    \>     
    \>     const GvOperatorID GVTESTITERATOR_ID = 1010815;  
    \>     > static LONG input_ids[] = { 0 };
    \>     
    \>     
    \>     
    \>     
    \>     class GvTestIterator : public GvOperatorData  
    \>     > {  
    \>     > private:  
    \>     >   GvCalcTable* table;  
    \>     >   GvValuesInfo ports;
    \>     
    \>     
    \>     
    \>     
    \>       Bool cached[MAX_THREADS];  
    \>     >   Vector cache[MAX_THREADS];
    \>     
    \>     
    \>     
    \>     
    \>     public:  
    \>     >   GvTestIterator(void) : table(NULL) {}
    \>     
    \>     
    \>     
    \>     
    \>       Bool InitCalculation(GvNode *bn, GvCalc *c, GvRun *r)  
    \>     >   {  
    \>     >     for (LONG i = 0; i < MAX_THREADS; ++i)  
    \>     >     {  
    \>     >       cached[i] = FALSE;  
    \>     >       cache[i] = Vector();  
    \>     >     }
    \>     
    \>     
    \>     
    \>     
    \>         return (c && c->master) &&  
    \>     >            (table = c->master->AllocCalculationTable(c->cpu_count, TRUE, 16, TRUE)) &&  
    \>     >            (GvBuildValuesTable(bn, ports, c, r, input_ids));  
    \>     >   }
    \>     
    \>     
    \>     
    \>     
    \>       void FreeCalculation(GvNode *bn, GvCalc *c)  
    \>     >   {  
    \>     >     if (table && c && c->master)  
    \>     >     {  
    \>     >       c->master->FreeCalculationTable(table);  
    \>     >       table = NULL;  
    \>     >     }  
    \>     >     GvFreeValuesTable(bn, ports);  
    \>     >   }
    \>     
    \>     
    \>     
    \>     
    \>       Bool AddToCalculationTable(GvNode *bn, GvRun *r)  
    \>     >   {  
    \>     >     return (r) &&  
    \>     >            (r->AddNodeToCalculationTable(bn));  
    \>     >   }
    \>     
    \>     
    \>     
    \>     
    \>       Bool Calculate(GvNode *bn, GvPort *port, GvRun *r, GvCalc *c)  
    \>     >   {   
    \>     >     if (port && (r->GetCpuID() < MAX_THREADS) && cached[r->GetCpuID()])  
    \>     >     {  
    \>     >       port->SetVector(cache[r->GetCpuID()], r);  
    \>     >     }  
    \>     >     else  
    \>     >     {  
    \>     >       GvPort* itport = bn->GetOutPort(0);  
    \>     >         
    \>     >       const LONG N = 7;  
    \>     >       for (LONG i = 0; i < N; ++i)  
    \>     >       {  
    \>     >         cache[r->GetCpuID()] = Vector(i, 2*i, 3*i);  
    \>     >         cached[r->GetCpuID()] = TRUE;
    \>     
    \>     
    \>     
    \>     
    \>             r->SetCalculationTable(table);  
    \>     >         itport->SetRecalculate(r, TRUE);   
    \>     >         r->CalculateTable(c);  
    \>     >       }  
    \>     >         
    \>     >       r->SetCalculationTable(table);  
    \>     >       itport->SetRecalculate(r,TRUE);  
    \>     >       table->ResetTable(r);  
    \>     >     }  
    \>     >       
    \>     >     return TRUE;  
    \>     >   }
    \>     
    \>     
    \>     
    \>     
    \>       static NodeData* Alloc(void) { return gNew GvTestIterator; }  
    \>     > };
    \>     
    \>     
    \>     
    \>     
    \>     Bool RegisterGvTestIterator()  
    \>     > {  
    \>     >   return GvRegisterOperatorPlugin(  
    \>     >     GVTESTITERATOR_ID, "Gv Test Iterator", 0,   
    \>     >     GvTestIterator::Alloc, "GVtestiterator", 0,   
    \>     >     ID_GV_OPCLASS_TYPE_GENERAL, ID_GV_OPGROUP_TYPE_GENERAL, 0, NULL);  
    \>     > }
    \> 
    \> 
    

    >
    >

    \>     
    \>     
    \>     // GVtestiterator.res  
    \>     >   
    \>     > CONTAINER GVtestiterator  
    \>     > {  
    \>     >   NAME GVtestiterator;  
    \>     >   INCLUDE GVbase;  
    \>     >     
    \>     >   GROUP ID_GVPROPERTIES  
    \>     >   {  
    \>     >  VECTOR GVTEST_POINTITERATOR {OUTPORT; STATICPORT; CREATEPORT; ITERATOR;}  
    \>     >   }  
    \>     > }
    \> 
    \> 
    

    >
    >

    \>     
    \>     
    \>     // GVtestiterator.h  
    \>     >   
    \>     > #ifndef _GVtestiterator_H_  
    \>     > #define _GVtestiterator_H_
    \>     
    \>     
    \>     
    \>     
    \>     enum  
    \>     > {  
    \>     >  GVTEST_POINTITERATOR = 1010060  
    \>     > };
    \>     
    \>     
    \>     
    \>     
    \>     #endif
    \> 
    \> 
    

    >
    >

    \>     
    \>     
    \>     // GVtestiterator.str  
    \>     >   
    \>     > STRINGTABLE GVtestiterator  
    \>     > {  
    \>     >   GVtestiterator "GV Test Iterator";
    \>     
    \>     
    \>     
    \>     
    \>       GVTEST_POINTITERATOR "Point iterator";  
    \>     > }
    \> 
    \> 
    

Log in to reply