Registering a Filter

To make a filter available in Softimage, you register it in XSILoadPlugin, which is called when Softimage loads a self-installing plug-in. XSILoadPlugin gets a PluginRegistrar object from Softimage, and you use the PluginRegistrar.RegisterFilter method to register custom filters.

function XSILoadPlugin( oPluginRegistrar )
   // Give the plug-in a name
   oPluginRegistrar.Name = "MyFilters";

   // Register a filter named "My3DObjectFilter" for 3D objects
   var oPluginItem = oPluginRegistrar.RegisterFilter( "My3DObjectFilter", siFilter3DObject );
   oPluginItem.Categories = "Custom,Filter,3D Objects";

   // Register another filter
   oPluginRegistrar.RegisterFilter( "MyPointFilter", siFilterSubComponentPoint );

Filter Names

The first parameter to RegisterFilter is the filter name. This is the name that appears in the Softimage user interface, and the name you use to reference the filter in scripting or C++ code. You also use this name to name the filter callback functions (for example, the Match callback for a filter named "My3DObjectFilter" is "My3DObjectFilter_Match").

The first character in a filter name should be a letter. Subsequent characters can be letters, numbers, underscore (_) characters, or spaces. If a filter name contains spaces (for example, "My 3D Object Filter"), then you remove the spaces in the callback function names (for example, "My3DObjectFilter_Match" and "MyFilter_Subset").

Note that if a filter name contains spaces, you must replace the spaces with underscores to use the filter with scripting commands or the object model:

var cloList = SIFilter(Application.Selection, "My_3D_Object_Filter", true, true);
var oFilter = Application.Filters.Item( "My_3D_Object_Filter" );

Filter Types

The second parameter specifies the filter type. In the example above, the constant siFilter3DObject specifies that you are registering a 3D object filter. The available filter type constants are:

• siFilter3DObject

• siFilterSubComponentEdge

• siFilterSubComponentPoint

• siFilterSubComponentPolygon

• siFilterProperty

• siFilterObject

Autodesk Softimage 2011