Jump to content

ForEach (by group) - delete the currently processed group (of primitiv


Scratch

Recommended Posts

Hey Guys,

I fractured some rocks using voronoi, and clustered some pieces together, also giving each cluster (of pieces) a specific color. Then I created groups based on color, so every cluster of pieces ended up in their own group

The groups are named like this:

rock01_cluster_233_145_34

rock01_cluster_134_254_59

...

I fed this to a foreach and used "by group"

rock01_cluster*

If I dive into the foreach, it works, it only shows one cluster of pieces. Fine.

What I want to do now is transfere an attribute from all other clusters to the currently processed cluster. So i need to have the currently processed cluster in one half of the tree, and all the other clusters except the currently processed cluster on the other half of the tree.

The idea I had: The FORVALUE should contain the whole group name of the currently processed group as a string. So i thought use a delete sop, delete by group -> `stamps("..", "FORVALUE", "")` and it should delete teh currently processed group, ...well should... but unfortunately if you put that expression in the group field, it does not work.

I also tried to put that expression into a font node to see whats inside the FORVALUE, but it does not show anything.

Does anyone know what I am doing wrong here?

Thanks folks! :)

post-7428-0-71327700-1361485982_thumb.jp

Link to comment
Share on other sites

Maybe you could post a .hip of the example that dont work?

It works for me with your expression copy/pasted into a delete sops group field. The only thing is that i cant see the evaluated result until i go out of the foreach. Once i dive back in again i can see the current piece group deleted from the geo when is put display flag on the delete sop.

I attached a hip file so you can test if this works for you. It works for me both if i am grouping by having "piece0 piece1 ...." or by just using a partition node and grouping by color :)

foreach_attribtransfer.hip

Edited by Magnus Pettersson
Link to comment
Share on other sites

Hey again,

You are totally right Magnus, it works like a charm! First i didnt go up and dive down (therefore it allways gave me an error and didn't show the correct result in the viewport) and second - shame on me! - I made the wrong backticks while typing the expression in houdini...it was a simple typo...corrected it and it worked!

So sorry for the confusion and thanks for pointing out that this is the correct way to go! :)

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...