// C++ code generated by the Command Wizard
// Shows the Init callbacks for a command and a menu
#include <xsi_application.h>
#include <xsi_context.h>
#include <xsi_pluginregistrar.h>
#include <xsi_status.h>
#include <xsi_argument.h>
#include <xsi_command.h>
#include <xsi_menu.h>
using namespace XSI;
SICALLBACK XSILoadPlugin( PluginRegistrar& in_reg )
{
in_reg.PutAuthor(L"sblair");
in_reg.PutName(L"My_CppCommandPlugin");
in_reg.PutEmail(L"");
in_reg.PutURL(L"");
in_reg.PutVersion(1,0);
in_reg.RegisterCommand(L"My_CppCommand",L"My_CppCommand1");
in_reg.RegisterMenu(siMenuTbGetPropertyID,L"My_CppCommand_Menu",false,false);
//RegistrationInsertionPoint - do not remove this line
return CStatus::OK;
}
SICALLBACK XSIUnloadPlugin( const PluginRegistrar& in_reg )
{
CString strPluginName = in_reg.GetName();
Application().LogMessage(strPluginName + L" has been unloaded.");
return CStatus::OK;
}
SICALLBACK My_CppCommand_Init( CRef& in_ctxt )
{
Context ctxt( in_ctxt );
Command oCmd;
oCmd = ctxt.GetSource();
oCmd.PutDescription(L"");
oCmd.EnableReturnValue(true);
ArgumentArray oArgs;
oArgs = oCmd.GetArguments();
oArgs.Add(L"Arg0");
return CStatus::OK;
}
SICALLBACK My_CppCommand_Execute( CRef& in_ctxt )
{
Context ctxt( in_ctxt );
CValueArray args = ctxt.GetAttribute(L"Arguments");
CValue Arg0 = args[0];
Application().LogMessage(L"My_CppCommand_Execute called");
//
// TODO: Put your command implementation here.
//
// Return a value by setting this attribute:
ctxt.PutAttribute( L"ReturnValue", true );
// Return CStatus::Fail if you want to raise a script error
return CStatus::OK;
}
SICALLBACK My_CppCommand_Menu_Init( CRef& in_ctxt )
{
Context ctxt( in_ctxt );
Menu oMenu;
oMenu = ctxt.GetSource();
MenuItem oNewItem;
oMenu.AddCommandItem(L"My_CppCommand",L"My_CppCommand",oNewItem);
return CStatus::OK;
} |