Ok, looks like it works.
$ cd c:\users\marcus\Dropbox\Pyblish
$ dash thedeal/ben/rig
Following this command, the current development directory will have been entered and the project, asset and family is visible in the window title.
It will have applied a number of environment variables.
PROJECTSROOT: Absolute path to where projects are located
PROJECTROOT: Absolute path to current project
DEVELOPMENTDIR: Absolute path to current development directory
PROJECT: Name of current project
ASSET: Name of current asset
FAMILY: Family of current asset
These may then be used in plug-ins.
Directory Creation
In addition to environment variables, dash
also creates the appropriate directories based on schema.yaml
.
$ dash thedeal/jerry/lookdev
Create new development directory for thedeal/ben/lookdev? [Y/n]:
The prerequisities are:
- The project must exist
- The asset must be pre-defined in
assets.yaml
- The family must be available in
schema.yaml
Error handling
Here’s how it handles the user typing in the wrong thing.
marcus@ALIENFX>dash badsyntax
# Invalid syntax, the format is project/asset/family
marcus@ALIENFX>dash noproject/ben/rig
# Project "noproject" not found
marcus@ALIENFX>dash thedeal/notexist/rig
# Asset "notexist" not defined
# Available assets:
# - ben
# - jerry
marcus@ALIENFX>dash thedeal/ben/notexist
# No pattern defined for family "notexist"
marcus@ALIENFX>exit
exit
puts you back at where you were before the context change, including the previous environment.
Integration
Finally, when running Maya from the same session, the directories have already been created and the project already set. Which means that when it comes time to save, the save dialog will automatically display the correct locations for new files to end up.
Integration is handled by Magenta via userSetup.py
. It looks like this.
development_dir = os.environ.get("DEVELOPMENTDIR")
if development_dir:
print("Setting Magenta development directory to: %s" % development_dir)
mel.eval('setProject \"' + development_dir + '\"')
Maintenance
From a developer point-of-view, this means.
- Pre-defining
assets.yaml
- Keep it up to date with new assets being added to a project
- Pre-defining families in
schema.yaml
- Putting
maya
on the PATH
.
Give it a try and let me know how it feels.