MoveTextureLayers

MoveTextureLayers

導入

v4.0

詳細

順序付けされたレイヤ スタック内でテクスチャ レイヤを上下に移動します。 このコマンドは、指定のテクスチャ レイヤを共有する他のコンテナのレイヤすべての順序を考慮します。

スクリプト構文

MoveTextureLayers( [InputObjs], [Offset] );

パラメータ

パラメータ タイプ 説明
InputObjs 文字列 レイヤ全体のリスト内で、上または下に移動するテクスチャ レイヤのリスト

デフォルト値: 現在選択されている値

Offset Long 指定のレイヤを移動する量。 負の値を指定するとリスト内で上に移動し、正の値を指定すると下に移動します。 絶対値は、それぞれの方向で移動するステップ数です。

デフォルト値: -1

VBScript の例

'

' 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

'"

関連項目

AddTextureLayer RemoveTextureLayers AddTextureLayerPorts TextureLayer.Move