Thursday, March 24, 2011

Source order in Maya

Source order in maya is a bit more complex .... (Edit: and it makes me totally confused!!!)

First up - if you have set system based environment variables to wherever your maya installation resides, -which is normally done by the maya installer when your installation goes as intended- then maya finds the following folder containing MEL scripts in this order:

- program-folder: print(`getenv "MAYA_LOCATION"`+"/scripts/*");

- user script-directory: print( `internalVar -userAppDir`+"scripts");

- maya version specific script-directory: print( `internalVar -userScriptDir`);

although the may-version specific scripts-folder gets sourced last i prefer to put my scripts in the second location, because i don't need to copy any scripts to any new directory when another maya-version comes out- this directory gets sourced by them all!

so there's really no need to specifically source a scripts like that, unless of course you want to RUN the script on maya-startup!

that's something competely different, though!

it is considered good practice however not to run scripts by simply sourcing them. that has to do with the automatic sourcing process described above: every script in those folders get sourced on maya startup- make no mistake about that! so, better do it like this:

eval( "source ""+`internalVar -uad` + "scripts/nicescript.mel"") ;

and if this were a shelfbutton, or if you wanted to run it on startup, you would add the call to the function as well:

nicescript();

in early versions of maya your version of the 'source' command worked like you typed it; nowadays 'source' often fails for reasons that escape me right now, but with 'eval' i never had these problems!

!

Friday, March 18, 2011

Github repositories up and running

This has repositories for the nkPass project and the imageloaders which has the DPX loader for Maya.

happy gitting.