Foreach sop again
8865 12 3-
- Mudvin
- Member
- 66 posts
- Joined: July 2005
- Offline
I'm digging information about foreach and seems i'm starting to understand how it works, but 2 things still unclear:
1. how to get object connected to foreach inputs? opinput() or something else?
And is it possible to refer to those input “sockets” from inside the foreach?
2. how to get coordinates of a point currently processed inside of foreach sop?
I've got a number of groups with single point in each, made with “partition”, im iterating over these groups, but how to get position of that single point that is currently being processed?
Update: fixed mistake, partition, not attribcreate. Attribcreate i tried for iterating over point attributes.
1. how to get object connected to foreach inputs? opinput() or something else?
And is it possible to refer to those input “sockets” from inside the foreach?
2. how to get coordinates of a point currently processed inside of foreach sop?
I've got a number of groups with single point in each, made with “partition”, im iterating over these groups, but how to get position of that single point that is currently being processed?
Update: fixed mistake, partition, not attribcreate. Attribcreate i tried for iterating over point attributes.
Edited by - March 24, 2012 11:48:49
wbr, Mudvin
-
- sadhu
- Member
- 112 posts
- Joined: Feb. 2010
- Offline
If you are inside foreach sop and you want to access the node connected to any of the inputs of foreach sop use
opinputpath(“..”,0) - gives the path of the node connected to the 0th input of foreach. (Look at the output of font1 node in foreach sop )
Similarly instead of 0 if you write 1, you will get path of the node connected to the 1st input of foreach and so on.
All your groups will be processed on every frame by foreach sop so I dont think you can access current group being processed but I am not sure , I should say I dont know if it is possible.
But then you can make foreach operator to work on different group on different frame and so you know which group or point is processed and you can get its coordinates easily. I dont know if this is what you want.
File is created in H 11
I hope this helps you.
opinputpath(“..”,0) - gives the path of the node connected to the 0th input of foreach. (Look at the output of font1 node in foreach sop )
Similarly instead of 0 if you write 1, you will get path of the node connected to the 1st input of foreach and so on.
All your groups will be processed on every frame by foreach sop so I dont think you can access current group being processed but I am not sure , I should say I dont know if it is possible.
But then you can make foreach operator to work on different group on different frame and so you know which group or point is processed and you can get its coordinates easily. I dont know if this is what you want.
File is created in H 11
I hope this helps you.
![](/static/djangobb_forum/img/smilies/smile.png)
-
- sadhu
- Member
- 112 posts
- Joined: Feb. 2010
- Offline
-
- Mudvin
- Member
- 66 posts
- Joined: July 2005
- Offline
Examining your files at the moment, just want to explain: imagine a simple grid wired into foreach sop, what i want, is, say, to create sphere or box at each grid point location.
Just for some reason i cannot wire network to “each” inside, and have to get that point coords with expression.
Just for some reason i cannot wire network to “each” inside, and have to get that point coords with expression.
wbr, Mudvin
-
- tamte
- Member
- 8723 posts
- Joined: July 2007
- Offline
-
- Mudvin
- Member
- 66 posts
- Joined: July 2005
- Offline
-
- Mudvin
- Member
- 66 posts
- Joined: July 2005
- Offline
-
- tamte
- Member
- 8723 posts
- Joined: July 2007
- Offline
-
- Mudvin
- Member
- 66 posts
- Joined: July 2005
- Offline
-
- Mudvin
- Member
- 66 posts
- Joined: July 2005
- Offline
-
- oblongowl
- Member
- 40 posts
- Joined: July 2009
- Offline
-
- Mudvin
- Member
- 66 posts
- Joined: July 2005
- Offline
Aha, i wasn't sure if houdini embeds OTLs into hip files or not. Here's hda.
Basically it's a very simple procedural lightning with randomized seed based on destination point coord, so every lightning in a pack differs from others.
Probably nothing new for you guys, it was made to refresh my houdini knowledge. Probably i will make more advanced version with forking as a python sop soon, seems it's easier for to just write little lightning(src, dst) function than make all these node trees.
Basically it's a very simple procedural lightning with randomized seed based on destination point coord, so every lightning in a pack differs from others.
Probably nothing new for you guys, it was made to refresh my houdini knowledge. Probably i will make more advanced version with forking as a python sop soon, seems it's easier for to just write little lightning(src, dst) function than make all these node trees.
wbr, Mudvin
-
- old_school
- Staff
- 2540 posts
- Joined: July 2005
- Offline
ForEach SOP uses the same mechanism that Copy SOP stamping does. Stamping in Copy vs ForEach, use which is more comfortable for you. ForEach can be easier for others to understand (logic encapsulated in the subnet). You can still use the stamp function outside the ForEach SOP same as Stamping with Copy SOP using the stamp() function.
See the attached example file of the ForEach SOP set up to do a basic Copy Stamp operation with the stamp() function outside the ForEach SOP.
That should get the ideas flowing.![](/static/djangobb_forum/img/smilies/smile.png)
—-
Embedding OTLs inside the hip file is an option in the Operator Type Manager.
Windows > Operator Type Manager > Configuration Tab
—-
As for connecting particle systems to create either lines or surfaces, have a look at the Wispy Smoke tool in the FX Tool kit. You can download the FX Tools from any Shelf in Houdini. Press the “+” to the right of the tabs on a shelf and choose Download Shelf. Find the FX Tools and download them. Then have a look at the Wispy Smoke asset.
See the attached example file of the ForEach SOP set up to do a basic Copy Stamp operation with the stamp() function outside the ForEach SOP.
That should get the ideas flowing.
![](/static/djangobb_forum/img/smilies/smile.png)
—-
Embedding OTLs inside the hip file is an option in the Operator Type Manager.
Windows > Operator Type Manager > Configuration Tab
—-
As for connecting particle systems to create either lines or surfaces, have a look at the Wispy Smoke tool in the FX Tool kit. You can download the FX Tools from any Shelf in Houdini. Press the “+” to the right of the tabs on a shelf and choose Download Shelf. Find the FX Tools and download them. Then have a look at the Wispy Smoke asset.
There's at least one school like the old school!
-
- Quick Links