Configuration

Multiple Layers of User Configuration are supported in MG-Picker

  1. Manual configuration is set in the user preference dialog by going to Windows/Preferences.. menu in designer mode. (Ctrl+K)

  2. The server configuration is set in an external text configuration file.

  3. Environment variables.

Different configuration layers

Priorities of different configuration layers ( 1 as the highest, 4 as the lowest):

  1. Server settings with a ! prefix on the configuration key name.

  2. User manual configuration in UI.

  3. Server settings without a ! prefix on the configuration key name.

  4. 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.txt in the MGPicker_ServerConfig folder 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_PATH to 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_ServerConfig/ServerConfig.txt server config file path.

MGPICKER_PROGRAM_FILE_DIR

The directory to the MGPicker_Program folder in mgpicker program.
Optional but handy for the tool distribution.

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 0/1 value for whether on start up we should connect to floating license if it was set up.

💡 Note that the env variable MGPICKER_USER_CONFIG_DIR is no longer supported, as the user configuration folder is always OS_user_data_folder/MGLAND/MG-PickerStudio.