maya - better increment and save

introduction

maya’s Increment and Save menu command is commonly used to automatically version up (or iterate) a scene file. It does this by searching the filename for a particular pattern. In Maya’s case, this is a four-padded number, preceded by a period, before the extension at the end of the filename (i.e. filename.####.ma). If the pattern is found, it will “increment“ the number up by one, then save a new scene. If the pattern is not found, it will append 0001 to the filename before saving a new scene.

now objectively, there is nothing wrong with this versioning pattern, it does work. However, it is not commonly practiced in the VFX/commercial industry. Nor does it abide by the file naming conventions outlined in the VES Handbook. According to the handbook, facilities should denote scene and render versions with a lower-case letter “v” typically followed by a three-digit padded number (v###). The version should be preceded by an underscore, and placed at the end of scene/render file name (i.e. scenename_v###.ma & scene_name_v###.%04d.exr).

there are a few good reasons to use the handbook’s recommendation. For one, it provides a strong regex for programmatically finding the version in a filename. And secondly, as mentioned before, it’s an adopted/recommended practice in the post-production industry. There are even some applications (like Nuke) that have integrated this version pattern into their software.

lastly, if we compare between Maya’s default behavior and the VES recommend below. You can see (when using Maya’s default) where the scene version and frame-range padding (represented by hashes) might be confused when looking at a filename.

  • Maya’s default versioning
    • filename.0001_####.exr
    • filename.0001.####.exr
  • VES recommended versioning
    • filename_v001.####.exr

in the variations listed above, the VES recommend provides a much “cleaner” view of file versions. Alternatively, an underscore can be used between the filename and file sequence frame padding (i.e. filename_v001_####.exr). I see a lot of After Effects/C4D artist use this naming convention. Keep in mind though, it’s important to unify file-naming conventions across all application in a pipeline to avoid confusion.

solution

i’ve dubbed my alternate solution as the Better Increment And Save, or the BIAS command. The plugin overrides the Increment and Save menu command in Maya. When the command is invoked, BIAS will iterate the version up by one and save to a new scene file. This is, of course, if the filename contains the accepted version pattern (v[0-9]+).

but here’s the cool, time-saving part! Let’s say you generated 10 versions of an animation scene and it was somehow decided that v003 was the best one to continue with. If you open v003, and invoke the Increment and Save command, then it will prompt whether to overwrite v004 (since it already exists) or to make v003 the latest version (v011 in this scenario). You might be familiar with this same functionality of Nuke’s Increment and Save command. Lastly, it automatically updates the Version Label field with the same version.

caveats

this script assumes all related scene files are located in their own separate directories. This means you’ve organized all aspects of the cg pipeline (i.e. model, rig, anim, light, etc.) into separate sub-directories under a parent shot or asset directory and are using those sub-directories to store the appropriate scene files. (i.e. SH0010/ANIM/SH0010_ANIM_v001.ma).

also, while not required, it iHandbooks recommended to separate the version pattern using underscores as well as use a padded number containing 3 digits or more, per the VES Handbook. When using a 1 or 2 digit padded number you start to run into sorting issues at higher numbers where v1 and v10 OR v11 and v110 are considered consecutive numbers by the file-system. You can test this in a file explorer.

implementation

  1. Download the gist code block below and save the file to your user preference’s plug-ins directory or a shared plug-ins directory (if you have one setup). If the listed directories below do not exist, you can simply create them.
    • WIN = C:/Users//Documents/maya/plug-ins
    • OSX = /Users//Library/Preferences/Autodesk/maya/plug-ins
    • Linux = /home//maya/plug-ins
  2. Start (or restart) Maya, and load the plugin via Windows > Settings/Preferences > Plug-in Manager
  3. Once loaded, upon saving a scene with the valid version convention (v[0-9]+), you can use the increment and save menu command (File > Increment and Save). You should see your scene version iterate up with repeated use. As well, the Version Label in the render settings should update with a matching version.

Please note, the plugin utilizes Maya’s Python API 2.0 and should be backward compatible to Maya 2016.

codeblock

Afterword

i hope this post and plugin are helpful or provide reference when building pipeline tools. If you’re interested in learning more about overriding Maya’s default commands, you can check out this article from around-the-corner blog. It was a valuable resource for me when putting this plugin together. As well, I highly recommend to checkout the VES Handbook if you haven’t already. It is written and compiled from several leading professionals from multiple disciplines in the visual effects industry. This handbook provides super valuable production experience, recommendations, and guidelines for the entire post-production pipeline and process.

please feel free to post any questions, issues or feature requests in regards to the Better Increment and Save plugin below or on GitHub.