These examples demonstrate how to implement self-installing custom commands using various implementation languages.
Simple Command
This example implements a simple custom command that takes one argument and logs
the argument value to the command history. The example includes JScript,
Python, VBScript, C++ and C# versions of the command. You can run the command from
the Script Editor or add the command to a toolbar.
The C# version included is more elaborated as it takes a selected object as input and logs all its parameters.
Custom commands are one of the main building blocks for more sophisticated plug-in tools. The SimpleCommand example shows the basic code framework for a custom command. When you're ready to start writing your own custom commands, you could use it as a starting point. Or, even better, you can use the Command Wizard to generate a more complete code skeleton.
Simple Undoable Command
This example demonstrates how to implement an undoable custom command using the C++ API. This example creates a NetView view
at 0,100 and the undoable command moves the window to 200,100. The positioning of the window can be undone
and redone through the Undo and Redo built-in Softimage commands. The sample command can be accessed from the
'Undoable Custom Command' menu located in the main menu bar.
Location | |
Files |
simplejscommand.js
simplepycommand.py
simplevbscommand.vbs
simplecommand.cpp
GNUmakefile
simplecommand.vcproj
simplecscommand.cs
simplecscommand.csproj
simpleundoredocommand.cpp
simpleundoredocommand.vcproj
GNUmakefile
|
To install the example
Connect to the Softimage SDK workgroup at %XSISDK_ROOT%\examples\workgroup.
To view the help page for an example
To run the Simple Command example
In the script editor, type the command and click Run:
// [JScript] SimpleJSCommand( "Hello" ); SimpleJSCommand(); SimpleJSCommand( 33 );# [Python] Application.SimplePYCommand( "Python" )' [VBScript] SimpleVBSCommand "How you doing?"// [C++] SimpleCPPCommand( "Goodbye" );// [C#] CreatePrim( "Cone", "MeshSurface" ) SimpleCSCommand( null, True );
To run the Simple Undoable Custom Command example
Follow the instructions below to build the examples.
To build the Simple Command example on Windows
Open a Softimage command prompt, and type devenv to start Visual Studio .NET.
Starting Visual Studio .NET from a Softimage command prompt ensures that environment variables such as XSISDK_ROOT are set (otherwise you'll get build and link errors).
Tip To load the Simple Command project from the command line, type:
devenv cppsrc\simplecommand.vcproj
To build the Simple Command example on Linux
In a shell (tcsh) window, type:
source $XSI_HOME/.xsi_<xsi_version>
Change directories to
cppsrc
To remove all intermediate files before building the example, run this command:
gmake clean
To compile the example, run this command:
gmake
To build the Simple Undoable Command example on Windows
Open a Softimage command prompt, and type devenv to start Visual Studio .NET.
Starting Visual Studio .NET from a Softimage command prompt ensures that environment variables such as XSISDK_ROOT are set (otherwise you'll get build and link errors).
Tip To load the Simple Undoable Command project from the command line, type:
devenv UndoRedo\simpleundoredocommand.vcproj
To build the Simple Undoable Command example on Linux
In a shell (tcsh) window, type:
source $XSI_HOME/.xsi_<xsi_version>
Change directories to
UndoRedo
To remove all intermediate files before building the example, run this command:
gmake clean
To compile the example, run this command:
gmake
Follow these instructions to build the C# plug-in.
Note: You can either use Visual Stusio .NET 2005 or Visual C# 2005 Express Edition to build the example. Visual C# Express can be dowloaded freely at http://msdn.microsoft.com/vstudio/express/visualcsharp/.
To build the example on Windows
Open a Softimage command prompt, and type devenv to start Visual Studio .NET.
Starting Visual Studio .NET or Visual C# Express from a Softimage command prompt ensures that environment variables such as XSI_USERHOME are set (otherwise you'll get build and link errors).
Tip To load the SimpleCommand project from the command line, type:
devenv cssrc\SimpleCSCommand.csproj
This example uses the following keywords:
C++, JScript, Python, VBScript, C++ example, JScript example, Python example, VBScript example, C# example, RegisterCommand, Init, Execute, ArgumentArray, GetArguments, PutUserData, Undo, Redo, CValue::siPtrType, Command, Context, GetSource,