Jump to content
Sign in to follow this  

Real-time recorder python script

Recommended Posts

Hi guys,

I am working on a python script that bakes the hand movement of geometry with mouse in the viewport over the time and creates keys on each frame. In other word, I want to move my object with mouse in the view port and get the Transform/Rotation/Scale keyed on each frame.

Currently I am using hou.selectedNode() and the hou.parm() to access the specific parameters that I want to bake. 
Then I use a for loop to generate keyframe on each frame. Immediately after pushing the bake button it bakes the parameters value on the first frame for entire time line. I have tried using while loop with time.sleep() to wait for a bit after setting key on each frame, but it freeze the view port and I cant move my geometry. Is there anyway to make my code somehow that constantly check the new values of object parameters on each frame and allow me to work on the view port while it does its job in the background? Is this related to multi threading?

Here is my for loop
for f in timeline:
            setKey = hou.Keyframe()
            setKey.setValue( keyValue[f] )           


Edited by Blacko0ps

Share this post

Link to post
Share on other sites

Python interpreter runs in the main Houdini thread, so anything you do in python will freeze Houidini UI. Depending on what are you trying to achieve, try Mouse CHOP

Also, see hdefereval module which ships with Houdini.


Share this post

Link to post
Share on other sites

Thanks for the reply Alex! I have seen some tutorial on mouse chop, but I am limited to use python for this project. I am still new in python and not have enough knowledge about  hdefereval module. I am going to do more research about it. Please let me know if you have any references. Thanks.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this