Thursday, October 25, 2007

Preferences - yours and mine !

Do you have preferences ? I do ! Everyone does !! And no one's preferences are the same ! How many have you ? How do you store and handle your preferences ?

na na na....<<>> I'm not talking about human preferences here, i'm talking about MAYA preferences !

Been working on some maya preferences for some time now. During this exercise, i've been looking around for information dealing with maya and its preferences. I share them now.

1) getenv - [command]

`getenv "MAYA_LOCATION"`;
string $user=`getenv USERNAME`;
// Result:ashish//
to know the maya installation directory. I used it to find out where and which is my maya.exe i'm using currently !

2) about - [command]
`about -win64`;
to find out if your OS is 64 bit or not. This might be handy if your studio has a mixture of 32 bit and 64 bit OS

3) optionVars - most of the maya's tool settings, UI settings, user settings are handled using these.

Check out "C:\Program Files\A*****\Maya**\scripts\startup\syncPreferencesOptVars.mel"

4) Batch files - i use them to do alot of work for me. Yes, as you guessed i'm dealing with windows machines here. Batch files can be used to copy things around for you. Ex: Copy your centrally stored Maya.env files to each artist's preferences folder on startup.

5) sytem - [comand]

If you are firing a batch script through maya (using system command) and you DON'T want maya to wait for that batch to finish its work, you can use:
system ("shell s:/batches/startMaya.bat");
and to close that batch file's dos prompt automatically, don't forget to add the "exit" line. This way your maya can 'fire and forget' a batch file, without getting effected by it.

6) scriptjobs - Ever wanted to do your own tricks just before maya quits ?? Like putting your files on server or take a backup of your files or tell your pal you've completed your work ? you can use the scriptjob to help you with just that.
proc backupprefs()
{
// put your code here
}
scriptJob -protected -event "quitApplication" backupPrefs;
7) internalVar - [command]

Getting information about maya - you might want to find out where maya stores its things!!!
string $currMayaPrefLocation=`internalVar -userPrefDir`; 
// Result : C:/Documents and Settings/User/My Documents/maya/8.0/prefs/
8) Reset preferences - Ever wanted to reset few options to maya's default, still having the other user prefs as they are ?

Make a mel file with your required lines and source them at startup through userSetup.mel

EX:
optionVar  
-sv "workingUnitTime" "pal"
-sv "workingUnitTimeDefault" "pal"
-fv "playbackMax" 200
-fv "playbackMaxDefault" 200
-fv "playbackMaxRange" 400
-fv "playbackMaxRangeDefault" 400;
This will enable your maya to have PAL as the Time - working units and set your default frame ranges to 1-200. Everytime you have to do dynamics and for the first 2 mins you spend adjusting your time line ? Its not frustrating anymore ! :)

1 comment:

Anonymous said...

getenv USERNAME.?????

I saw the maya's Environment Variables help section. But they didnt mention about USERNAME.

I wounder how you got that info. What are the other env variables available (those things that they didnt mention)?