Object Hierarchy | Related C++ Class: SIObject
v1.0
SIObject exposes properties and methods that are supported by practically every object in the
Softimage Object Model, such as the name of the object, its type and parent.
Some very basic Softimage objects do not support SIObject, for example GridData,
SIVector3 and Image (see the Object Hierarchy
for a complete list. For this reason some caution must be used to avoid assuming that all objects
support SIObject.Name and SIObject.Type.
' ' This example outputs an object's properties ' Option Explicit MAIN() sub main() On Error Resume Next ' Create the scene dim oObj set oObj = ActiveProject.ActiveScene.Root.AddGeometry("Sphere", "NurbsSurface") LogSIObject oObj end sub '------------------------------------------------------------------------------ ' NAME: LogSIObject ' ' INPUT: ' ' DESCRIPTION: logs SIObject properties '------------------------------------------------------------------------------ sub LogSIObject(in_obj) Application.LogMessage "Name: " & in_obj.Name Application.LogMessage "Class: " & typename(in_obj) Application.LogMessage "Type: " & in_obj.Type Application.LogMessage "Fullname: " & in_obj.FullName Application.LogMessage "Parent: " & in_obj.Parent.Name Application.LogMessage "Application : " & in_obj.Application.Name Application.LogMessage "Is Equal To Parent ? " & in_obj.IsEqualTo(in_obj.Parent) Application.LogMessage "Is Equal To Self ? " & in_obj.IsEqualTo(in_obj) end sub |
' These objects all support SIObject Application.LogMessage IsSIObject( ActiveSceneRoot ) Application.LogMessage IsSIObject( Dictionary.GetObject( "Camera" ) ) Application.LogMessage IsSIObject( CreateObject( "XSI.Application" ) ) Application.LogMessage IsSIObject( ActiveSceneRoot.AddNull() ) ' A string cannot be accepted without conversion Application.LogMessage IsSIObject( "Camera" ) ' XSICollection and GridData do not support SIObject Application.LogMessage IsSIObject( CreateObject( "XSI.Collection" ) ) Application.LogMessage IsSIObject( XSIFactory.CreateGridData ) function IsSIObject( in_obj ) ' One way to test if an object supports ' SIObject is to call a method and see if ' there is a scripting error. ' Careful use of "on error resume next" ' prevents the entire script form halting dim strFullName on error resume next strFullName = in_obj.Fullname if ( err <> 0 ) then IsSIObject = false else IsSIObject = true end if ' Turn error checking back on on error goto 0 end function ' The above example logs the following results: 'INFO : True 'INFO : True 'INFO : True 'INFO : True 'INFO : False 'INFO : False 'INFO : False |