I have been trying to use the OnEvent callback with siOnBeginCommand to
abort and replace ApplyTopoOp commands in SI2013

Building on the example in the SDK documentation
<http://download.autodesk.com/global/docs/softimage2012/en_us/sdkguide/index.html?url=si_cmds/cb_Event_OnEvent.html,topicNumber=si_cmds_cb_Event_OnEvent_html>
I am successfully intercepting events, but only some of them abort
correctly, returning

> ' INFO : 4373 - This event was aborted:
>
before executing the command anyway.

CreatePrim and ApplyTopoOp, for instance, behave this way. Other commands,
such as selection and navigation commands, abort successfully.

Code when attempting to abort ApplyTopoOp:

> XSIPLUGINCALLBACK CStatus HCoverrideCommand_OnEvent( CRef& in_context ){
>
>     Application app;
>     Context ctxt(in_context);
>     Command currentCommand = ctxt.GetAttribute("Command");
>     CString commandName = currentCommand.GetName();
>
>     if (commandName=="Extrude Comp. Axis")
>     {
>         app.LogMessage("Extrude detected. Attempting to abort.");
>
>         //Abort command.
>         return CStatus::OK;
>
>     }
>
>     //Return false to NOT cancel the intercepted command
>     return CStatus::False;}
>
> Output:

> ' INFO : Extrude detected. Attempting to abort.
> ' INFO : 4373 - This event was aborted:
> ' <name: HCoverrideCommand>
> ' <plug-in:
> C:\Users\Roughy\Autodesk\Softimage_2013\Addons\HairCommands\Application\Plugins\hairCommands.dll>
> '
> ApplyTopoOp "ExtrudeComponentAxis", "grid.poly[27,28,35,36]",
> siUnspecified, siPersistentOperation


 Are you only allowed to abort certain commands, or am I doing something
wrong here?

The docs also state that you can modify the arguments of the command.
I don't quite see how to do so, unless you're expected to abort the command
and call its replacement yourself.

Any help would be greatly appreciated.

Reply via email to