## BlendClipsInTextureLayersWithPorts

### Introduced

v4.0

### Description

Adds new texture layers to the ports to blend in the provided clips.
If a source is provided, a clip is automatically created and connected.

### Scripting Syntax

    oReturn = BlendClipsInTextureLayersWithPorts( ClipList, [InputObjs] );

### Return Value

Returns the layers created as an XSICollection.

### Parameters

Parameter | Type | Description
--- | --- | ---
ClipList | String | List of clips to blend in.
InputObjs | String | List of shader connections to blend in new layers Default Value: Current selection

### Examples

#### VBScript Example

    NewScene , false

    ' Create a default cube, add a texture projection and apply a default Phong shader:

    Dim oBox

    Set oBox = ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface" )

    CreateProjection oBox, , siTxtDefaultPlanarXY, , "Texture_Projection"

    ApplyShader , oBox

    ' Apply a second projection, offset it

    CreateProjection oBox, , siTxtDefaultPlanarXY, , "Texture_Projection"

    Translate "Texture_Support1", 3.32038834951456, -4.87670131554974E-17, 0.796452068099767, siRelative, siView, siObj, siXYZ

    Translate "Texture_Support1", -0.529657563043749, -2.59749993985792, 0.259749993985792, siRelative, siView, siObj, siXYZ

    ' First, add an image source.

    Dim oSourceObj, ImageFile

    ImageFile = Application.InstallationPath( siFactoryPath ) & "/Data/XSI_SAMPLES/Pictures/xsilogo.jpg"

    SIAddImageSource ImageFile, "XSIlogo", oSourceObj

    ' Now create an image clip from the image source.

    Dim oClipObj

    set oClipObj = AddImageClip( oSourceObj, "XSIlogo_Clip" )

    ' Blend in the clip

    Dim result, item

    set result = BlendClipsInTextureLayersWithPorts(oClipObj, oBox.material & ".Phong.diffuse")

    for each item in result

    	logmessage "Added layer " & item

    next

    ' Blending in a source automatically creates a clip

    set result = BlendClipsInTextureLayersWithPorts(oSourceObj, oBox.material & ".Phong.ambient")

    for each item in result

    	logmessage "Added layer " & item

    next

    ' Change the blending mode of the newly added layer

    SetValue result(0) & ".mode", 4

    ' Change the texture projection

    Dim shader

    set shader = SIGetShaderOnCnxPoint( result(0) & ".color" )

    SetInstanceDataValue , shader & ".tspace_id", "Texture_Projection1"

    '---------------------------------------------------------

    ' If you draw a region, you should see two Softimage logos shifted relative to each other.

    ' If you open up the texture layer editor or rendertree on the cube, you will see two layers,

    ' one bleneded into the ambient port and one into the diffuse port.

    ' Output from this script:

    'INFO : "Added layer Sources.DefaultLib.Material.Phong.XSIlogo_Clip_Layer"

    'INFO : "Added layer Sources.DefaultLib.Material.Phong.XSIlogo_Layer"

    '---------------------------------------------------------

### See Also

BlendClipsInTextureLayers BlendClipsInTextureLayersInsp BlendClipsInTextureLayersWithPortsInsp BlendInTextureLayers BlendInTextureLayersInsp BlendInTextureLayersWithPortsInsp