PaintVertexColors

導入

v1.0

詳細

指定したオブジェクトのポリゴン ノードの頂点の色の値を変更します。

スクリプト構文

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

戻り値

なし

パラメータ

パラメータ タイプ 詳細
InputObj 文字列 ペイントする 3D オブジェクトのオブジェクト名

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

Polynodes 配列 色付けしたいポリゴン ノードのインデックスの配列

注: この配列に指定した数と同じ数値を、Colors 配列に使用してください。
Colors 配列 Polynodes 配列に指定した各ポリゴン ノードの、新しい RGBA 値(つまり、Polynodes 配列に指定した各ノードのインデックスに、ひとつの 16 進数の値をマッピングします)。

各 RGBA の 16 進数値は 1 バイトで、long 型にパッケージングされます。 たとえば、赤の 16 進数値は &hFF000000 で、long 型の -16777216 にパッケージングされます。 Colors 配列の色指定に 16 進表記を使用することはできますが、Softimage では、Script Editor のヒストリ ペインにコマンドを記録する際、パッケージングされた long 型の値のみを表示します(以下の例を参照)。
Mode Integer ペイント モード

指定可能な値:

説明:

1 RGB をペイントします。
2 アルファをペイントします。
3 RGBおよびアルファをペイントします。

1. VBScript の例

'*********************************************************
'       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 の例

// 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.

関連項目

CreateVertexColorSupport ClusterProperty