Jump to content

Unable to accumulate detail attribute with for each loop


AdamM

Recommended Posts

Hi.

I have a for each loop (looping over path) that reads primgroup details. If a prim is found to be part of a particular group I store the prim number in a string array detail attribute using setdetailattrib - append.
The string array is declared before the loop begins. I have checked each iteration of the loop using single pass and the values are being generated correctly (per loop).

I don't seem to be able to accumulate the values of the loop in the detail attribute. It will only remember the last iteration of the loop.

What am I doing wrong?

Thanks in advance.

houdinifx_jEYs4ZNZSF.png

Link to comment
Share on other sites

I think you need to set the attribwrangle to run over primitives.
I'm thinking that it needs to run over every primitive, so it changes the detail attribute each time.
Instead of detail which runs once, giving you one value.

Also, what is that attribcopy doing in the for-loop?
Isn't it overwriting the attribute you want to change?

Link to comment
Share on other sites

That copy node was just one of the many attempts I made at trying to consolidate the information into the detail attribute, I shouldn't of posted it in the picture.

On the first pass of the loop I get the following prims [0, 2, 6, 9, 10, 12].
Second pass gives me an empty array (this is expected)
Third pass gives me [3, 4, 5, 15, 16, 23, 32, 68]

I want to exit the loop with the detail array having [0, 2, 6, 9, 10 12, 3, 4, 5, 15, 16, 23, 32, 68], but it only ever has [3, 4, 5, 15, 16, 23, 32, 68].

I simplified the case using the expandprimgroup function and tried both a detail and primitive loop.

The primitive numbers (and geometry) are changed on the right hand side of the graph, that is why I copy back them back to the left hand side.
I have worked out a way to get it working. I simply record the current primitive number as a primitive attribute and then later copy it back to a detail attribute.

Update. 
This got it working.
Turns out that each time the loop inputs with the per piece it clobbers the detail attrib.
A second loop input with feedback retains attribute.

Thanks for helping
 

kVRw0OUlRy.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...