v1.0
selection
Filters a given list of elements according to the specified filtering type and returns the filtered list. When used with PickObject, this allows for validating the picked object against the proper filter, before passing the element to another command.
oReturn = SIFilter( [InputObjs], [Type], [Include], [Mode] ); |
Returns the filtered list as an XSICollection.
Parameter | Type | Description |
---|---|---|
InputObjs | String | List of objects to filter.
Default Value: Current selection |
Type | String | FilterConstant to
use (eg., scene object, operator, primitive, material, etc.). Note: Calling SIFilter with a custom filter name containing spaces will fail. You can overcome this limitation by replacing all space characters with underscores. Default Value: siGenericObjectFilter |
Include | Boolean | True to include objects that match filter, False to exclude
objects that match filter.
Default Value: True |
Mode | siFilterMode | Filter lookup mode. The full search is the most powerful, but
requires more time.
Default Value: siQuickSearch |
' Create 2 objects, then select ALL objects in the scene: CreatePrim "Sphere", "MeshSurface" CreatePrim "Cone", "MeshSurface" SelectAll ' From the selection list collection, get the light and camera only: dim list set list = GetValue ( "SelectionList" ) set LigAndCam = SIFilter( list, siLightFilter & ", " & siCameraFilter ) if TypeName( LigAndCam ) <> "Nothing" then LogMessage LigAndCam.Count & " light & camera(s) found." LogMessage vbTab & LigAndCam end if ' Now get the 3D objects only, from the currently selected objects: set AllObjects = SIFilter( , siObjectFilter ) if TypeName( AllObjects ) <> "Nothing" then set objects = SIFilter( AllObjects, "polygon_mesh", True ) LogMessage objects.Count & " object(s) found." LogMessage vbTab & objects(0) & ", " & objects(1) ' Filter out polygon meshes objects: set non3DObjects = SIFilter( AllObjects, "polygon_mesh", False ) if TypeName( non3DObjects ) <> "Nothing" then LogMessage non3DObjects.Count & " non-3D object(s) found." for each non3DObj in non3DObjects LogMessage vbTab & non3DObj next end if end if ' Running this script should log the following: ' --------------------------------------------- 'INFO : "2 light & camera(s) found." 'INFO : " Camera,light" 'INFO : "2 object(s) found." 'INFO : " sphere, cone" 'INFO : "4 non-3D object(s) found." 'INFO : " Camera_Root" 'INFO : " Camera" 'INFO : " Camera_Interest" 'INFO : " light" |