Pages

Sunday 10 April 2016

Maya.env tips

Since I had to fix something with my Maya.env file I thought it would be good to also share some example for Maya users who want to make their own Maya library in a specific place on disk or network.

Below is example of Maya.env file with custom path to MEL scripts, python scripts and plugins.
Note that plugins contain both path to python scripted plugins as well as C++ compiled plugins. Also plugins unlike scripts are stored under Maya version specific folder. Should be done for scripts too, but usually it`s not needed.

TIP: you can also use USER_SCRIPT_PATH in your Maya MEL script sourcing function. If you recursively source every subfolder from here, you have all MEL scripts available after Maya starts. This is done from a userSetup.mel which is special Maya file you can define. And as long as it is found in MAYA_SCRIPT_PATH it will be executed first after Maya starts.

TIP: By defining USER_SCRIPT_PATH you get this relative root folder and if you move your library to different place or computer, you just change this one and your library can be found by Maya again.

More about userSetup.mel here:
https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/Maya/files/PC-Run-MEL-commands-whenever-Maya-starts-up-htm.html

Autodesk documentation about defining Maya.env variables:
https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/files/GUID-DB30AAB7-4639-4C3B-A479-7F26D953E0F2-htm.html

Example Maya.env file content on Windows OS:

USER_SCRIPT_PATH = C:\Users\syntetik\Documents\maya_tools

MAYA_SCRIPT_PATH = %USER_SCRIPT_PATH%\mel\mystuff;%USER_SCRIPT_PATH%\mel\thirdparty;%USER_SCRIPT_PATH%\mel\startup
PYTHONPATH = %USER_SCRIPT_PATH%\python\

USER_PLUGIN_PATH = %USER_SCRIPT_PATH%\plugin\maya2016
MAYA_PLUG_IN_PATH = %USER_PLUGIN_PATH%\mystuff;%USER_PLUGIN_PATH%\my_scripted;%USER_PLUGIN_PATH%\thirdparty_scripted;%USER_PLUGIN_PATH%\thirdparty

No comments: