XSICollection.Remove

説明

コレクションから1 つの項目を削除します。このメソッドを、XSICollection.RemoveItems(一度に1 つまたは複数の項目を削除)やXSICollection.RemoveAll(コレクションを完全に空にする)と比較してください。

スクリプト 構文

oReturn = XSICollection.Remove( Item );

戻り値

CollectionItemまたは削除されたProjectItemの種類

パラメータ

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

VBScript の例

Dim oColl             ' object pointer for collection
Dim sSelList    ' string list for selection
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 new collection & populate it
Set oColl = CreateObject( "XSI.Collection" )
Set oNull = ActiveSceneRoot.AddNull     
oColl.SetAsText oNull & ",Light,Camera"
' Test contents & type
checkContents oColl
For Each oMember In oColl
        checkType oMember
Next
' Now remove some stuff
LogMessage "----------------"
checkType oNull                         ' = project item
oColl.Remove oNull
checkContents oColl
Set oCollItem = oColl.Item( "Camera" )
checkType oCollItem                     ' = collection item
oColl.Remove oCollItem
checkContents oColl
sLightName = "light"                    
checkType sLightName                    ' = string expression
oColl.Remove sLightName
checkContents oColl
'--------------------------------------------------
function checkType( in_object )
        LogMessage in_object & " is a " & TypeName( in_object )
end function
'--------------------------------------------------
function checkContents( in_coll )
        If in_coll.Count > 0 Then
                LogMessage "Collection now contains " & in_coll.GetAsText 
                LogMessage "----------------"
        Else
                LogMessage "Collection is empty."
                LogMessage "----------------"
        End If
end function
'--------------------------------------------------
' Output of above script:
'INFO : "Collection now contains null,light,Camera"
'INFO : "----------------"
'INFO : "null is a Null"
'INFO : "light is a Light"
'INFO : "Camera is a Camera"
'INFO : "----------------"
'INFO : "null is a Null"
'INFO : "Collection now contains light,Camera"
'INFO : "----------------"
'INFO : "Camera is a Camera"
'INFO : "Collection now contains light"
'INFO : "----------------"
'INFO : "light is a String"
'INFO : "Collection is empty."
'INFO : "----------------"

関連項目

XSICollection.RemoveAll XSICollection.RemoveItems