Jump to content
Sign in to follow this  
kishenpj

Manual cook on open/save

Recommended Posts

kishenpj    11

Hey guys! On opening or saving any scene file, i want houdini to shift to frame $FSTART and turn to manual cook mode. So i know houdini needs a 456.py file in its home directory but i need help with the code. I've manged to find some help from other forums and ended up with this, which obviously doesn't work :lol: Badum Tss! 

 

hou.setFrame(1)

hou.setUpdateMode(hou.updateMode.Manual) 

hou.updateModeSetting() 

hou.updateMode.Manual

 

Share this post


Link to post
Share on other sites
Hartman-    4

Is the 456.py file in the correct location? It should be located in $HOME/houdiniXX.X/scripts. On windows this will most likely be C:/Users/USERNAME/Documents/houdini16.0/scripts. I'm not on a mac box right now and I'm blanking on the location, you should be able to get a idea for it through some quick commands. http://www.sidefx.com/docs/houdini/basics/config_env#browsing-environment-variables ... you could even go into the save dialog and type in $HOME to path to the home directory. 

The first 10-15 minutes of this video talks the 123.py and 456.py files and how they are used. 

https://www.sidefx.com/tutorials/illume-webinar-houdini-in-the-pipeline/

My best guess is that the file isn't being found. I was able to setup a quick 123.py file that set the update to manual and the frame to 30 without trouble. 

Hope this helps!

  • Like 1

Share this post


Link to post
Share on other sites
kishenpj    11
35 minutes ago, Hartman- said:

Is the 456.py file in the correct location? It should be located in $HOME/houdiniXX.X/scripts. On windows this will most likely be C:/Users/USERNAME/Documents/houdini16.0/scripts.

Oh ya, now it works. Thanks!

hou.setFrame(1)

hou.setUpdateMode(hou.updateMode.Manual)

hou.updateModeSetting()

Now, how do i tell houdini to always save with manual mode and shift to $FSTART? I think it's better to save hip file in manual mode instead.

Share this post


Link to post
Share on other sites
Hartman-    4

For the frame range...

You can try to execute hscript via python using hou.hscript() http://www.sidefx.com/docs/houdini/hom/hou/hscript

Similar to what this guy was trying to do: https://www.sidefx.com/forum/topic/43552/

I'm not at my box to confirm but these seem like they are what you want. Also look into the hou.playbar module, lots of good stuff in there. 

I'm not sure about saving in manual mode... I'll have to do a bit more research myself, I've always just defaulted to opening in manual mode, no matter what. 

Edited by Hartman-

Share this post


Link to post
Share on other sites
Hartman-    4
6 hours ago, kishenpj said:

Oh ya, now it works. Thanks!


hou.setFrame(1)

hou.setUpdateMode(hou.updateMode.Manual)

hou.updateModeSetting()

Now, how do i tell houdini to always save with manual mode and shift to $FSTART? I think it's better to save hip file in manual mode instead.

As a quick update... it looks like the best solution for the frame range to start at $FSTART would be to do something like this:

firstFrame = hou.playbar.timelineRange()[0]
hou.setFrame(firstFrame)

timelineRange() returns the first and last frame of the animation settings ($FSTART, $FEND), not necessarily what the timeline is set to ($RFSTART, $RFEND)

Share this post


Link to post
Share on other sites
kishenpj    11
14 hours ago, Hartman- said:

As a quick update... it looks like the best solution for the frame range to start at $FSTART would be to do something like this:


firstFrame = hou.playbar.timelineRange()[0]
hou.setFrame(firstFrame)

timelineRange() returns the first and last frame of the animation settings ($FSTART, $FEND), not necessarily what the timeline is set to ($RFSTART, $RFEND)

Awesome! I've found this btw http://www.sidefx.com/docs/houdini/hom/locations but beforescenesave.py seem to work only for H16.

I'm stuck with H15.5 for now and http://www.sidefx.com/docs/houdini15.5/hom/locations doesn't say anything about scripts before or after saving the hip file.

Edited by kishenpj

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  

×