foreach SOP issue

   3898   7   1
User Avatar
Member
696 posts
Joined: March 2009
Offline
It;s a bit hard to explain, but I have two curves that I run through a foreach SOP using the each number option. Inside I alternate between the curves and generate an attribute that correspond to the current iteration of the foreach SOP.
It escapes me though that the attribute doesn't reflect the actual iteration of the foreach SOP, but instead it's either 0 or 2, while if I bypass the delete SOP that alternates between the curves, I get the right attribute values, but for an incorrect amount of curves in the output.

It might sound a bit confusing, but if anybody would be willing to look into the file and suggest an approach or ask a question, Id' be happy!

Cheers

Attachments:
foreach_issue.hip (94.1 KB)

Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Staff
329 posts
Joined: July 2005
Offline
I think there is some confusion about the behaviour of parameters on the Delete SOP. The “Filter Expression” parameter is evaluated once per element. Items will be deleted if the parameter evaluates to a non-zero value. Consider using the “Group” or “Pattern” parameters.
User Avatar
Member
9 posts
Joined: Feb. 2008
Offline
i'm not sure if I understood your question correctly. is this what you are looking for?

Attachments:
foreach_issue_fixed.hip (90.8 KB)

User Avatar
Member
696 posts
Joined: March 2009
Offline
Hey, Michael

It's close, but not quite. I made a small change in the file that should make my issue a bit more evident. If you increase the number of iterations you'll see that we get a number of curves in the output that is equal to a multiple of the number of iterations and the number of primitives that entered the foreach in the first place.
In my understanding, I should be able to get sequential values (0, 1, 2, 3…) for the crv_idx attribute I created inside the foreach, but instead I get pairs of even numbers (0, 0, 2, 2, 4, 4…) as I increase the number of iterations.
Now I'm not sure what is the problem in my logic here…

Thanks a lot!

Attachments:
foreach_issue_fixed_197.hip (146.9 KB)

Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
696 posts
Joined: March 2009
Offline
derrick
I think there is some confusion about the behaviour of parameters on the Delete SOP. The “Filter Expression” parameter is evaluated once per element. Items will be deleted if the parameter evaluates to a non-zero value. Consider using the “Group” or “Pattern” parameters.

You got it, Derrick! I just used the same expression in the pattern parameter and it worked. I guess I should have made my expression evaluate based on primitive number in the filter expression for it to work, right?
I'll give it a try, but for now it works prefectly.

Cheers
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
9 posts
Joined: Feb. 2008
Offline
Is this what you want?

Attachments:
foreach_issue_fixed.hip (100.5 KB)

User Avatar
Member
696 posts
Joined: March 2009
Offline
michaelwang
Is this what you want?
exactly!

Thanks again, man.

Cheers
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
9 posts
Joined: Feb. 2008
Offline
you're welcome lol
  • Quick Links