ArrayParameter.AddValue

Introduced

v5.0

Description

Adds a new parameter with a value to the array. This function ensures that all new array parameters are of the same type. Use this method to add lights and objects to shader parameters such as the camera-lens flare shader, which supports light and object lists.

Scripting Syntax

oReturn = ArrayParameter.AddValue( ItemValue );

Return Value

Parameter

Parameters

Parameter Type Description
ItemValue Variant The value for the new parameter. If the array does not support this value. AddValue raises a "bad variable type" error.

Examples

JScript Example

// This example shows how to use AddValue to
// set up a lens flare on a camera.
// Create a camera and apply a shader to the lens
var root = Application.ActiveProject.ActiveScene.Root;
// Create a point light
var light = root.AddLight( "Point", true, "PointLight" );
// Set up a camera with a lens flare
var camera = root.AddCamera( "Camera", "Camera" );
translate( camera, 4, 6, 4);
var flare = camera.parameters("lensshader").connectfromprogid("Softimage.FLARES.LEN");
flare.parameters("lights").AddValue(light);
// find all shaders applied to camera
var shaders = camera.FindShaders(siShaderFilter);
var eShaders = new Enumerator(shaders)
logmessage( "Number of shaders attached to camera: ");
for ( ; !eShaders.atEnd(); eShaders.moveNext() )
{
	var shader = eShaders.item();
	logmessage( "camera shader: " + shader.progid );
}
//INFO : Number of shaders attached to camera: 
//INFO : camera shader: Softimage.FLARES.LEN.1

See Also

ArrayParameter.Remove ArrayParameter.Move