Configuration
Multiple Layers of User Configuration are supported in MG-Picker
Manual configuration is set in the user preference dialog by going to
Windows/Preferences..menu in designer mode. (Ctrl+K)The server configuration is set in an external text configuration file.
Environment variables.
Different configuration layers
Priorities of different configuration layers ( 1 as the highest, 4 as the lowest):
Server settings with a
!prefix on the configuration key name.User manual configuration in UI.
Server settings without a
!prefix on the configuration key name.Environment variables.
Tips on Manual User Settings
Besides manually setting these preferences on UI, you can also use Python/MEL API to query and set all of them. These config API is available as long as the plug-in is loaded, it does not require the UI to be loaded.
# Query all config keys and values in string forms:
cmds.MGPicker(q=True, config=True)
# To query one single config:
cmds.MGPicker(q=True, config=("recentPickerFiles", ""))
# To set one single config:
cmds.MGPicker(e=True, config=(configKey, configStringKey))
Tips on server config
The server config file, by default, is a text file called
ServerConfig.txtin theMGPicker_ServerConfigfolder that is shipped with the MG-Picker program files.The server config file is of the form
key = value, to add comment out a line, you start the line with#.By default, the user config will have higher priority than the ones in server config, but if you use
!key = value, then it will override the user config.You can use the API to query all the configs to know all the possible keys you can set in the server config:
cmds.MGPicker(q=True, config=True)
You can use the environment variable
MGPICKER_SERVER_CONFIG_FILE_PATHto override the default server config file path, the default server config file will be ignored.Environment variables are supported in the value. Use them in form of
$variable,${variable},%variable%or__variable__.There are some predefined constants that are not environment variables, but you can use them in the same way as environment variables in the value.
UserAppDir: The directory for the user application directory used by hostApp, like Maya.UserScriptDir: The directory for the user script directory used by hostApp, like Maya.
Various Environment variables Supported
The environment variables supported by MG-Picker are listed below:
Environment Variable |
Note |
|---|---|
MGPICKER_SERVER_CONFIG_FILE_PATH |
To override the default |
MGPICKER_PROGRAM_FILE_DIR |
The directory to the |
MGPICKER_LOADER_PY_MODULES |
It is all the user Python module paths contains the picker loaders, separated by |
MGPICKER_FLOAT_LIC_CONNECTOR_DIR |
The directory that contains the floating license connector executable. |
MGPICKER_AUTO_CONNECT_FLOAT_LIC |
A |
💡 Note that the env variable
MGPICKER_USER_CONFIG_DIRis no longer supported, as the user configuration folder is alwaysOS_user_data_folder/MGLAND/MG-PickerStudio.