I have a project on GitHub that I’m (slowly) populating with useful-to-me Mel and Python scripts for Maya (Windows only at this point) that I’d like to share. It’s GitHub - CausticPro/MayaVisualizerTools: Python modules, Mel scripts, and related data to help make Caustic Visualizer for Maya even better. though at the moment it’s quite unfinished. My intent is to have a repo that grows and changes and all people need do is occasionally sync, once the repo dirs are initially cloned and set up in their local Maya installations.
What I’d like to work out today is: what’s the easiest way for the most people to use the scripts in this repo easily – what’s the best way to set it up in Maya installation-wise so that it just… works?
METHOD ONE
I set this up and people complained about it.
I made a file called “VTSetup.py” and told people to put it in the directory with their existing userSetup.py, then within the userSetup.py have these two lines:
from VTSetup import *
VTSetup()
The VTSetup() command adds the (default location GitHub repo) ‘Python’ directory to the session’s sys.path and the (correctly reformatted) path to the end of mels’ MAYA_SCRIPT_PATH
User complaints (some contradict others, yes):
[ul]
[li]It’s too complicated, I am afraid of text editors and copying files around (and my lead TD doesn’t let me touch the userSetup file, which gets overwritten by P4 every time I launch Maya anyway)[/li][li]I don’t want to alter my userSetup.py, I like it pristine as God & I made it[/li][li]I use userSetup.mel so userSetup.py never executes, leave me alone[/li][li]I hate GIT so I downloaded the ZIP and expanded it in some path whose name I just made up randomly[/li][/ul]
METHOD TWO
Added “open_me_to_install.ma” which has a load-time script node that executes a similar script. The new script looks for instances of userSetup.mel, adds a little block of “putenv …” and “python("import sys;sys.path.append(…)")” commands to the end (if those lines are not already present). This has a few advantages:
[ul]
[li]it knows where the repo is on disk, based on the path of “open_me_to_install.ma”[/li][li]No user text editing, just open the file once and then close Maya.[/li][/ul]
It still makes me anxious (no users have complained yet, but give them time!):
[ul]
[li]If there’s no userSetup.mel it makes one, which would switch-off their userSetup.py if they had one of those (yeah, I may add code to append to the end of userSetup.py if found alone…)[/li][li]If you have multiple versions of Maya you need to open it for each of them (it bases the filename on the version in current Maya path name)[/li][li]I have to restart Maya after opening this file one time only for each version of Maya? Can’t you do it just once for all versions?[/li][/ul]
Now I know: there is no single way that will make everyone happy. Especially Maya users who seem to love complaining that devs did not read their minds, and then again tomorow because the dev yesterday didn’t predictively read them changing their mind today. But: I’m wondering if people have seen instances where adding (GitHub-based) directories of mel & python scripts has been done especially well. Anyone?