v4.0
Moves texture layers up or down in the ordered stacks of layers. This considers the overall order of layers in other containers that share the given texture layers.
MoveTextureLayers( [InputObjs], [Offset] ); |
Parameter | Type | Description |
---|---|---|
InputObjs | String |
List of texture layers to be moved up or down in the overall list of layers. Default Value: Current selection. |
Offset | Long |
Amount to move the specified layers. A negative value moves them up in the list, positive moves them down. The absolute value is the number of steps to move them in that direction. Default Value: -1 |
' ' This example creates two shaders in a simple render tree, and applies ' texture layers to them. Then it moves some of the layers up and down, ' illustrating the MoveTextureLayers command. ' In particular, it builds the following stacks of layers. ' ' Phong Fractal ' A A ' B E ' C B ' D D ' option explicit dim oSph, oPhong, oFractal, oLyr(4) ' Build our shaders (a Phong and a Fractal), which will be the "texture ' layer containers" that will each be able to hold a stack of layers. NewScene , False set oSph = CreatePrim( "Sphere", "MeshSurface" ) set oPhong = SIApplyShader( "Phong", oSph ) set oFractal = BlendInPresetsInsp( "Fractal", , , True, siReplaceNoBlend, False, False, True ) ' Now create and add all the layers, as indicated above. ' Add 'A', 'B' and 'D' to both containers at the end. set oLyr(0) = AddTextureLayer( , oPhong & "," & oFractal, "A", True ) set oLyr(1) = AddTextureLayer( , oPhong & "," & oFractal, "B", True ) set oLyr(3) = AddTextureLayer( , oPhong & "," & oFractal, "D", True ) ' Add 'C' before 'D' in the first container. set oLyr(2) = AddTextureLayer( , oPhong, "C", False, oLyr(3) ) ' Add 'E' after 'A' in the second container. set oLyr(4) = AddTextureLayer( , oFractal, "E", True, oLyr(0) ) ' ' Now start moving layers around. Note that they dependencies ' as expressed when we were adding layers will be maintained at all ' times. ' Start by moving 'D' up two spots. -2 means move up two steps. MoveTextureLayers oLyr(3), -2 ' It is likely now above 'B' and 'C'. The two steps could equally well have ' moved it above 'C' and 'E' -- either is valid, based on the relationships ' expressed above. Which one actually happens depends on how the moving ' algorithm is implemented and the order in which the containers and layers ' were created. ' Now let's move 'A' and 'E' down a bunch of slots, ensuring they are ' at the end. We'll just provide a big number for the number of steps down ' to make, if we can't guess the exact number... MoveTextureLayers oLyr(0) & "," & oLyr(4), 10 PrintTextureLayersInContainer oPhong PrintTextureLayersInContainer oFractal sub PrintTextureLayersInContainer( in_cont ) dim oStack, oItem, oStr oStr = "Texture Layers in Container: " & in_cont & vbCrLf set oStack = EnumElements( in_cont & ".TextureLayers" ) for each oItem in oStack oStr = oStr & " " & oItem.name & vbCrLf next logmessage oStr end sub ' ' The output from the example should look something like this: ' 'INFO : "Texture Layers in Container: sphere.Material.Phong ' D ' B ' C ' A '" 'INFO : "Texture Layers in Container: sphere.Material.Phong.Fractal ' D ' B ' A ' E '" |