Jump to content

(SOLVED) hipFile Save separately


shadowst17

Recommended Posts

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
Solved
Link to comment
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
    hou.hipFile.setName(ogFile)
    # Return the path of the newly saved file
    return fileStr

 

  • Thanks 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...