Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
Blacko0ps

Real-time recorder python script

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.setFrame(f)
            setKey.setValue( keyValue[f] )           
            ParmList.setKeyframe(setKey)
            hou.setFrame(f)

Thanks,

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  
Followers 0