Krion Posted February 7, 2020 Share Posted February 7, 2020 Hi, I would like to avoid renders or exports from being overridden. I thought putting a time variable in the filename would be able to fix that for me. I’ve found this _HIP_SAVETIME variable here, but that’s not enough as I can still make changes after I have saved the hip and export/override. Does anyone have any ideas on how to accomplish this? Thanks, Quote Link to comment Share on other sites More sharing options...
DonRomano Posted February 7, 2020 Share Posted February 7, 2020 I think you can set this through a python expression with the datetime module. import datetime date = datetime.datetime.now() export_date = date.day + "_" + date.month + "_" + date.year + "_" + date.hour + "_" + date.minute filepath = hou.Node(".").Parm("my_export_path") split = filepath.split("/") new_filepath = split[0] + "/" + .... + export_date + split[-1] hou.Node(".").setParm({"my_export_path" : new_filepath}) And you put this in a callback script of a custom button. I'm not really into python and Houdini those times so I'm not sure if this would work, but give it a try Cheers, Quote Link to comment Share on other sites More sharing options...
JXS Posted February 18, 2020 Share Posted February 18, 2020 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.