PaintVertexColors

Introduced

v1.0

Description

Modifies the value of vertex colors on the polygon nodes of the specified objects.

Scripting Syntax

oReturn = PaintVertexColors( [InputObj], Polynodes, Colors, Mode );

Return Value

Nothing

Parameters

Parameter Type Description
InputObj String The Object Name of the 3D Object to paint on.

Default Value: Current selection

Polynodes Array Array of indices of the polygon nodes you want to color.

Note: Use the same number of values in the Colors array as you specify in this array.
Colors Array The new RGBA value for each polygon node specified in the Polynodes array (ie., map one hexadecimal value to each node index specified in the Polynodes array).

Each RGBA hexadecimal value takes a byte and is packaged into a long. For example, red is &hFF000000, which is packaged into the long value -16777216. You can use hexadecimal notation to specify color values in this array, but Softimage only displays the packaged long value when logging the command to the history pane of the Script Editor (see the example below).
Mode Integer Paint mode

Possible Values:

Description:

1 Paint RGB
2 Paint Alpha
3 Paint RGB and Alpha

Examples

1. VBScript Example

'*********************************************************
'       SETUP
'
' Set up a simple grid with only 1 subdivision in both U and V
Set oPalette = CreatePrim ( "Grid", "MeshSurface" )
oPalette.Parameters("subdivu").Value = 1
oPalette.Parameters("subdivv").Value = 1
'*********************************************************
'       USING THE COMMAND
'
' Paint red on the first polygon node
PaintVertexColors oPalette, array(0), array(&hFF000000), 3
' Paint green on the second and white on the third polygon node
PaintVertexColors oPalette, array(1,2), array(&h00FF0000,&hFFFFFF00), 3
'*********************************************************
'       OUTPUT
'
' The following commands are logged to the history window:
'       CreatePrim "Grid", "MeshSurface"
'       PaintVertexColors "grid", Array(0), Array(-16777216), 3
'       PaintVertexColors "grid", Array(1, 2), Array(16711680, -256), 3

2. JScript Example

// This example demonstrates how to set a single polygon element with JScript.
CreatePrim("Sphere", "MeshSurface", null, null);
CreateVertexColorSupport(null, "Vertex_Color", null, null);
var indices = new Array(1);
indices[0] = 75;
var colors = new Array(1);
colors[0] = 16765695;
PaintVertexColors("sphere", indices, colors, 1, null);
// IMPORTANT: Avoid passing the index and color arrays like this:
// PaintVertexColors("sphere", Array(75), Array(16765695), 1, null);
// JScript will automatically create 2 arrays of 75 and 16765695 elements in
// this case. It could also issue an error if the size of the newly created 
// arrays are too large to handle. See JScript documentation for further 
// details on the Array object.

See Also

CreateVertexColorSupport ClusterProperty