[python] Check if cooking / get progress

   3382   3   1
User Avatar
Member
251 posts
Joined: July 2013
Offline
I'm a developer of SideKick ( https://vimeo.com/209455457 [vimeo.com] )

And I'm running into an issue.. if we tell Houdini to load a scene while it's cooking a sim, or when it's otherwise busy calculating a graph, Houdini just crashes.

I can't find a way using python to detect the there is a cook going on or not, any clues on how to approach this?

And second, i'd would like to get a sim's progress so I can display a progressbar in max.
More code, less clicks.
User Avatar
Member
7710 posts
Joined: July 2005
Offline
I'm surprised that it let you do this as there's usually a lock taken whenever you perform scene operations from python. If you can isolate a reproducible case, please submit a bug. I would have just expected the scene load to stall until it was done cooking.

To detect when a cook is going on or not, maybe you can register an event callback via hou.ui.addEventLoopCallback() so that you only do safe work on the main thread. Cooking also occurs in response to event handling on the main thread so I would expect no cooking to be happening when inside your event loop callback.

I don't know if there's any way to hook into cook progress from python. Maybe you can have Houdini started up from an environment where HOUDINI_ERRORLOG_FILENAME and HOUDINI_ERRORLOG_LEVEL are set and then you can poll for the progress from the error log when in Max.
User Avatar
Member
251 posts
Joined: July 2013
Offline
The callback might work indeed. A repo case is a bit hard to isolate, it involves a lot of moving parts and I don't think it a bug, more case of us rudely party crashing Houdini though the backdoor while it's cooking

And on second thought.. we actually don't want to wait for the sim to stop so I guess we'll just set time to 0 and send a few virtual ‘esc’ keypresses as wait a second or so to make it stop in case it was doing anything. A bit crude but effective.

Polling the errorlog is interesting approach.. (could be used to detect if a cook is happening as well)

Thanks!
More code, less clicks.
User Avatar
Member
8 posts
Joined: Aug. 2007
Offline
We use the QT main thread event loop to receive and process messages from the network, but maybe we can change it to use hou.ui.addEventLoopCallback(). Nyx is a bit complex, it as a lot of threading going under the hood.
Technical Director / Co-founder
You can do it! VFX
Lisbon / Porto
Portugal
  • Quick Links