CreatePartition

Description

Creates a new object or light partition and adds the specified objects.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

CreatePartition( [Target], [Name], [InputObjs], [Value] );

Parameters

Parameter Type Description
Target String Pass to assign to the partition

Default Value: Current pass

Name String Name of the new partition

Default Value: "Partition"

InputObjs String List of objects to add to the partition

Default Value: Selected objects

Value XSICollection containing a Group object Returns the new partition

Examples

VBScript Example

'

'	This example demonstrates how to create a partition with

'	an object in it. It also shows how you can access partition 

'	information from a particular pass.

'

' Create a new scene 

NewScene , false

' Create a cone to add to one of the partitions

Set oCone = GetPrim( "Cone", "MeshSurface" )

' Create a standard (default) pass 

CreatePass , "PassMeBy", oPass

' Print partition info for default pass

getPartInfo oPass

' Now add an light partition to the pass with a light in it

CreatePartition oPass, "Sweet_Sorrow", "Light", oLightPart

' Print new partition info 

getPartInfo oPass

function getPartInfo( in_pass )

	Application.LogMessage "Partitions for " & in_pass & ":"

	Application.LogMessage "--------------------------------"

	' Create an XSICollection with the partition info

	set oParts = CreateObject( "XSI.Collection" )

	oParts.SetAsText in_pass & ".Partitions.*" 

	For Each p In oParts

		Application.LogMessage p

	Next

end function

' Output of the above script:

'INFO : "Partitions for Passes.PassMeBy:"

'INFO : "--------------------------------"

'INFO : "Passes.PassMeBy.Background_Objects_Partition"

'INFO : "Passes.PassMeBy.Background_Lights_Partition"

'

'INFO : "Partitions for Passes.PassMeBy:"

'INFO : "--------------------------------"

'INFO : "Passes.PassMeBy.Background_Objects_Partition"

'INFO : "Passes.PassMeBy.Background_Lights_Partition"

'INFO : "Passes.PassMeBy.Sweet_Sorrow"

See Also

RenderPasses CreateLayer CreatePass GetCurrentPass SetCurrentPass DeleteCurrentPass SICreatePartition SICreateLayer CreateEmptyPartition