Registering Plug-in Items

 
 
 

A self-installing plug-in can implement commands, events, filters, menus, shaders, and properties. A C++ plug-in can also implement custom displays, viewport modes and 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 or PluginRegistrar methods to register plug-in items:

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

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 SIObject.Help or PluginItem::PutHelp 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";
	
	// ...
}

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License