0

Toolkit version increments and handling of underscores

Hey guys,

So I am using the pipeline toolkit in maya.

And I have called my scene foo0010 after the shot. The problem I have is when I save the scene again rather than trying to create a foo0010.v002 it tries to make foo0011.v001. Can you confirm if this is the suspected behaviour or let me know if I'm doing something wrong. 

Also while I'm here whats the deal with not being able to use underscores in file names I wanted to try calling the foo0010_anm instead but can't which I find odd.

Cheers,
Dave

1 comment

  • 0
    Avatar
    Manne Öhrström

    Hey Dave,

    Sorry about the confusion! Let me try to explain!

    We use something called the Toolkit template system to keep track of where files go on disk. This system lets you split up a path into various fields based on some pattern matching. The idea is to make it easy to write tools (we call them apps!) that can work with lots of different file naming conventions.

    When you are doing a Shotgun Save As, the save as is populating two fields: a name and a version field. These are then generating a path on disk via the template system. The default configuration that (I think!) you are using looks like this:

    maya_asset_work: '@asset_root/work/maya/{name}.v{version}.ma'
    

    ( See here for details: https://github.com/shotgunsoftware/tk-config-default/blob/master/core/templates.yml#L317 )

    The idea with the saving and publishing app suite in Toolkit is that whenver you publish (or alternatively choose the version up current scene option on the menu), the version number gets bumped. If you do Shotgun Save As, it tries to save your current scene but with a different name. It will keep the same version number for the new file that you create unless you tick the "reset version no" box. In that case it will set the version to 1.

    When the save as dialog is suggesting a new name for you, it tries to append a 1 to the end of the current name, except if the file name ends in a series of digits. In that case it tries to increment that number. So if you save-as as test, and then try save-as again, it will suggest test1. If you save that and then trying save-as again, it will suggest test2. In your case, it tries to suggest foo_0011 because the current file name is foo_0010.

    Here's a list of events to illustrate:

    • Initial save-as. We name the file test. Version number will be set to 1. With the standard template, the file name will be test.v001.ma
    • Publish! Version number gets bumped and our current scene will be test.v002.ma
    • If I now go shotgun save as, it will suggest the name test1. If you accept this default, it will create the file test1.v002.ma, unless you check the reset version number box in which case it would create test1.v001.ma.

    Hope this helps explain the behaviour!

    As for the underscore issue, this is something which is controlled by configuration:

    https://github.com/shotgunsoftware/tk-config-default/blob/master/core/templates.yml#L42

    By removing the restriction that the name field should be alpha numeric, you can type in underscores (and lots of other stuff!). The reason we made it alphanumeric by default is because a lot of our default paths are using underscore as a separator which make things tricky!

    nuke_shot_render_mono_dpx: '@shot_root/work/images/{name}/v{version}/{width}x{height}/{Shot}_{name}_{output}_v{version}.{SEQ}.dpx'
    

    Consider the case above (which can be found here: https://github.com/shotgunsoftware/tk-config-default/blob/master/core/templates.yml#L249 ). There are two fields, {name} and {output} and if both of these fields could contain underscores, it would be tricky to parse. If {name}_{output} is foo_bar_baz, is name foo_bar and output baz or is name foo and output bar_baz?

    The template system is pretty flexible to configure so by all means go ahead and change the restrictions! We are happy to help out and give advice and guide you though the process! There reference syntax can be helpful and you can find it here: https://support.shotgunsoftware.com/entries/95441137

    Hope that helps! Don't hesitate to reach out if you have further questions!

    Thanks!
    Manne

Please sign in to leave a comment.