v4.0
テクスチャレイヤが所有する各TextureLayerPortオブジェクトを含むTextureLayerPortCollectionを戻します。
// get accessor TextureLayerPortCollection rtn = TextureLayer.TextureLayerPorts; |
// 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" |
' This 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" |