ImageClip.GetShaderParameterTargets

Introduced

v7.0

Description

Returns a ParameterCollection containing the object(s) connected to an image clip output. This traverses the render tree in the opposite direction as the Parameter.Source property:

C# Syntax

ParameterCollection ImageClip.GetShaderParameterTargets();

Scripting Syntax

oReturn = ImageClip.GetShaderParameterTargets();

Return Value

ParameterCollection

Examples

JScript Example

/*
	This example creates a sample shader tree that uses 3 image clips and shows 
	how to get to which input parameters thoses image clips are connected. An image clip
	can be shared across different materials.
*/
NewScene(null, false);
//Create 4 Image Nodes
SIApplyShaderToCnxPoint("Image", "Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse", null, null);
SIApplyShaderToCnxPoint("Image", "Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", null, null);
SIApplyShaderToCnxPoint("Image", "Sources.Materials.DefaultLib.Scene_Material.Phong.specular", null, null);
SIApplyShaderToCnxPoint("ScalarImage", "Sources.Materials.DefaultLib.Scene_Material.Phong.shiny", null, null);
//Create 3 Image Clips From File
SICreateImageClip("\Pictures\\chrom[1..3].tga", null, null);
SICreateImageClip("\Pictures\\cloud02.pic", null, null);
SICreateImageClip("\Pictures\\refmap2.tga", null, null);
//Connect the first 2 Image Clip to different Shader Input Parameters 
SIConnectShaderToCnxPoint("Clips.chrom_1__3__tga", "Sources.Materials.DefaultLib.Scene_Material.Image.tex", false);
SIConnectShaderToCnxPoint("Clips.cloud02_pic", "Sources.Materials.DefaultLib.Scene_Material.Image1.tex", false);
//The last Image Clip is connected to 2 input parameters.
SIConnectShaderToCnxPoint("Clips.refmap2_tga", "Sources.Materials.DefaultLib.Scene_Material.Image2.tex", false);
SIConnectShaderToCnxPoint("Clips.refmap2_tga", "Sources.Materials.DefaultLib.Scene_Material.ScalarImage.tex", false);
//Remove No-Icon from this material
DisconnectAndDeleteOrUnnestShaders("Clips.noIcon_pic", "Sources.Materials.DefaultLib.Scene_Material");
//Now Get the Image Clips and use the GetShaderParameterTarget method to get where they are connected.
var oCloudClip, oChromeClip, oRefMapClip, oNoIconClip;
SICreateImageClip("\Pictures\\refmap2.tga", null, null);
oCloudClip = GetValue("Clips.cloud02_pic");
oChromeClip = GetValue("Clips.chrom_1__3__tga");
oRefMapClip = GetValue("Clips.refmap2_tga");
oNoIconClip = GetValue("Clips.noIcon_pic");
//Cloud and Chrome Should be connected to 1 target.
var oCloudClipTargets, oChromeClipTargets;
oCloudClipTargets = oCloudClip.GetShaderParameterTargets();
oChromeClipTargets = oChromeClip.GetShaderParameterTargets();
LogMessage( "Cloud and Chrome Should be connected to 1 target." );
LogMessage( "Cloud is connected to " + oCloudClipTargets.Count + " Target(s)." );
LogMessage( "Chromeis connected to " + oChromeClipTargets.Count + " Target(s)." );
//RefMap Should be connected to 2 targets.
var oRefMapClipTargets;
oRefMapClipTargets= oRefMapClip.GetShaderParameterTargets();
LogMessage( "RefMap Should be connected to 2 targets." );
LogMessage( "RefMap is connected to " + oRefMapClipTargets.Count + " Target(s)." );
//NoIcon Should be connected to 0 target.
var oNoIconClipTargets;
oNoIconClipTargets= oNoIconClip.GetShaderParameterTargets();
LogMessage( "NoIcon Should be connected to 0 target." );
LogMessage( "NoIcon is connected to " + oNoIconClipTargets.Count + " Target(s)." );

See Also

Shader.GetShaderParameterTargets Parameter.Source