XSICollection.Remove

説明

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

C#構文

Object XSICollection.Remove( Object in_newVal );

スクリプト構文

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