Updating viewport with Python

   127   1   1
User Avatar
Member
11 posts
Joined: Dec. 2017
Offline
I'm having a hard time getting my scene to update using hou.setFrame()

I have a python script that advances through the timeline frame by frame and adjusts input values of a DOP sim and then returns values from the DOP sim.

That all works fine but the problem is when I run the script, the viewport and geometry spreadsheets dont update until after the script is finished.

I can print data to the command line that shows that the data is being fed back and forth and is being updated just fine.

If I add a popup message between each frame that waits for the user input, I can actually see the updates just fine, but its just when I loop through all the frames consecutively nothing shows up until the script is finished.

Ive tried using:
hou.Frame()
hou.Ui.TrggerUpdate()
hou.Hscript('fcur')

and nothing seems to update the viewport except showing the ui message window.

Any ideas?
User Avatar
Member
11 posts
Joined: Dec. 2017
Offline
I ended up separating my script into 2 parts. The core part I left in the HDA python module, and the part that runs every frame I moved into a python script node. To pass variables and objects back and forth I just write them to a file with pickle and then load them back in every frame. There has to be a better way but for now its working, and its actually fast enough for real-time playback
  • Quick Links