I've got a python script I'd like to run from PDG via inProcesScheduler (using single), that runs pressButton()on a node I have in my wedge network.
I'd like this to run as the last step after writing out all my simulation wedges.
When I manually switch my wedge top to each work item, it properly switches and cooks the file path changes I'm doing per workItem correctly. The pressButton() then is supposed to build a new file read node using each adjusted wedge path.
However when I cook the pythonScript top, it seems that whats happening is that the button is being pressed each time, but the wedge parm change is not cooking, and I end up with the same path/name for every file node that the pressButton() is generating.
Is there a proper way I can force a cook one work item at a time, to get my wedge values to update before I run the pressButton()? I tried running node.cook() in my python script right before my pressButton() but that seems to lock up my session.
Any advice would be appreciated
thanks!
pythonscript to press button on node per work item
3852 6 0- redpaw
- Member
- 75 posts
- Joined:
- Offline
- redpaw
- Member
- 75 posts
- Joined:
- Offline
- tpetrick
- Staff
- 586 posts
- Joined: May 2014
- Offline
- redpaw
- Member
- 75 posts
- Joined:
- Offline
Hmm ok I guess I misunderstood how it works a bit, I thought that inprocessscheduler with “single” would still work in a non-parallel fashion so even if it were working in the background, it would still be “blocking” enough to be able to modify the scene data. If there is no way to currently do this in TOPS I would like to suggest that something like that be added as I can think of a bunch of uses for building “self building” tools or setups like I'm trying to do.
I would have to make a simplified version of the scene i have, to attach. I will try later!
In the mean time, a simple enough work around for me at the moment would be if you could point me in the direction of the python code needed to step thru a tops wedge node in a for loop, like you were clicking on each workitem dot in the UI, so it updates to that wedge, so I can then run my other commands.
Thanks so much for the reply!
-johnc
I would have to make a simplified version of the scene i have, to attach. I will try later!
In the mean time, a simple enough work around for me at the moment would be if you could point me in the direction of the python code needed to step thru a tops wedge node in a for loop, like you were clicking on each workitem dot in the UI, so it updates to that wedge, so I can then run my other commands.
Thanks so much for the reply!
-johnc
- tpetrick
- Staff
- 586 posts
- Joined: May 2014
- Offline
- redpaw
- Member
- 75 posts
- Joined:
- Offline
- tpetrick
- Staff
- 586 posts
- Joined: May 2014
- Offline
The pdg.WorkItem.makeActive context manager actually only works when used during a PDG cook, but there's no real reason for that to be the case. I've fixed it so that starting with tomorrow's daily build you'll be able to use it outside of a cook as well. For example, you'll be able to do something like the following from the Python Shell:
In that example I'm evaluating a parm which has a work item @attribute expression in it, and therefore needs an active work item to evaluate against.
The TOP node itself also has methods for selecting a work item in the UI, but that's specifically for UI interaction (see https://www.sidefx.com/docs/houdini/hom/hou/TopNode.html).
top_node = hou.node('/obj/topnet1/genericgenerator1') pdg_node = top_node.getPDGNode() for work_item in pdg_node.workItems: with work_item.makeActive(): print(top_node.parm('pdg_command').eval())
In that example I'm evaluating a parm which has a work item @attribute expression in it, and therefore needs an active work item to evaluate against.
The TOP node itself also has methods for selecting a work item in the UI, but that's specifically for UI interaction (see https://www.sidefx.com/docs/houdini/hom/hou/TopNode.html).
Edited by tpetrick - May 28, 2020 18:05:00
-
- Quick Links