TextureLayerPort.Target
 
 
 

TextureLayerPort.Target

Introduced

v4.0

Description

Returns the shader or material Parameter which this port drives.

C# Syntax

// get accessor
Parameter rtn = TextureLayerPort.Target;

Examples

1. JScript Example

// This example shows enumeration of texture layer
// ports, and seeing what target they drive.
oRoot = ActiveProject.ActiveScene.Root;
oSph = oRoot.AddGeometry( "Sphere", "MeshSurface" );
oMat = oSph.AddMaterial( "Phong" );
oPhong = oMat.Shaders(0);
oParam = oPhong.parameters( "specular" );
oFractal = oParam.ConnectFromPreset( "Fractal", siTextureShaderFamily );
// Add a layer at the end.
oLayer = oPhong.CreateTextureLayer( "DirtLayer" );
// Add some texture layer port connections on this layer.
oPorts = new Array(3);
oPorts[0] = oLayer.AddTextureLayerPort( oPhong.parameters( "ambient" ) );
oPorts[1] = oLayer.AddTextureLayerPort( oPhong.parameters( "diffuse" ) );
// The next line shows adding a port which is on a container that the layer
// is currently not part of -- it will be added to that container.
oPorts[2] = oLayer.AddTextureLayerPort( oFractal.parameters( "color1" ) );
Application.LogMessage( "Created " + oLayer.TextureLayerPorts.count + " ports." );
for ( i = 0; i < oLayer.TextureLayerPorts.count; i++ )
{
        oPort = oLayer.TextureLayerPorts(i);
        Application.LogMessage( "Port " + (i+1) + " drives: " + oPort.Target );
}
// This example should log something like:
//INFO : "Created 3 ports."
//INFO : "Port 1 drives: sphere.Material.Phong.ambient"
//INFO : "Port 2 drives: sphere.Material.Phong.diffuse"
//INFO : "Port 3 drives: sphere.Material.Phong.Fractal.color1"

2. VBScript Example

' This VB script example shows enumeration of texture layer
' ports, and seeing what target they drive.
set oRoot = ActiveProject.ActiveScene.Root
set oSph = oRoot.AddGeometry( "Sphere", "MeshSurface" )
set oMat = oSph.AddMaterial( "Phong" )
set oPhong = oMat.Shaders(0)
set oParam = oPhong.parameters( "specular" )
set oFractal = oParam.ConnectFromPreset( "Fractal", siTextureShaderFamily )
' Add a layer at the end.
set oLayer = oPhong.CreateTextureLayer( "DirtLayer" )
' Add some texture layer port connections on this layer.
dim oPorts(2)
set oPorts(0) = oLayer.AddTextureLayerPort( oPhong.parameters( "ambient" ) )
set oPorts(1) = oLayer.AddTextureLayerPort( oPhong.parameters( "diffuse" ) )
' The next line shows adding a port which is on a container that the layer
' is currently not part of -- it will be added to that container.
set oPorts(2) = oLayer.AddTextureLayerPort( oFractal.parameters( "color1" ) )
logmessage "Created " & oLayer.TextureLayerPorts.count & " ports."
i = 1
for each oPort in oLayer.TextureLayerPorts
        logmessage "Port " & i & " drives: " & oPort.Target
        i = i + 1
next
' This example should log something like:
'INFO : "Created 3 ports."
'INFO : "Port 1 drives: sphere.Material.Phong.ambient"
'INFO : "Port 2 drives: sphere.Material.Phong.diffuse"
'INFO : "Port 3 drives: sphere.Material.Phong.Fractal.color1"