Fired the first time a command is invoked after the plug-in is loaded. Specifies the return value and arguments of the command.
Unlike other commands in Softimage (both custom and native), self-installing custom commands are added to the Softimage command map when Softimage loads and removed when Softimage terminates (or when explicitly uninstalled). For this reason, self-installing commands must be defined inside the Init callback.
| 
public class <command_name>
{
        public bool Init( Context in_context )
        {
                ...
        }
}
 | 
| 
CStatus <command_name>_Init( CRef& in_context ) 
{ 
        ... 
}
 | 
| 
function <command_name>_Init( in_context ) 
{ 
        ... 
}
 | 
| 
def <command_name>_Init( in_context ):
        ...
 | 
| 
Function <command_name>_Init( in_context )
        ...
End Function
 | 
| 
sub <command_name>_Init 
{ 
        my $in_context = shift; 
}
 | 
<command_name> is the name specified in the call to PluginRegistrar.RegisterCommand, with any spaces converted to underscores.
| Parameter | Language | Type | Description | 
|---|---|---|---|
| in_context | Scripting and C# | Context | Context.Source returns the Command. | 
| C++ | CRef& | A reference to the Context object. Context::GetSource returns the Command. | 
| 
// JScript code generated by the Command Wizard
function XSILoadPlugin( in_reg )
{
        in_reg.Author = "sblair";
        in_reg.Name = "My_JsCommandPlugin";
        in_reg.Email = "";
        in_reg.URL = "";
        in_reg.Major = 1;
        in_reg.Minor = 0;
        in_reg.RegisterCommand("My_JsCommand","My_JsCommand");
        //RegistrationInsertionPoint - do not remove this line
        return true;
}
function My_JsCommand_Init( ctxt )
{
        var oCmd;
        oCmd = ctxt.Source;
        oCmd.Description = "";
        oCmd.ReturnValue = true;
        var oArgs;
        oArgs = oCmd.Arguments;
        oArgs.AddWithHandler("Arg0","AnimatableParameters");
        oArgs.AddWithHandler("Arg1","Collection");
        oArgs.AddWithHandler("Arg2","SingleObj");
        oArgs.Add("Arg5",siArgumentInput);
        return true;
}
function My_JsCommand_Execute( Arg0,Arg1,Arg2,Arg5 )
{
        Application.LogMessage("My_JsCommand_Execute called");
        // 
        // TODO: Put your command implementation here.
        // 
        return true;
}
 | 
| 
// C++ code generated by the Command Wizard
#include <xsi_application.h>
#include <xsi_context.h>
#include <xsi_pluginregistrar.h>
#include <xsi_status.h>
#include <xsi_argument.h>
#include <xsi_command.h>
using namespace XSI; 
SICALLBACK XSILoadPlugin( PluginRegistrar& in_reg )
{
        in_reg.PutAuthor(L"sblair");
        in_reg.PutName(L"CmdCppExamplePlugin");
        in_reg.PutEmail(L"");
        in_reg.PutURL(L"");
        in_reg.PutVersion(1,0);
        in_reg.RegisterCommand(L"CmdCppExample",L"CmdCppExample");
        //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 CmdCppExample_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.AddWithHandler(L"Arg0",L"AnimatableParameters");
        oArgs.AddWithHandler(L"Arg1",L"Collection");
        oArgs.AddWithHandler(L"Arg2",L"SingleObj");
        oArgs.AddWithHandler(L"Arg3",L"Frame");
        oArgs.AddWithHandler(L"Arg4",L"MarkedParameters");
        oArgs.Add(L"Arg5");
        return CStatus::OK;
}
SICALLBACK CmdCppExample_Execute( CRef& in_ctxt )
{
        Context ctxt( in_ctxt );
        CValueArray args = ctxt.GetAttribute(L"Arguments");
        CValue Arg0 = args[0];
        CValue Arg1 = args[1];
        CValue Arg2 = args[2];
        CValue Arg3 = args[3];
        CValue Arg4 = args[4];
        CValue Arg5 = args[5];
        Application().LogMessage(L"CmdCppExample_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;
}
 |