COFFEE node and link list issues
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/12/2008 at 17:19, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10
Platform: Mac ;
Language(s) : C.O.F.F.E.E ; C++ ; XPRESSO ;---------
Hey Guys,
I've got a COFFEE node calculating positions for a number of objects that are hooked to a linklist node. For each frame the code increments up through the total number of objects and calculates a new position for each, sending both the iteration number to the link list and the position data to the object linked to the linklist.
I get two scenarios:
1: the object dragged in to the xpresso window to create the linked object node is the only one that gets new position data. (Even though the "object" should get replaced by the link coming in the object port)
2: If I use a true empty object node (instead of dragging one in from the object manager) only the 20th object gets position data.Here's the code - it doesn't get much simpler:
Output2 is hooked to the input of the link list.
Input1 is hooked to the frame number (this doesn't really matter for this example)
Output1 is hooked to the globalposition port on the object node.>
\> main() \> { \> var ax,ay,az; \> var c=0; \> if(Input1<2) { \> Output2=0; \> } else { \> for(ax=-3;ax<4;ax++) { \> for(ay=-3;ay<4;ay++) { \> for(az=-3;az<4;az++) { \> c++; \> Output2=c; \> Output1=vector(ax\*100,ay\*100,az\*100); \> } \> } \> } \> } \> } \>
I have placed result nodes to check that iteration numbers and the position numbers and all is fine. I have also tried using individual x,y,z co-ords in case it didn't like the vector code.
I have also tried using in interation node as a filter between the outputed incrementer value (c in the code) and the link list.
If I send 0 through the last object number through the coffee node to the first and last iteration ports on the interation node, all objects move to the final calculated position (as I would expect).
I just can't seem to get both the iteration value and the position value to "take" for all objects.
In my mind what should happen is that on frame 2 all objects in the linklist should form a 3 dimensional matrix, 6x6x6, each 100 units from each other.
Thoughts? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/12/2008 at 05:18, xxxxxxxx wrote:
You can't use a COFFEE node as iterator for the link list node. You have to use an iterator node for going through the link list. Feed the iterator output into your COFFEE node to access the different objects of the link list. Some like this:
>
\> main() \> { \> //Input1 comes from a Iteration node, going from 0-216 \> \> var i = Modulo(Input1,6); \> var j = Modulo(Input1/6,6); \> var k = Modulo(Input1/36,6); \> \> //i,j,k going each from 0-6 \> \> //Output1 is the position of the objects in the list \> Output1 = vector(i\*100,j\*100,k\*100); \> } \>
cheers,
Matthias