Search - User list
Full Version: Cooking top nodes by script
Root » PDG/TOPs » Cooking top nodes by script
sanostol
Hi, I try to cook nodes with a python script, but … well, it could run better

I attached a file. I would like to open that file and run this python script:
top = hou.node('/obj/topNet/wedge1')

print top.path()
top.setDisplayFlag(True)
top.getPDGNode().cook(True)
work_items = top.getPDGNode().workItems
print (work_items)

when You run it directly after opening the file, it fails, top.getPDGNode() results in None.
after cooking the top nodes with the ui and deleting the results, the script works.
I wonder, what is going on here. Tt seems that a initial cool by hand, does initialize something so the getPDGNode does work. How can I do this?

thanks for any hints
Martin
tpetrick
That's because the PDG node graph does not exist until the TOP nodes have cooked – TOP nodes generate the PDG graph. The best way to achieve what you want is to use the TOP Node's execute graph function: https://www.sidefx.com/docs/houdini/hom/hou/TopNode.html#executeGraph [www.sidefx.com]

That will ensure that the TOP node is cooked before attempting the cook the PDG graph, and exposes various options to control the cook. That's what the TOP Fetch node uses, for example, to cook an external TOP network. You can see the implementation of that in $HH/python2.7libs/pdg/job/top.py
sanostol
Thank You!
EDIT:

The “executeGraph” method works fine in a running session, all the PDGNodes are accessible. But I tried to use it in a hda “on loaded” event and again, I get a None back from “getPDGNode” method
The “exectueGraph” method seems to have no effect in a “on loaded” event
is there a way to get that running in this kind of event?
Miquel A Corominas Pla
Hi Martin,

I have the same problem now in h18.5 to executeGraph() "onLoaded" event in HDA.

Have you found any solution?

Thanks,

MacPla
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB