Set node input as frozen geometry object Python

   1592   4   1
User Avatar
Member
21 posts
Joined: Nov. 2017
Offline
Hi I have a use case for Houdini where I want to do agent simulation, using the sop nodes, but treating each geometry separately. In the past I've used lot's of loops and solvers, which requires lots of merging and splitting, and problems with point/vertex/primitive attribute conflicts.
So I had this idea to use a Python script(not Sop) to loop through a string of nodes, setting an intitial input on the fly from a frozen geometry object, cooking the sequence then storing the output as a frozen geometry object. So I could store lists of these objects and pass them as inputs to abitrary network segments. No more horrific wire messes!
Is this possible?
The only other way I thought was to iteratively load from file, cook, then save to file, using a Python loop, or using a file merge if I wanted to process more than one.
I think being able to set a nodes input from a frozen geometry object with Python would make Houdini for me a lot more
procedural than it already is.
I guess what I'd like is to have the functionality of the nodes available completely in code. Perhaps I need the HDK for this?
Edited by wmpcg - July 5, 2022 08:52:15
User Avatar
Member
9387 posts
Joined: July 2007
Offline
You can use TOPs for processing multiple Geos with the same sop network independently, avoiding loops and merging/splitting

Or if you specifically want to pass frozen geometry to sops you can use Stash SOP for that and just set it's Data parameter with the geometry you want from Python
Edited by tamte - July 5, 2022 17:19:04
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
21 posts
Joined: Nov. 2017
Offline
Thanks, I haven't got to TOPs yet.
I did find this page about verbs:
Programmatic geometry with verbs [www.sidefx.com]
As I understand it hou.Geometry.merge() can merge objects even if they're empty.

node.geometry().clear()
node.geometry().merge(resultgeo)
User Avatar
Member
9387 posts
Joined: July 2007
Offline
Yes, you can also use verbs to apply some geo operations purely using Python for compilable nodes, however not for every sop or hdas so it's really up to you and your needs
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
21 posts
Joined: Nov. 2017
Offline
Yep, this is whole new way of thinking about Houdini, I'll have to make some plans.
  • Quick Links