Maya project folder depending on version

Hey everyone!

At the moment the defaultconfig2 places all work-versions of a maya file in one folder and configures the maya project folder to the work area (…/maya/work/) .
This automatically results in not versioning all project depended folders (like data, xgen, etc.), so backups of hair for example need to be saved manually (which is very time consuming).

SG runs into problems when I just change the work area to “maya/work/{version}”
because there’s not a version available when first creating the scene. The only thing I can do is change the folder where the maya file is saved to “maya/work/{version}”, but that of course doesn’t change where Maya sets its projects space.

I think no hook of the workfiles2 app really covers that behaviour so am I correct, that this is not editable at the moment without diving deeper into the app and rewrite it?
Of course I would still need to copy the needed scene folders (like xgen, data) into the version folder when a scene is saved in a new version.

Before i start hacking the workfiles2 app, I just wanted to ask, whether i am missing something here and there’s actually a smarter way of doing this.

Thanks in advance!
Jonas

1 Like

Hi Jonas –

You’re correct that you can’t have version numbers in the folder schema because they’re not known at folder creation time. But, the scene_operation hook does run at file save time. So, you could add your folder creation logic here.

If you move your scene file so that it no longer matches the template you’re using for Maya work files (likely maya_shot_work or maya_asset_work), then you’ll hit problems down the line: File Open won’t be able to find the file, etc. But if you’re just putting the dependency files into a separate folder, you should be able to do that without problem. The hook does take a file_version argument, so you’ll have access to the info you need to do this.

Hope that helps! Let us know if you have any other questions.

2 Likes

Hey @tannaz, thanks for your reply!

These are my templates:

asset_work_area_maya: .../work/maya
maya_shot_work: .../work/maya/v{version}

The first one isn’t realy correct, because i want my work area for maya to be in the version folder as well. As you confirmed I cannot simply add it to the template because the internal engine procedure for context switching doesn’t know the version when a file is first created.

So what I tried now is setting the maya project folder after creating the file in the scene_operation hook. The problem that occurs is that the maya engine sets the projects folder after the hook is executed, so my maya console ouput looks like this:

Shotgun scene_operation_tk-maya: Setting project to ".../work/maya/v001"
Shotgun tk-multi-workfiles2: Changing context from Project to Asset
Shotgun tk-maya: Setting project to ".../work/maya"

So the scene operation hook in this case isn’t realy helping me. I still don’t want to alter the maya engine or the workfiles app. Can you think of another way? I realy dont understand why the environment (workspace.mel) should be the same for every version, because things like xgen fur won’t be versioned at all. Another solution would be to rewrite the workspace.mel file everytime another version gets opened, but that would be a very hacky and unclean solution i guess.

Thanks again
Jonas

1 Like