XSICollection.Add

説明

1 つの項目をコレクションに追加します。このメソッドを、XSICollection.AddItems(一度に1 つまたは複数の項目を追加)やXSICollection.SetAsText(全項目を文字列リストに追加)と比較してください。

スクリプト 構文

XSICollection.Add( Item );

パラメータ

パラメータ タイプ 詳細
Item CollectionItemProjectItemまたはStringの種類の 1 つ 追加される新しい項目。一般的なオブジェクト(CollectionItem)、特定のタイプのオブジェクト(ProjectItem)、またはObject Name(文字列表現)を指定できます。

VBScript の例

Dim oColl             ' object pointer for collection
Dim oMember             ' object pointer for members
Dim oNull               ' object pointer for null object
Dim oCollItem   ' object pointer for collection item
Dim sLightName  ' string variable for the camera name 
' Create the stuff we will populate the collection with
Set oNull = ActiveSceneRoot.AddNull     
checkType oNull                 ' = project item
Set oCollItem = CreateObject( "XSI.CollectionItem" )
oCollItem.Value = "Camera"              
checkType oCollItem                     ' = collection item
sLightName = "light*"                   
checkType sLightName                    ' = string expression
' Create the new collection
Set oColl = CreateObject( "XSI.Collection" )
' Add each item
oColl.Add oNull
oColl.Add oCollItem
oColl.Add sLightName
' What do we have now?
LogMessage "----------------"
For Each oMember In oColl
        checkType oMember
Next
'--------------------------------------------------
function checkType( in_object )
        LogMessage in_object & " is a " & TypeName( in_object )
end function
'--------------------------------------------------
' Output of above script:
'INFO : "null is a Null"
'INFO : "Camera is a CollectionItem"
'INFO : "light* is a String"
'INFO : "----------------"
'INFO : "null is a Null"
'INFO : "Camera is a Camera"
'INFO : "light is a Light"

関連項目

XSICollection.GetAsText XSICollection.AddItems XSICollection.Remove