// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: Aug 08 2006 // // // // // // setPluginResource(string $pluginName, string $lookUpKey, string $value) // // // // Assign a new value to a plugin string resource. // This is used to provide localized values for plugin string resources. // The string resource must already be registered with the plugin, // either as an MStringResource or via the mel registerPluginString // command. // // 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. // // This command should be called during plugin load for each // string resource that will be used at any time during the plugin // execution to ensure the resources are properly initialized. // Generally these calls are invoked with the UI string registration // procedures that are setup using MFnPlugin::registerUIStrings. // The value specified will replace the current value of the resource. // See also the loadPluginLanguageResources command. // // // string $pluginName Unique Plugin name (as passed to loadPlugin) // string $lookUpKey Unique key for this string resource // string $value String value to be associated with the resource // // // 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. // // // // // 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. // // // setPluginResource("myPlugin", "showBBoxLabel", "Show Bounding Box"); // setPluginResource("myPlugin", "hideBBoxLabel", "Hide Bounding Box"); // // // global proc setPluginResource( string $pluginId, string $stringId, string $str ) { string $fullId = "p_" + $pluginId + "." + $stringId; int $exists = `displayString -exists $fullId`; if ($exists) { // Override the string's value displayString -replace -value $str $fullId; } else { // Issue warning if the string is not properly registered $fmt = (uiRes("m_setPluginResource.kNotRegistered")); string $msg = `format -stringArg $pluginId -stringArg $stringId $fmt`; warning $msg; } }