Registering Event Handlers

 
 
 

You register event handlers in XSIL:oadPlugin, which is called when Softimage loads a self-installing plug-in. XSIL:oadPlugin gets a PluginRegistrar or PluginRegistrar object from Softimage, and you use the PluginRegistrar.RegisterEvent or PluginRegistrar::RegisterEvent method to register handlers for different events.

C++ Example: Registering an event handler

XSIPLUGINCALLBACK CStatus XSILoadPlugin( PluginRegistrar& in_reg )
{
	in_reg.PutAuthor(L"Event Wizard User");
	in_reg.PutName(L"MyCppEventHandlers");
	in_reg.PutVersion(1,0);
	in_reg.RegisterEvent( L"MyOnSelectionChange", siOnSelectionChange );
	return CStatus::OK;
}
  • The first parameter to PluginRegistrar.RegisterEvent or PluginRegistrar::RegisterEvent is the name of the event handler. This name is used to name the callback function that implements an event handler. For example, the OnEvent callback for an event handler named "MyOnSelectionChange" is "MyOnSelectionChange_OnEvent".

    This name is also the name of the event in the EventInfoCollection or CRefArray of EventInfo returned by XSIApplication.EventInfos or Application::GetEventInfos.

    The first character in an event handler name should be a letter. Subsequent characters can be letters, numbers, underscore (_) characters, or spaces. If an event handler name contains spaces (for example, "My Event"), then you must remove the spaces in the callback function name (for example, "MyEvent_OnEvent").

  • The second argument is the siEventID of the event that triggers the OnEvent callback.

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