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:

Python: importing modules into plugins


New in the Softimage 2011 Subscription Advantage Pack

The siutils Python module makes it easier to import modules into your self-installing plugins. Just put your modules in the same location as your plugin file , and you can use the __sipath__ variable to specify the module location.

__sipath__ is always defined in the plugin namespace, so no matter where you put a plugin, you can simply use __sipath__ to specify the location.

Here’s a simple example that shows how to import a module into your plugin.

  • Line 04: Import the siutils module
  • Line 39: Use add_to_syspath() to add __sipath__ to the Python sys path.
    If the module was located in a subfolder of the plugin location, you could use siutils.add_subfolder_to_syspath( __sipath__, ‘mysubfolder’ )

  • Line 40: Import the module
import win32com.client
from win32com.client import constants

import siutils

null = None
false = 0
true = 1

def XSILoadPlugin( in_reg ):
	in_reg.Author = "blairs"
	in_reg.Name = "TestPlugin"
	in_reg.Major = 1
	in_reg.Minor = 0

	in_reg.RegisterCommand("Test","Test")
	#RegistrationInsertionPoint - do not remove this line

	return true

def XSIUnloadPlugin( in_reg ):
	strPluginName = in_reg.Name
	Application.LogMessage(str(strPluginName) + str(" has been unloaded."),constants.siVerbose)
	return true

def Test_Init( in_ctxt ):
	oCmd = in_ctxt.Source
	oCmd.Description = ""
	oCmd.ReturnValue = true

	return true

def Test_Execute(  ):

	Application.LogMessage("Test_Execute called",constants.siVerbose)

#	print __sipath__ 

	siutils.add_to_syspath( __sipath__ )
	import TestModule
	TestModule.test( "hello world" )

	return true

Connect to workgroups with a .data file


New in the Softimage 2011 Subscription Advantage Pack
You can now use a workgroup_path.data file to specify your workgroups.

At startup, Softimage scans the Factory (installation) and User folders for a workgroup_path.data file, and connects to all the workgroups listed in that file.

The workgroup_path.data file is a plain text file that can contain multiple directory paths. Each path must be added on a separate line and each line must end with a newline character. For example:

C:\Users\blairs\Documents\Support\Workgroups\studioNEST
\\server\Softimage\workgroups\Shaders

Error 1304 Error writing to file when creating a network deployment


If you get an error that looks like this when you create a network deployment:

Error 1304.Error writing to file \\MTL-server01\PSSMedia\Softimage\Users\BLAIRS\Deployments\SAP
\AdminImage\Softimage\x64\program files\Autodesk\Softimage 2011 Subscription Advantage Pack\Addons\ICEFlowBuilder\Data\Compounds\Particles\Presets\Lagoa Setup Basic Emission from Null.1.0.xsicompound. Verify that you have access to that directory.

followed by this error:

Error 2350.FDI server error

it’s because the path name is too long. The maximum length for a Windows path name is 260 characters.

If the path name of your deployment location is up around 60 characters, you’re going to exceed the 260 character limit. Too bad the deployment tool doesn’t check when you enter the Administrative Image location and deployment name:

Checking if a polygon is hidden


Here’s some Jscript that shows how to find clusters hidden by ToggleVisibility.

Note that clusters can also be hidden by adding a visibility property (Property > Polygon Cluster Visibility).
Finding those would be a separate, but more straightforward, task

// Get a polygon cluster
//var oCluster = Dictionary.GetObject( "cube.polymsh.cls.Polygon" );
var oCluster = Selection(0);

// Get array of polygon indices
var a = oCluster.Elements.Array.toArray();

// Get [basically undocumented] invisible polygon cluster
var oGeometry = Dictionary.GetObject( "cube" ).ActivePrimitive.Geometry;
var l_polyVisCluster = oGeometry.Clusters( siInvisiblePolygonsClusterName );


// Check if a polygon in our cluster is hidden
// It is possible for a poly to be in multiple clusters
// Otherwise we could assume that if a[0] is hidden, 
// then the whole cluster is hidden

for ( var i = 0; i < a.length; i++ )
{

                if ( l_polyVisCluster.Elements.FindIndex( a[i] ) == -1 )
                {
                                LogMessage( "poly[" + a[i] + "] : Visible" );
                }
                else
                {
                                LogMessage( "poly[" + a[i] + "] : Hidden" );
                }
}

MatchMover or Composite looks for Maya licenses


You can tell MatchMover and Composite what license to use by setting these environment variables:

  • ADSK_MATCHMOVER_LICENSE
  • ADSK_COMPOSITE_LICENSE

For example, to tell MatchMover to use a Softimage license instead of a Maya license, you can set the ADSK_MATCHMOVER_LICENSE environment variable to “Softimage”.

set ADSK_MATCHMOVER_LICENSE=Softimage

The possible values are Softimage, 3dsMax, and Maya. The values are case-insensitive.

If you don’t know how to set environment variables in Windows, see this video (note there’s no audio).