Object model methods for finding objects


The Softimage 2011 Subscription Advantage Pack includes new methods for finding objects.

These FindObjects methods are more efficient than X3DObject.FindChildren, because the FindObjects methods don’t go through the scene hierarchy (they go directly to an internal database of objects).

Model.FindObjects( siClassID )
Finds all objects under the model that match a specified class ID (for example, all shaders or all ICE Trees). For example:

 # Enumerate all shaders under the scene root.
 from win32com.client import constants as c
 shaders = Application.ActiveSceneRoot.FindObjects( c.siShaderID )
 for s in shaders:
 	LogMessage( s.ProgID )
 # INFO : Softimage.soft_light.1.0

Supported siClassIDs:
siCameraID | siClusterID | siClusterPropertyID | siConstraintID | siCustomOperatorID | siCustomPropertyID | siEnvelopeID | siEnvelopeWeightID | siExpressionID | siGeometryID | siGroupID | siICETreeID | siLightID | siMaterialID | siModelID | siNullID | siNurbsSurfaceMeshID | siNurbsCurveListID | siOperatorID | siPolygonMeshID | siPropertyID | siShaderID | siShapeKeyID | siX3DObjectID

Application.FindObjects( siClassID )
Finds all objects that match a specified class ID. For example:

from win32com.client import constants as c
oICETrees = Application.ActiveSceneRoot.FindObjects( c.siICETreeID )
for x in oICETrees:
 	LogMessage( x.Nodes.Count )

Supported siClassIDs:
siCameraID | siClusterID | siClusterPropertyID | siConstraintID | siCustomOperatorID | siCustomPropertyID | siEnvelopeID | siEnvelopeWeightID | siExpressionID | siGeometryID | siGroupID | siICETreeID | siImageClipID | siLayerID | siLightID | siMaterialID | siModelID | siNullID | siNurbsSurfaceMeshID | siNurbsCurveListID | siOperatorID | siPassID | siPolygonMeshID | siPropertyID | siShaderID | siShapeKeyID | siX3DObjectID

Model.FindObjectsFomCLSID( sCLSID )
Finds all objects that match a specified CLSID. You can determine the CLSID of an object using XSIUtils.DataRepository () or by inspecting Softimage objects with the SDK Explorer.

# Enumerate all visibility properties under the scene root.
 props = Application.ActiveSceneRoot.FindObjectsFromCLSID( "{11EBE301-A20C-11D0-8478-00A024C7919C}" )
 for vis in props:
 	LogMessage( vis.FullName )
 # INFO : Camera_Root.visibility
 # INFO : Views.ViewC.SpotCamera.visibility
 # INFO : Camera.visibility
 # INFO : Views.ViewB.SpotCamera.visibility
 # INFO : Camera_Interest.visibility
 # INFO : Views.ViewD.SpotCamera.visibility
 # INFO : Views.ViewA.SpotCamera.visibility
 # INFO : light.visibility

C++ versions:

One thought on “Object model methods for finding objects

  1. Pingback: New SDK stuff in the Subscription Advantage Pack « eX-SI Support

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s