PDA

View Full Version : (MEL) source a script that is not directly under the scripts folder?


Leffler
04-18-2009, 04:40 PM
Hi!

Lets say I want to source a script i´m working on, but to keep the scripts-folder less cluttered I have the script in a subfolder.

So the "searchpath" would be for example /scripts/animationScripts/UI

How do I source the scripts that are under that folder? Maya doesn´t seem to go through the subfolders when doing a source?

Otto

skunk184
04-18-2009, 06:04 PM
you could add :-

MAYA_SCRIPT_PATH
C:/path/destination folder


to your system enviroment variables(control panel > system > advanced > enviroment variables > system variables).



cheers

Craig

theflash
04-18-2009, 08:15 PM
You can add MAYA_SCRIPT_PATH environment variable in the Maya.env file.

or

I did a little different approach for this (it's a little bit more work for Maya, but I think this gives flexibility). I have a code that reads a particular environment variable (that has my own script directory path) and then source all the files from that folder. I add this code to userSetup.mel file so that all of my script files get sourced when maya starts. I have a setup script that generates this userSetup.mel file for me and also allows me to change my script directory anytime from Maya using a dialogbox. And scripts are resourced from that directory.

Leffler
04-19-2009, 04:19 PM
you could add :-

MAYA_SCRIPT_PATH
C:/path/destination folder


to your system enviroment variables(control panel > system > advanced > enviroment variables > system variables).



cheers

Craig

Thanks.

Can I have more than one folder there? When I create a new to old one get overwritten

Otto

skunk184
04-20-2009, 07:36 AM
yep , just seperate with a semi-colon;

MAYA_SCRIPT_PATH
C:/path/destination folder ;C:/path/destination folder

cheers

Craig

Leffler
04-20-2009, 09:34 AM
thanks Craig!

Otto

Robert Bateman
04-20-2009, 11:01 AM
Just so you know - it's actually better to do this in maya.env since you can specify different paths depending on the version of maya you are running. Doing it as an env variable sets this for all versions of maya you have installed.

skunk184
04-20-2009, 11:11 AM
Thanks Robert and no worries Otto.


Craig

CGTalk Moderation
04-20-2009, 11:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.