BlendClipsInTextureLayers

Introduced

v4.0

Description

Locates all the default texture ports (connection points) on the immediate shaders attached to the given objects. Creates layers with the requested clips, and adds these layers on the located ports.

If a source is provided, a clip is automatically created and connected.

Scripting Syntax

oReturn = BlendClipsInTextureLayers( ClipList, [InputObjs], [SharedMatAction], [NotifyNoResult], [Mode], [Ambient], [Diffuse], [Transparency], [Reflection] );

Return Value

Returns the layers created as an XSICollection. If the value of Mode is siReplaceNoBlend, the first image shader is returned as a shader rather than a layer.

Parameters

Parameter Type Description
ClipList String List of clips to attach to the layers
InputObjs String List of objects to search for default texture connection points

Default Value: Current selection

SharedMatAction Integer Make shared materials local? Note: If "Beginner user" is used, the user's choice (0=No or 1=Yes) will be logged in the script window, rather than "2". When the logged command is replayed, the command will automatically answer yes or no. If "Advanced user" is used, it is logged as advanced user, and hence will pop up a dialog when replayed.

Default Value: 2 (Ask Beginner User)

Possible Values:

Description:

0 No
1 Yes
2 Ask beginner user
3 Ask advanced user
NotifyNoResult Boolean True to notify user if no presets created.

Default Value: False (no notification)

Mode siBlendInTextureLayersModes Method for blending in the new presets

Default Value: siBlendInTextureLayers (no replacement)

Ambient Boolean If true, blend in to the ambient port (if present)

Default Value: True (apply to ambient)

Diffuse Boolean If true, blend in to the diffuse port (if present)

Default Value: True (apply to diffuse)

Transparency Boolean If true, blend in to the transparency port (if present)

Default Value: false (don't apply to transparency)

Reflection Boolean If true, blend in to the reflection port (if present)

Default Value: false (don't apply to reflection)

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 = BlendClipsInTextureLayers(oClipObj, oBox)

for each item in result

	logmessage "Added layer " & item

next 

' Blending in a source automatically creates a clip

set result = BlendClipsInTextureLayers(oSourceObj, oBox)

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.

' Output from this script:

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

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

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

See Also

BlendClipsInTextureLayersInsp BlendClipsInTextureLayersWithPorts BlendClipsInTextureLayersWithPortsInsp BlendInTextureLayersInsp BlendInTextureLayersWithPorts BlendInTextureLayersWithPortsInsp SIConnectShaderToCnxPoint SIApplyShaderToCnxPoint