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 : "----------------" |