Jump to content

JXS

Members
  • Content count

    3
  • Donations

    0.00 CAD 
  • Joined

  • Last visited

  • Days Won

    1

JXS last won the day on February 20

JXS had the most liked content!

Community Reputation

2 Neutral

About JXS

  • Rank
    Peon

Personal Information

  • Name
    Jael Lopez
  • Location
    United States
  1. As a follow up, I created a simple shelf tool which implements the method I mentioned above. Here's a proof-of-concept:
  2. I was curious about this so I remote sessioned into Houdini...cause I’m at work at the moment. I used the Python Shell so I haven’t had a chance to test out a shelf tool or startup script version but it should work nonetheless. In the shell, running hou.getPreferenceNames() returns, among all the prefs, 2 autosave related preferences. There is a third one but it’s not immediately related to the problem at hand. 1: “general.autosaveinterval.val” This corresponds to the Auto Save Every X Minutes where X is the current value. 2: “general.autosaveinc.val” This corresponds to the Auto Save Method This is the one you’re looking for. To change preferences use hou.setPreferences(name, value) where name corresponds to the preference name and value to the value you desire. The values for Auto Save Method are as follows: ’0’ : Overwrite File ’1’ : Increment Filename ’2’ : Make Numbered Backup Let’s say that by default, my unsaved scene starts with the setting at Overwrite File and I want to change it to Make Numbered Backup. In the shell or shelf tool or wherever, I would just run the following: hou.setPreference(“general.autosaveinc.val”, “2”) If successful, the method will return True. Otherwise it will return False. Make sure that both the name and the value arguments you pass to it are strings, as in, in quotations or you may error out.
  3. Get time and date as a global variable

    I second the use of the datetime module as well. Here’s the documentation for that specific module. I found myself in a similar spot when I changed naming conventions for saving project files. I was always doing the whole 01_, 02_ thing, until I realized it wasn’t very intuitive for me. So I created a custom Python shelf tool that saves my hip files to a specific location using a date based naming convention. Here’s a snippet of the code containing the date/time section: def filePrep(self): timeStamp = datetime.datetime.now().strftime("%m-%d-%y_%I_%M_%p_") if self.ui.sys_time.isChecked() else None The sys_time portion is Qt-centric code since I’m wrapping it all in a QWidget using PySide2, but after all is said and done, the script outputs a directory which is then fed to the hou.hipFile.save() method and saves it. As an example, the code would spit out something like: $HOME/Projects/(Project Name Here)/hipfiles/02-18-20_10_49_AM_filename.hip Those % characters are format codes you can feed to the strftime method to return a string according to what you need. Check out the linked documentation.
×