Jump to content

(SOLVED) hipFile Save separately

Recommended Posts

Posted (edited)

Hi guys,

I was wondering if I can save through python without changing the current save to it? I want add a feature to my cache node where once it's cached it saves a back up file in a new folder. I don't want the current scene to change to said newly saved file through. Is this possible?

Edited by shadowst17

Share this post

Link to post
Share on other sites
import time
import hou

# Save a backup of the current Houdini session
def saveArchive():
    # Get the file path of the current Houdini session
    # (Equivalent to $HIP/$HIPNAME)
    ogFile = hou.hipFile.path()
    # What do we want to save the archive file as?
    fileStr =  hou.getenv("HIP")+"/backup/BKUP_"+time.strftime("%Y%m%d%H%M%S")+"_"+hou.hipFile.basename()
    # Make sure this is a string (I was getting errors if I didn't do this)
    fileStr = str(fileStr)
    # Save the archive file
    hou.hipFile.save(file_name=fileStr, save_to_recent_files=False)
    # Revert the name of the Houdini session to what it was prior to executing this function
    # Return the path of the newly saved file
    return fileStr


  • Thanks 1

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