script (MEL) |
Only available in MEL |
registerPluginResource |
In categories: System, Localization |
Go to: Synopsis. Return value. Related. MEL examples.
registerPluginResource(string $pluginName, string $lookUpKey, string $defaultValue)
Register a string resource for use by a plugin and assign its
default value. Once registered, the resource can be retrieved using
getPluginResource.
Lookup keys must be unique. Both the plugin name and the
lookup key are used to uniquely identify the resource.
The plugin name is the same string that is passed to the
loadPlugin command.
If localized resource strings are provided, they override the
intial registered value using the setPluginResource command.
Note that the resource must be registered first
before it can be overridden with other values.
Plugin resources are retrieved using the getPluginResource command.
The plugin resource must be initially registered. This is done
in mel using the registerPluginResource command, or in a plugin's
code using MStringResource::registerString. After it is registered
localized values can be set onto the resource using setPluginResource.
This command should be called during plugin load for each
string resource used in the plugin's script files.
Generally these calls are made in the UI string registration
procedures (see MFnPlugin::registerUIStrings).
Plugin resources used in C++ code are usually registered in the plugin
code (see MStringResource::registerString).
None
getPluginResource, loadPluginLanguageResources, setPluginResource
Arguments
Variable Name |
Variable Type |
Description |
$pluginName | string | Unique Plugin name (as passed to loadPlugin)
|
$lookUpKey | string | Unique key for this string resource
|
$defaultValue | string | Default string value to be associated with the resource
|
// Assign resource values that will be used to initialize
// menu item labels for the plugin.
// The plugin name is "myPlugin" and each resource has a unique
// key.
// The default values given for the resource will be used unless
// they are subsequently overridden using setPluginResource.
//
registerPluginResource("myPlugin", "showBBoxLabel", "Show Bounding Box");
registerPluginResource("myPlugin", "hideBBoxLabel", "Hide Bounding Box");