TextureLayer.RemoveTextureLayerPort

Introduced

v4.0

Description

Removes a TextureLayerPort from the texture layer. This actually disconnects it and causes the layer to no longer affect that shader property.

It is valid to have texture layers which have no port connections, these empty layers act like placeholders, and do not affect the rendered result in any way. They will maintain their ordering in the containers in which they appear. Of course, new port connections can be added to them at any time.

C# Syntax

TextureLayer.RemoveTextureLayerPort( Object in_varPort );

Scripting Syntax

TextureLayer.RemoveTextureLayerPort( Port );

Parameters

Parameter Type Description
Port TextureLayerPort or String Texture layer port to remove from this texture layer.

Examples

1. JScript Example

// This example shows creation of texture layer ports,
// plus enumerating and removing them.
oRoot = ActiveProject.ActiveScene.Root;
oSph = oRoot.AddGeometry( "Sphere", "MeshSurface" );
oMat = oSph.AddMaterial( "Phong" );
oPhong = oMat.Shaders(0);
// 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" ) );
oPorts[2] = oLayer.AddTextureLayerPort( oPhong.parameters( "specular" ) );
Application.LogMessage( "Created " + oLayer.TextureLayerPorts.count + " ports." );
for ( i = 0; i < oLayer.TextureLayerPorts.count; i++ )
{
	oPort = oLayer.TextureLayerPorts(i);
	Application.LogMessage( (i+1) + ": " + oPort );
}
oLayer.RemoveTextureLayerPort( oPorts[1] );
oLayer.RemoveTextureLayerPort( oLayer.fullname + "." + oPorts[2].name );
count = oLayer.TextureLayerPorts.count;
Application.LogMessage( "Only " + count + " remain(s) after removal." );
for ( i = 0; i < count; i++ )
{
	Application.LogMessage( (i+1) + ": " + oLayer.TextureLayerPorts.item(i) );
}
// This example should log something like:
//INFO : "Created 3 ports."
//INFO : "1: sphere.Material.Phong.DirtLayer.ambient"
//INFO : "2: sphere.Material.Phong.DirtLayer.diffuse"
//INFO : "3: sphere.Material.Phong.DirtLayer.specular"
//INFO : "Only 1 remain(s) after removal."
//INFO : "1: sphere.Material.Phong.DirtLayer.ambient"

2. VBScript Example

' This example shows creation of texture layer ports,
' plus enumerating and removing them.
set oRoot = ActiveProject.ActiveScene.Root
set oSph = oRoot.AddGeometry( "Sphere", "MeshSurface" )
set oMat = oSph.AddMaterial( "Phong" )
set oPhong = oMat.Shaders(0)
' 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" ) )
set oPorts(2) = oLayer.AddTextureLayerPort( oPhong.parameters( "specular" ) )
logmessage "Created " & oLayer.TextureLayerPorts.count & " ports."
i = 1
for each oPort in oLayer.TextureLayerPorts
	logmessage i & ": " & oPort
	i = i + 1
next
oLayer.RemoveTextureLayerPort oPorts(1)
oLayer.RemoveTextureLayerPort oLayer.fullname & "." & oPorts(2).name
count = oLayer.TextureLayerPorts.count
logmessage "Only " & count & " remain(s) after removal."
for i = 0 to count - 1
	logmessage i + 1 & ": " & oLayer.TextureLayerPorts.item(i)
next
' This example should log something like:
'INFO : "Created 3 ports."
'INFO : "1: sphere.Material.Phong.DirtLayer.ambient"
'INFO : "2: sphere.Material.Phong.DirtLayer.diffuse"
'INFO : "3: sphere.Material.Phong.DirtLayer.specular"
'INFO : "Only 1 remain(s) after removal."
'INFO : "1: sphere.Material.Phong.DirtLayer.ambient"

See Also

DeleteObj TextureLayer.AddTextureLayerPort TextureLayer.TextureLayerPorts