## CreatePassFromLayers

### Description

Creates a new pass with partitions based on layers, and makes it the current pass. Rendering a scene in layers can be extremely useful in isolating specific elements of a scene in order to have more flexibility when using special effects.
Note: Although similar in concept, there is a big difference between passes and layers:
LAYERS are used to separate elements of a scene so they can be visually organized or not rendered to optimize interaction. Layers mainly affect the viewport views and the render region.
PASSES separate scene elements for rendering so they can be individually tweaked or edited.
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

    CreatePassFromLayers( [Name], [Value] );

### Parameters

Parameter | Type | Description
--- | --- | ---
Name | String | Name of the new pass
Value | Pass | Returns the new pass

### Examples

#### VBScript Example

    '
    '       This example creates a cone and a sphere, creates a new layer
    '       for each, and then creates a new pass based on the layers.
    '
    ' Create a new scene
    NewScene , false
    ' Create a cone and make a layer with it
    Set oCone = GetPrim( "Cone", "MeshSurface" )
    CreateLayer , "Wizard_Hat", , oHat
    ' Do the same with a sphere
    Set oSphere = GetPrim( "Sphere", "MeshSurface" )
    CreateLayer , "Magic_Ball", , oBall
    ' Create a pass based on these layers
    CreatePassFromLayers "Wizard", oPass
    ' Print partition info
    Application.LogMessage "Info on " & oPass.Name & ":"
    Application.LogMessage "--------------------------------"
    ' Create an XSICollection with the partition info
    set oParts = CreateObject( "XSI.Collection" )
    oParts.SetAsText( oPass & ".Partitions.*" )
    For Each p In oParts
            Application.LogMessage p
    Next
    ' Output of the above script:
    'INFO : "Info on Wizard:"
    'INFO : "--------------------------------"
    'INFO : "Passes.Wizard.Background_Objects_Partition"
    'INFO : "Passes.Wizard.Background_Lights_Partition"
    'INFO : "Passes.Wizard.Layer_Default"
    'INFO : "Passes.Wizard.Layer_Default1"
    'INFO : "Passes.Wizard.Wizard_Hat"
    'INFO : "Passes.Wizard.Magic_Ball"

### See Also

CreatePass RenderPasses CreateLayer SICreatePass SICreatePartition SICreateLayer