Jump to content
Sign in to follow this  
felo44

Save as

Recommended Posts

Hi,

Someone know how to use "save as" in Pyhton?

Note: I'm looking for the same functionality as the "save as" under file drop menu. Therefore saveAsBackup() is not ideal.

Thanks,

Edited by felo44

Share this post


Link to post
Share on other sites
fileStr = '/path/to/save.hip'
hou.hipFile.save(file_name=fileStr, save_to_recent_files=False)

Something like that should work?

  • Like 1

Share this post


Link to post
Share on other sites

No really, I forgot to said that the current session should not be affected, so if I use save(), the session will became the new file, that's why I am looking into a "save as" functionality.

Share this post


Link to post
Share on other sites

I usually do something like this in that case:

originalFile = hou.hipFile.path()

# run the code I posted earlier to save the file here

hou.hipFile.setName(originalFile)

So after the code runs the file is reverted back to kind of an untouched state.

If you wanted to wrap that up into a saveAs() function it should be pretty easy

Share this post


Link to post
Share on other sites

No problem, that's just the easiest way I could think of but if anyone else knows a better method please feel free to share!

 

  • Like 1

Share this post


Link to post
Share on other sites

This also throw me off when i wanted to save as. SESI should have a utility function in any case IMO.

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  

×