Hi Andrew,

Have you tried calling the ExitTool method on the ToolContext that was passed 
to you?

http://download.autodesk.com/global/docs/softimage2014/en_us/sdkguide/index.html?url=si_cpp/classXSI_1_1ToolContext.html,topicNumber=si_cpp_classXSI_1_1ToolContext_htmldccb5d73-183f-47c7-9bd8-bf02334bf002,hash=a05b0c9c75ce2ceb2deec6c4d8f2632d1
--
Brent

From: softimage-boun...@listproc.autodesk.com 
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Andrew Prostrelov
Sent: 02 June 2016 13:57
To: softimage@listproc.autodesk.com
Subject: exit from a CustomTool

Hi.
I suppose this one is a simple question but so far i can't handle it:
how should i exit from CustomTool registered by my XSI plugin ?

I want exit from my tool after shortcut CTRL+Z was released.
// So i register this shortcut ...
    CustomTool_Activate(ToolContext& in_ctxt)
    {
        in_ctxt.RegisterShortcutKey( 0x5A, L"myKey", siCtrlMask /* ctrl */, 
true /*repeatable*/ );
    }

// ... and try to change tools (since in_ctxt.ExitTool() works only in Mouse 
and Menu callbacks) to exit from my tool
    CStatus KeyUp( ToolContext& in_ctxt )
    {
        if((ULONG) in_ctxt.GetShortcutKey() == 0x5A)
        {
            
Application().ExecuteScriptCode(L"Application.ActivateSelectTool()", L"Python" 
);            // mimic exit from tool
        }
        return CStatus::OK;
    }

But this way XSI crashes when tools are changed. And i can't understand why.
On other hand there are no problems if i switch to SelectTool in XSI (not 
inside plugin code).
This tool is a dummy so, no additional pointers in user data etc that can crash 
it.

<<attachment: winmail.dat>>

------
Softimage Mailing List.
To unsubscribe, send a mail to softimage-requ...@listproc.autodesk.com with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to