PDG force evaluate python SOP node

   2072   5   1
User Avatar
Member
385 posts
Joined: July 2018
Offline
I am calculating the bounding box in a python SOP node and generate a json file.

I want to process my graph through TOPs to go through a folder of 3d models and export each time my json file.
How can i force tops to evaluate the python node?
i am not exporting any geo alembic image etc. just a json file from python SOP node.
Edited by papsphilip - Aug. 26, 2021 13:16:01

Attachments:
json.hipnc (274.8 KB)

User Avatar
Member
9 posts
Joined: Oct. 2018
Offline
Better option would be implementing the logic in python script TOP instead of using python SOP.
Keep in mind that hou is not thread safe inside python script TOP when using in-process.
Edited by AmirAshkezari - Aug. 27, 2021 05:28:02
Amir Khaefi Ashkezari
Senior FX Artist at PFX

https://github.com/Amir-Ashkezari/ [github.com]
https://www.linkedin.com/in/amir-ashkezari/ [www.linkedin.com]
User Avatar
Member
385 posts
Joined: July 2018
Offline
Thanks for the tip!
yeah i thought so but i wanted to avoid that.
Also i have some other HDA nodes (Unity VFXToolbox) that export volume and point cache. They also need to evaluate somehow and TOPs wont do that.
Edited by papsphilip - Aug. 27, 2021 05:55:32
User Avatar
Staff
586 posts
Joined: May 2014
Offline
You can use a Geometry Import TOP to cook a SOP node from your TOP graph. If you don't need the output from the SOP, set the Storage -> Store Geometry As... parameter to None to avoid writing out a geo file or storing it to the work item. Additionally, if you want the SOP to recook for each work item make sure to enable Evaluate with Work Item Attributes on the geometry import.

Note that work items in the geometry import that are triggering a SOP cook will be processed one at a time. Additionally, while the SOP is cooking, the Houdini UI will be frozen/waiting on the SOP to finish evaluating. If you want to cook SOP nodes in parallel, you'll need to either package them into an HDA and use the HDA Processor node, or use compiled blocks + an Invoke TOP.
Edited by tpetrick - Aug. 27, 2021 11:40:56
User Avatar
Member
385 posts
Joined: July 2018
Offline
Seems the first method is not working. Throws an error "SOP node source type can only be used when generating static work items"

How would the compiled block method work? The python Sop as well as the other Unity VFX Toolbox HDAs are non compilable.

can you give me an example for the methods you have suggested?
Edited by papsphilip - Aug. 27, 2021 14:55:55

Attachments:
demoscene.hipnc (2.9 MB)

User Avatar
Staff
586 posts
Joined: May 2014
Offline
The error is from previous versions of Houdini where the geometry import could only import from SOPs if the node was static. That's no longer the case, but the error message wasn't removed. Starting with today's daily build of H18.5 that issue should be fixed, so you should be able to use that approach now to cook your SOP network.

As for compiled blocks/invoke, the documentation for the Invoke TOP includes an example: https://www.sidefx.com/docs/houdini/nodes/top/invoke.html. [www.sidefx.com] There are examples in the $HH/help/files/pdg_examples/top_invoke directory, as well as one embedded in that documentation page that you can open from within Houdini itself. There's also a page with more general guidelines on creating compiled blocks here: https://www.sidefx.com/docs/houdini/model/compile.html. [www.sidefx.com] The main requirement is that all of your SOP nodes are compileable.
  • Quick Links