Registering Plug-in Items

A self-installing plug-in can implement commands, events, filters, menus and properties. A C++ plug-in can also implement custom displays, display passes, display callbacks, and rendering engines.

A plug-in can contain more than one plug-in item. For a example, a plug-in could include a command, a menu that runs the command, a filter that controls when the menu is available, and a custom property that serves as the plug-in user interface.

In XSILoadPlugin, you use the following PluginRegistrar methods to register plug-in items:

PluginRegistrar.RegisterCommand

PluginRegistrar.RegisterConverterEvent

PluginRegistrar.RegisterEvent

PluginRegistrar.RegisterFilter

PluginRegistrar.RegisterMenu

PluginRegistrar.RegisterOperator

PluginRegistrar.RegisterProperty

PluginRegistrar.RegisterTimerEvent

C++ plug-ins can register custom displays, display passes, and display callbacks using these PluginRegistrar member functions:

RegisterCustomDisplay

RegisterDisplayPass

RegisterDisplayCallback

RegisterRenderer

For example, the following XSILoadPlugin registers a command, a menu, property, and an event:

// JScript
function XSILoadPlugin( oPluginRegistrar )
{

   // Register command
   var oPluginItem = oPluginRegistrar.RegisterCommand("MyCommand","MyCommand");

   // Register a custom property
   oPluginRegistrar.RegisterProperty( "MyProperty" );

   // Register an event handler for changes to the selection list
   oPluginRegistrar.RegisterEvent( "MySelectionChangeHandler", siOnSelectionChange );

   return true;
}

By default, Softimage uses the plug-in help as the help for plug-in items. If you want to provide a different help for each plug-in, you can use PluginItem.Help to specify the name of the help file and, optionally, its location.

// JScript
function XSILoadPlugin( oPluginRegistrar )
{
   // ...

   var oPluginItem = oPluginRegistrar.RegisterCommand("MyCommand","MyCommand");

   oPluginItem.Help = XSIUtils.BuildPath( in_reg.OriginPath, "Doc", "MyCommand.html" );
   oPluginItem.Categories = "Example, Command";

   // ...
}


Autodesk Softimage v7.5