Object Hierarchy | 関連する C++クラス:SIObject
v1.0
SIObject は、オブジェクトの名前、タイプ、親など、Softimage
オブジェクトモデルの特定のオブジェクトによってサポートされているプロパティとメソッドを表示します。
基本的な Softimage オブジェクトは、GridData、SIVector3、Imageなどの
SIObject をサポートしていません(全リストについては、「Object
Hierarchy」を参照)。このため、すべてのオブジェクトがSIObject.Nameおよび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
|