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
felo44

Save as

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?

1 person likes this

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!

 

1 person likes this

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