Related Scripting Object: Application
The Application object represents the running instance of the Softimage application and it is the top most entity of the C++ API object hierarchy. Application contains properties that return other Softimage objects such as the active scene root. More...
#include <xsi_application.h>
Inheritance diagram for Application:

Public Member Functions |
|
| Application () | |
| ~Application () | |
| Application (const CRef &in_ref) | |
| Application (const Application &in_obj) | |
| bool | IsA (siClassID in_ClassID) const |
| siClassID | GetClassID () const |
| Application & | operator= (const Application &in_obj) |
| Application & | operator= (const CRef &in_ref) |
| Selection | GetSelection () const |
| CRefArray | GetFCurveSelection () const |
| Dictionary | GetDictionary () const |
| Project | GetActiveProject () const |
| CStatus | PutActiveProject (const CString &in_Project) const |
| Model | GetActiveSceneRoot () const |
| CString | GetInstallationPath (siInstallationPath in_pathType) const |
| CString | GetVersion () const |
| CString | GetLicense () const |
| CStatus | InstallAddon (const CString &in_strFileName, siInstallationPath in_eInstallDir, bool in_bNoUI=false) |
| CStatus | UnInstallAddon (const CString &in_strFileName) |
| Command | CreateCommand (const CString &in_CommandName, siCommandCategory in_category=siNoCategory) |
| CStatus | AddCommand (const CRef &in_Cmd) |
| CStatus | RemoveCommand (const CString &name) |
| CommandArray | GetCommands () const |
| Command | GetCommandByScriptingName (const CString &scriptingName) const |
| CStatus | ExecuteCommand (const CString &in_name, CValueArray &in_args, CValue &io_val) const |
| CStatus | ExecuteCommand (const CString &in_name, const CValueArray &in_args, CValue &io_val) const |
| CScriptErrorDescriptor | ExecuteScript (const CString &in_ScriptFilename, const CString &in_ScriptLanguage, const CString &in_ScriptProcedure, CValueArray &in_args, CValue &out_returnval) |
| CScriptErrorDescriptor | ExecuteScriptCode (const CString &in_ScriptCode, const CString &in_ScriptLanguage) |
| CScriptErrorDescriptor | ExecuteScriptProcedure (const CString &in_ScriptCode, const CString &in_ScriptLanguage, const CString &in_ScriptProcedure, CValueArray &in_args, CValue &out_returnval) |
| CRefArray | GetEventInfos () const |
| CStatus | LogMessage (const CString &in_Message, siSeverityType in_Sev=siInfoMsg) const |
| CStatus | CreateProject (const CString &in_ProjectPath, Project &out_rProject) const |
| Preferences | GetPreferences () const |
| Desktop | GetDesktop () const |
| Factory | GetFactory () const |
| CString | GetActiveToolName () const |
| UIToolkit | GetUIToolkit () const |
| CRefArray | GetFilters () const |
| CRefArray | GetPlugins () const |
| bool | IsInteractive () const |
| Plugin | LoadPlugin (const CString &in_pluginPath) |
| CStatus | UnloadPlugin (const CString &in_pluginPath, bool in_bRemove) |
| CStatus | UpdatePlugins () |
| CStatus | AddWorkgroup (const CString &in_workgroupPath) |
| CStatus | RemoveWorkgroup (const CString &in_workgroupPath) |
| CStringArray | GetWorkgroups () |
| CStatus | RescanWorkgroups () |
| CStatus | ActivateWorkgroup (const CString &in_workgroupPath, bool in_bActivate) |
| CRefArray | GetRenderers () |
| ProjectItem | GetObjectFromID (ULONG in_nID) const |
| ShaderDef | GetShaderDef (const CString &in_progID) |
| CRefArray | GetShaderDefinitions () |
| CStatus | RegisterShaderFamily (const CString &in_strName, const CString &in_strDisplayName, const CString &in_strDescription, unsigned char in_nodeRed, unsigned char in_nodeGreen, unsigned char in_nodeBlue, bool in_bShaderball) |
| CStatus | RegisterShaderCustomParameterType (const CString &in_strName, const CString &in_strDisplayName, const CString &in_strDescription, unsigned char in_portRed, unsigned char in_portGreen, unsigned char in_portBlue, const CStringArray &in_typeFilter, const CStringArray &in_familyFilter) |
using namespace XSI; Application app; Model root = app.GetActiveSceneRoot(); CameraRig myCamRig; root.AddCameraRig( L"Camera", L"", myCamRig ); Camera myCam(myCamRig.GetCamera()); X3DObject myCamInterest(myCam.GetInterest()); CString strCamName( myCam.GetName() ); app.LogMessage( L"Camera interest" ); app.LogMessage( strCamName + L".interest.name: " + myCam.GetInterest().GetName() ); app.LogMessage( strCamName + L"'s near parameter: " + myCam.GetParameterValue(CString(L"near")).GetAsText() ); app.LogMessage( strCamName + L"'s far parameter: " + myCam.GetParameterValue(CString(L"far")).GetAsText() ); app.LogMessage( strCamName + L"'s orthoheight parameter: " + myCam.GetParameterValue(CString(L"orthoheight")).GetAsText() ); app.LogMessage( strCamName + L"'s fov parameter: " + myCam.GetParameterValue(CString(L"fov")).GetAsText() );
| Application | ( | ) |
Default constructor.
| ~Application | ( | ) | [inline] |
Default destructor.
| Application | ( | const CRef & | in_ref | ) |
Constructor. It is not normally necessary to use this version of the constructor, because the default constructor also produces an initialized Application object.
| in_ref | constant reference object. |
| Application | ( | const Application & | in_obj | ) |
Copy constructor.
| in_obj | constant class object. |
| bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
| in_ClassID | class type. |
Reimplemented from SIObject.
| siClassID GetClassID | ( | ) | const [virtual] |
Returns the type of the API class.
Reimplemented from SIObject.
| Application& operator= | ( | const Application & | in_obj | ) |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
| in_obj | constant class object. |
| Application& operator= | ( | const CRef & | in_ref | ) |
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
| in_ref | constant class object. |
Reimplemented from SIObject.
| Selection GetSelection | ( | ) | const |
Returns the Selection object holding the selected objects represented as CRef objects.
| CRefArray GetFCurveSelection | ( | ) | const |
Returns a list of FCurve objects with selected keys represented as CRef objects.
| Dictionary GetDictionary | ( | ) | const |
Not-implemented.
| Project GetActiveProject | ( | ) | const |
Returns the active Project.
Sets the active Project.
| in_Project | The path of the project to set. |
CStatus::Fail Failure.
| Model GetActiveSceneRoot | ( | ) | const |
Returns the root model of the active scene of the active project.
| CString GetInstallationPath | ( | siInstallationPath | in_pathType | ) | const |
Returns an installation path. The returned paths end with a slash character.
| in_pathType | Installation path type (one of the siInstallationPath values). |
| CString GetVersion | ( | ) | const |
Returns the version number of the application (eg, 6.5.170.QFE1 or XSI_Pioneer_Beta1.234-4.0). As of v7.0, the format of the version information is:
{ReleaseNumber}.{BuildNumber}.{UpdateNumber}
...where the chunks represent this information:
{ReleaseNumber} which can contain alphanumeric characters, as well as decimal points (.)Major.Minor designation (eg., 6.5). CodeNameMileStone (eg., XSI_Pioneer_Beta1). {BuildNumber} which can also contain alphanumeric characters, but cannot contain decimal points (eg., 234 or 234-4). {UpdateNumber} which can also contain alphanumeric characters, but cannot contain decimal points (eg., 1 or QFE1).Major.Minor.YYYY.MMDD (eg., 6.02.2007.0605). | CString GetLicense | ( | ) | const |
Returns the type of license used.
Essential
Foundation
Experience
| CStatus InstallAddon | ( | const CString & | in_strFileName, | |
| siInstallationPath | in_eInstallDir, | |||
| bool | in_bNoUI = false |
|||
| ) |
Installs an .xsiaddon file in Softimage. An add-on file is a set of customized items (like layout, toolbar, preset, etc.) that are packaged in a single file.
| in_strFileName | File path of the add-on file to install. | |
| in_eInstallDir | Destination directory, where the add-on is installed. siUserAddonPath and siWorkgroupAddonPath are the recommended values. If siUnknownPath is specified then the add-on will be installed at the default location specified inside the add-on file. Note: In the case of multiple workgroups, this always installs to the first workgroup in the list. |
|
| in_bNoUI | Use this optional parameter to avoid displaying the warning message boxes that are shown during the installation of certain addons. |
CStatus::Fail Installation failure
Uninstalls an .xsiaddon file from Softimage. This deletes all items that were previously installed by the specified add-on file.
| in_strFileName | File path of the add-on file to uninstall. |
CStatus::Fail Installation failure
| Command CreateCommand | ( | const CString & | in_CommandName, | |
| siCommandCategory | in_category = siNoCategory |
|||
| ) |
Creates a new command. The details of the new command are defined by calling the functions on the returned Command object. Once completely defined the command is installed by passing the command object back to Softimage with a call to Application::AddCommand. If a command already exists by that name then this command will fail.
| in_CommandName | The unique name identifying the new command. Note that the command is not created if one with this name already exists. | |
| in_category | Where (on which Softimage standard menu) the command will appear in the user interface. For more information, see the siCommandCategory enum documentation. |
Installs a new Command into the system. This function is called after Application::CreateCommand.
| in_Cmd | Command object containing the definition of the new command |
CStatus::Fail Failure.
Removes a command. This is only called for Custom Commands.
To remove a custom command that is defined as part of a self-installed plug-in remove the script file or dll rather than calling this function. Similarly, this function cannot be used to remove custom commands that are installed as part of an add-on.
| name | Name of the Command, not the scripting name of the command. For example Select Object instead of SelectObj |
CStatus::Fail Failure.
| CommandArray GetCommands | ( | ) | const |
Returns the CommandArray object representing all the installed commands.
Returns a command by its scripting name. To return a command by its name use Application::GetCommands and CommandArray::GetItem instead.
| scriptingName | The scripting name of the command you want to find. |
| CStatus ExecuteCommand | ( | const CString & | in_name, | |
| CValueArray & | in_args, | |||
| CValue & | io_val | |||
| ) | const |
Executes a specified command identified by its scripting name.
| in_name | Command scripting name. | |
| in_args | Array of values containing the arguments to pass to the command. If the command is defined with output arguments, the array is updated with the new argument values returned by the command. | |
| io_val | The value returned by the command. |
CStatus::Fail Failure
using namespace XSI; CValueArray args(3); args[0] = CValue(L"Sphere"); args[1] = CValue(L"MeshSurface"); args[2] = CValue(L"MySphere"); Application app; CValue valSphere; app.ExecuteCommand( L"CreatePrim", args, valSphere ); args.Resize(5); args[0] = L"Annotation"; args[1] = valSphere; args[2] = CValue(); // use default args[3] = L"MyAnnotation"; args[4] = CValue(); // newly created property is returned as output arg app.ExecuteCommand( L"AddProp", args, outArg ); // AddProp return the new property in a CValueArray object stored in the // 5th argument. CValueArray propArray(args[4]); // the property is stored in the first element of the array Property prop(propArray[0]); app.LogMessage( L"Property name: " + prop.GetFullName() ); // create a model an get the newly created model from the ouptut argument args.Resize(4); args[0] = valSphere; args[1] = L"MyModel"; args[2] = CValue(); // optional parent args[3] = CValue(); // newly created model CValue retVal; app.ExecuteCommand( L"SICreateModel", args, retVal ); Model myModel(args[3]); app.LogMessage( L"Model name: " + myModel.GetFullName() );
| CStatus ExecuteCommand | ( | const CString & | in_name, | |
| const CValueArray & | in_args, | |||
| CValue & | io_val | |||
| ) | const |
Executes a command.
| in_name | Command scripting name. | |
| in_args | Array of values containing the arguments to pass to the command. Because this argument is defined as const, the array cannot be updated with the output argument values returned by the command. You should use the other version of ExecuteCommand defined with a CValueArray& argument if you need to access the output argument values. | |
| io_val | The value returned by the command. |
CStatus::Fail failure
| CScriptErrorDescriptor ExecuteScript | ( | const CString & | in_ScriptFilename, | |
| const CString & | in_ScriptLanguage, | |||
| const CString & | in_ScriptProcedure, | |||
| CValueArray & | in_args, | |||
| CValue & | out_returnval | |||
| ) |
Executes a script from a file. This function can detect the script language based on the file extension.
| in_ScriptFilename | A string pointing to the script file to execute. | |
| in_ScriptLanguage | Optional. Scripting language (for example, VBScript, JScript, or Python). If empty, the value in in_ScriptFilename is used to detect the scripting language to use. |
|
| in_ScriptProcedure | Optional. Name of a procedure in the script code that you want to call. | |
| in_args | Optional. An array of arguments to pass to the procedure. Ignored if in_ScriptProcedure is not specified. |
| out_returnval | Optional. Return value from the procedure. Ignored if in_ScriptProcedure is not specified. |
| CScriptErrorDescriptor ExecuteScriptCode | ( | const CString & | in_ScriptCode, | |
| const CString & | in_ScriptLanguage | |||
| ) |
Executes a string of script code. This is a convenient way to execute script code directly from C++. For example, you may want to execute some code that is easy to implement in scripting, but hard to implement in C++. Another possible usage is in the context of a CustomDisplayHost-based script editor.
This function is best suited for small scripts or dynamically generated code. For larger scripts, you may want to consider exposing the script as a custom Command.
| in_ScriptCode | A string of script code to execute. | |
| in_ScriptLanguage | Scripting language (for example, VBScript, JScript, or Python). |
// Basic usage just executes the text directly app.ExecuteScriptCode(L"Logmessage \"Hello from VBScript\"", L"VBScript" ) ; // For more advanced usage it is possible to pass values and get a return value // by calling a procedure inside the script text CScriptErrorDescriptor status ; CValueArray fooArgs(1) ; fooArgs[0] = L"Argument Sent to Script" ; CValue retVal ; status = app.ExecuteScriptProcedure( L"function foo( x ) \n Logmessage x \n foo = 45 \n end function", L"VBScript", L"foo", fooArgs, retVal ) ; // Catch an intentional script error status = app.ExecuteScriptProcedure( L"sub foo( x ) \n run time error! \n foo = 45 \n end sub", L"VBScript", L"foo", fooArgs, retVal ) ; // Show the error app.LogMessage( status.GetDescription() + CString( L" - " ) + CValue( status.GetErrorLineNumber() ).GetAsText() ) ;
| CScriptErrorDescriptor ExecuteScriptProcedure | ( | const CString & | in_ScriptCode, | |
| const CString & | in_ScriptLanguage, | |||
| const CString & | in_ScriptProcedure, | |||
| CValueArray & | in_args, | |||
| CValue & | out_returnval | |||
| ) |
This is an alternative to Application::ExecuteScriptCode which supports execution of a procedure inside script code. By calling a procedure it is possible to pass arguments into the script code and get a return value back.
| in_ScriptCode | A string of script code to execute. | |
| in_ScriptLanguage | Scripting language (for example, "VBScript", "JScript", or "Python"). | |
| in_ScriptProcedure | Optional. Name of a procedure in the script code that you want to call. | |
| in_args | Optional. An array of arguments to pass to the procedure. Ignored if in_ScriptProcedure is not specified. |
| out_returnval | Optional. Return value from the procedure. Ignored if in_ScriptProcedure is not specified. |
| CRefArray GetEventInfos | ( | ) | const |
Returns all events currently defined in Softimage.
| CStatus LogMessage | ( | const CString & | in_Message, | |
| siSeverityType | in_Sev = siInfoMsg |
|||
| ) | const |
Sends a message to the history logging mechanism. The message appears as a Message Box, in the History Window, or on the Status Bar, depending on which Severity parameter you used. For more information on these options, see the siSeverityType enum.
| in_Message | Message Text | |
| in_Sev | Severity of the message, the default value is siInfoMsg. |
CStatus::Fail failure
Creates a new project at a specific location. Existing projects won't be overwritten.
| in_ProjectPath | Full path name of the project. The name of the created project corresponds to the leaf folder of the full path. |
| out_rProject | NOT SUPPORTED, JUST PASS A DUMMY PROJECT. |
CStatus::Fail failure
| Preferences GetPreferences | ( | ) | const |
Returns the Preferences object. This object is used to manage user preferences in Softimage. You can get or set preferences, import or export categories etc.
| Desktop GetDesktop | ( | ) | const |
Returns the Desktop object. This object is used to manage UI objects within Softimage.
| Factory GetFactory | ( | ) | const |
Returns the Factory object. This object is used to manage the creation of standalone objects within Softimage, such as unconnected scripted operators.
| CString GetActiveToolName | ( | ) | const |
Returns the name of the active tool. Only the following tools from the 3D view are supported: RotateTool, ScaleTool and TranslateTool. An empty string is returned if the tool is not recognized.
| UIToolkit GetUIToolkit | ( | ) | const |
Returns the UIToolkit object.
| CRefArray GetFilters | ( | ) | const |
Returns all native and custom filters currently defined in Softimage.
| CRefArray GetPlugins | ( | ) | const |
Returns the list of all self-installable plug-ins currently loaded in Softimage.
| bool IsInteractive | ( | ) | const |
Returns true if the application is in interactive mode or false if it is running in batch mode.
Loads a self-installing plug-in file. Files with the following extensions are considered valid:
.dllso, .vbs, .js, .pys, .py, .pls, .pl
| in_pluginPath | Full path name of the plugin. |
Unloads a self-installing plug-in from Softimage. All registered plug-in items are unregistered when a plug-in is unloaded; Therefore you will not be able to use these items in Softimage until you reload the plug-in.
Unloaded plug-ins can still be retrieved from Application::GetPlugins. They can be distinguished from other plug-ins by using the Plugin::IsLoaded property. An unloaded plug-in always has no registered plug-in items.
| in_pluginPath | Full path name of the plugin. | |
| in_bRemove | Delete the plug-in file on disk if true. |
CStatus::False Already unloaded
CStatus::Fail failure
| CStatus UpdatePlugins | ( | ) |
When invoked Softimage checks each loaded self-installed Plugin file and reloads it if it has changed on disk. It also scans the standard plug-in directories for any new plug-in files. This is identical to clicking the Update All button on the Plug-in Manager.
CStatus::Fail failure
Adds a new workgroup and loads any plug-ins found in the workgroup. This function does nothing if the workgroup is already part of the workgroup list. Softimage will remember the new workgroup as part of the user Preferences.
| in_workgroupPath | Complete path to root directory of a workgroup |
CStatus::Fail failure
Disconnects Softimage from a workgroup. Self-installed plug-ins, SPDLs and other content will be unloaded.
| in_workgroupPath | Complete path to root directory of a workgroup |
CStatus::Fail failure
| CStringArray GetWorkgroups | ( | ) |
Returns the list of workgroups to which Softimage is actively connected.
| CStatus RescanWorkgroups | ( | ) |
Unloads all workgroup content and reloads it. This process can be time-consuming if the workgroup's content is large or the network connection is slow. Doing this will ensure that any duplicate plug-ins are loaded in the correct conflict resolution behavior. In normal circumstances calling Application::AddWorkgroup and Application::RemoveWorkgroup is faster and sufficient.
CStatus::Fail failure
Activates or deactivates a workgroup. Deactivating a workgroup is very similar to calling Application::RemoveWorkgroup except that Softimage will continue to remember the workgroup path. This makes it easier for users to remember which workgroups they have connected to in the past. Softimage will not scan a deactivated workgroup for plug-ins and it will not be included in the list returned by Application::GetWorkgroups.
data_management.workgroup_appl_path preference but they are prefixed with a ! character. | in_workgroupPath | Complete path to root directory of a workgroup | |
| in_bActivate | True to activate the workgroup; false to deactivate it. |
CStatus::Fail failure
| CRefArray GetRenderers | ( | ) |
Returns the list of all rendering engines currently loaded in Softimage.
| ProjectItem GetObjectFromID | ( | ULONG | in_nID | ) | const |
Returns the object whose ID is specified. If there os no object associated to the specified ID, an empty object is returned.
| in_nID | An object ID. |
Returns a shader definition by its ProgID.
| in_progID | A shader ProgID. |
| CRefArray GetShaderDefinitions | ( | ) |
Returns an array of shader definitions loaded in Softimage.
| CStatus RegisterShaderFamily | ( | const CString & | in_strName, | |
| const CString & | in_strDisplayName, | |||
| const CString & | in_strDescription, | |||
| unsigned char | in_nodeRed, | |||
| unsigned char | in_nodeGreen, | |||
| unsigned char | in_nodeBlue, | |||
| bool | in_bShaderball | |||
| ) |
Registers a new shader family. This shader family can subsequently be used to apply to new shaders using the ShaderDef::AddShaderFamily call. The family name should be kept reasonably short. The display name is shown to the user if the family is registered, for any informative messages and tooltips.
The in_nodeRed, in_nodeGreen, and in_nodeBlue parameters control the default display color of the family when shown in the rendertree. If multiple families are used on a given shader, the primary family dictates the color.
The family can also indicate whether the shader node will support a shaderball by default.
| in_strName | The family's intrinsic name. Used when creating a shader. | |
| in_strDisplayName | The family's descriptive name to be used in the UI. | |
| in_strDescription | A short description of the family for information purposes. | |
| in_nodeRed | The red color component for the node display (0-255). |
|
| in_nodeGreen | The green color component for the node display (0-255). |
|
| in_nodeBlue | The blue color component for the node display (0-255). |
|
| in_bShaderball | A flag indicating whether the shader family is supported by shaderballs. |
| CStatus RegisterShaderCustomParameterType | ( | const CString & | in_strName, | |
| const CString & | in_strDisplayName, | |||
| const CString & | in_strDescription, | |||
| unsigned char | in_portRed, | |||
| unsigned char | in_portGreen, | |||
| unsigned char | in_portBlue, | |||
| const CStringArray & | in_typeFilter, | |||
| const CStringArray & | in_familyFilter | |||
| ) |
Registers a new custom parameter type for shaders. This custom parameter type can be used to create new shader parameter definitions that have specific connection rules. A shader parameter of a given custom parameter type can only connect to another of the same type, unless a custom type filter is specified. This type filter is a simple flat list of parameter types, which can be either custom or built-in types (see siShaderParameterDataType for the list of string representations of the built-in types).
In addition, the custom parameter type can also restrict the type of shaders connecting to it, by specifying a list of allowed family types. The family filter is applied to all shaders in the sub-tree defined by the shader (the source) being connected into the shader parameter of the custom parameter type (the target).
| in_strName | The port's intrinsic name. Used when creating a shader port. | |
| in_strDisplayName | The port's descriptive name to be used in the UI. | |
| in_strDescription | A short description of the port for information purposes. | |
| in_nodeRed | The red color component for the port display (0-255). |
|
| in_nodeGreen | The green color component for the port display (0-255). |
|
| in_nodeBlue | The blue color component for the port display (0-255). |
|
| in_typeFilter | List of other port types from which this port type allows connections into. | |
| in_familyFilter | List of shader families that can connect into this port. |