[QUOTE=bryceclark;10101]The most recent requires making a fairly basic, comparatively, change to the preference settings in the scene.
I need to change Preferences -> Settings -> Working Units ->Time from film(24 FPS) to NTSC Field(60 FPS)[/QUOTE]
if ( `currentUnit -q -time` != "ntscf" )
currentUnit -time ntscf;
However, this doesn’t then call the automatic update to the time slider that occurs when you change the setting through the menu.
the default behavior of currentUnit -updateAnimation is “true” so the example given above is fine “as is”.
If you didn’t want the keys adjusted in the timeslider…
if ( `currentUnit -q -time` != "ntscf" )
currentUnit -time ntscf -updateAnimation 0;
It also appears that the menu makes calls to functions for these changes that aren’t in the command list, so I’m guessing they are hardcoded in C++:
prefWndUnitsChanged “time”;
setMinMaxPlayback …
These are mel procedures in Maya’s scripts folder.
Even with the move to python solutions,
Maya is still built upon a mel architecture.
All these scripts are great reference sources:
the procedure…
prefWndUnitsChanged “time”;
assigns the optionVar value preference chosen in the drop down menu using the currentUnit command just
like in the above example.
The command is located within maya’s creatPrefsWndUI.mel file.
creatPrefsWndUI.mel is a collection of procedures that build the preferences window’s UI.
Use your text editor’s “find in file” function to find these mel scripts in your Maya/scripts directory.
( for instance: search setMinMaxPlayback to find the script and mel commands used to clean up the maya interface after the unit landscape has changed )
To make things worse, even if I change the optionVars it doesn’t update the menu selection. So if the user has their save prefs on exit flag on, it overwrites anyway.
If you use the currentUnit command the preference will be saved to the preference file. That will be reflected the “next” time the preference window is open.
I assume you are referring to an open preference window not updating with the new unit setting?
In which case…
is it reasonable to just check for an open window?
{
global string $gPreferenceWindow;
if ( `currentUnit -q -time` != "ntscf" )
currentUnit -time ntscf -updateAnimation 1;
if ( `window -exists $gPreferenceWindow` )
savePrefs;
deleteUI $gPreferenceWindow;
}
And in this way, have your script save the preference?