ArrayParameter.Move

Description

Moves the specified array parameter up or down within the array. Using negative values for the UpOrDown parameter moves the parameter down (towards the beginning of the array) and specifying positive values moves it up (towards the end of the array). The parameters cannot be moved beyond the array boundaries.

Scripting Syntax

ArrayParameter.Move( Parameter, UpOrDown );

Parameters

Parameter Type Description
Parameter Variant The array parameter to remove. You can use either a zero-based index in the array or as a parameter object that's already a member of the array. Any other type generates an Invalid Argument error.
UpOrDown Integer Number of indices and direction to move the parameter. The new index of the parameter will be its current index plus this value. A parameter cannot moved beyond the array's boundaries.

Examples

1. VBScript Example

NewScene ,false
GetPrimLight "Point.Preset", "Point"
SIApplyShaderToCnxPoint "Volume\Fast_volume_effects.Preset", "Passes.Default_Pass.VolumeShaderStack", , False
AddObjectsToShader "light", "Passes.Default_Pass.Fast_volume_effects.Lights"
AddObjectsToShader "Point", "Passes.Default_Pass.Fast_volume_effects.Lights"
Set oShader = GetValue( "Passes.Default_Pass.Fast_volume_effects" )
Set oLights = oShader.Lights
LogMessage oLights.type
LogMessage "No Light: " & oLights.Count
For i = 0 To oLights.Count - 1
Set oLight = oLights.Parameters( i ).NestedObjects(0)
LogMessage "Light " & i & " : " & oLight.FullName
Next

2. JScript Example

/*
        This example demonstrates how to move elements 
        up and down in a parameter array.
*/
NewScene( null, false );
var oCube = ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface" );
var oMat = oCube.AddMaterial( "Phong" );
var oMixer = oMat.surface.ConnectFromProgid( "Softimage.XSIColorMixer.1" );
var oLayers = oMixer.layers;
var aLayers = new Array();
for( i = 0; i < 4; i++ )
{
        aLayers[ i ] = oLayers.Add();
        aLayers[ i ].parameters("layer_mixmode").value = i;
}
var strMsg = "Before : ";
for( i = 0; i < oLayers.Count; i++ )
        strMsg += oLayers.Parameters( i ).parameters("layer_mixmode").value + " ";
LogMessage( strMsg );
// Move element by index, ten indices down. The move will be
// clamped to the beginning of the array.
oLayers.Move( 3, -10 );
strMsg = "After 1: ";
for( i = 0; i < oLayers.Count; i++ )
        strMsg += oLayers.Parameters( i ).parameters("layer_mixmode").value + " ";
LogMessage( strMsg );
// Move the element by reference, three indices up. The move will
// again be clamped, this time to the end of the array.
oLayers.Move( aLayers[ 1 ], 3 );
// Move element by reference
strMsg = "After 2: ";
for( i = 0; i < oLayers.Count; i++ )
        strMsg += oLayers.Parameters( i ).parameters("layer_mixmode").value + " ";
LogMessage( strMsg );
// Output of above script is:
// --------------------------
// INFO : "Before : 0 1 2 3"
// INFO : "After 1: 3 0 1 2"
// INFO : "After 2: 3 0 2 1"

See Also

ArrayParameter.Add