Building Softimage Plug-ins with C#

All C# plug-ins for Softimage define self-installing custom plug-in items available in the Softimage Object Model. These include commands, events, filters, menus, operators and properties. Custom Display and GraphicSequencer plug-in items are not available to C# because they are only implemented in the C++ API.


The sample code in this section is generated automatically by one of the Softimage plug-in wizards and it is highly recommended to use the wizards to set up your plug-ins. See Creating C# Plug-ins for more details.

Plug-in Registration

To get a hook into Softimage, you make sure you include the XSIOM (object model) assembly and then create a class to register the plug-in in Softimage (XSIPlugin in the example below). Each plug-in item is defined within its own class and you use the name of the plug-in item class to register the plug-in item:

using System;
using System.Reflection;
using XSIOM; // Softimage Object model assembly

public class XSIPlugin
	public bool Load( PluginRegistrar in_reg )
		in_reg.Author = "Kilroy";
		in_reg.Name = "MyCSharpPlugin";
		in_reg.Major = 1;
		in_reg.Minor = 0;

		in_reg.RegisterCommand( "MyCSharpCmd", null );
		in_reg.RegisterMenu( siMenuAnchorPoints.siMenuMainTopLevelID, "MyCSharpMenu", false, false );
		in_reg.RegisterProperty( "MyCSharpCustomProp" );
		in_reg.RegisterEvent( "MyCSharpSelectionEvent", siEventID.siOnSelectionChange );
		in_reg.RegisterFilter( "MyCSharpTriangleFilter", siFilterType.siFilterSubComponentPolygon );
		in_reg.RegisterOperator( "SplatterCS" );
		in_reg.RegisterCommand( "DotNETHost", null );
		return true;

	public bool UnLoad( PluginRegistrar in_reg )
		return true;

Note that once the Load method terminates, the class uesd to register the plug-in in Softimage (XSIPlugin in the example above) is destroyed. This is by design since the plug-in is unloaded by Softimage once the registration step is done. For more information about Softimage plug-ins in general, see Self-Installing Plug-ins.

Defining the Plug-in Items

The plug-in item class definition must implement the callbacks as public methods (rather than imported function callbacks as it is in the C++ API).

public class MyCSharpCmd
	public MyCSharpCmd()

	// Command mandatory implementation
	public bool Init( Context in_ctxt )
		// ...

	public bool Execute( Context in_ctxt )
		// ...

	// etc.

For those already familiar with developing plug-ins with the C++ API, this table maps the C# style to the C++ API style:

Plug-in Item to Create


C# Public Methods to Create

C++ Callback Function

Custom Commands

Implement a class (for example, MyCSharpCmd)




Custom Events

Implement a class (for example, MyCSharpSelectionEvent)


Custom Filters

Implement a class (for example, MyCSharpTriangleFilter)


Standard and Contextual Menus

Implement a class (for example, MyCSharpMenu).

Add callbacks by defining methods in the menu class which contain calls to Menu.AddCallbackItem.


Custom Operators

Implement a class (for example, SplatterCS)


Custom Properties

Implement a class (for example, MyCSharpCustomProp).

Handling logic for property pages in C# mirrors how the C++ API handles logic, unlike the scripting languages that use the Softimage Object Model. For more information, see the PPGEventContext documentation.


Since the Custom Display (View) callbacks and the GraphicSequencer callbacks are not implemented in the object model, they are not available for development with the C# language.