SetClusterPropertyValues

SetClusterPropertyValues

導入

v9.0 (2011)

詳細

クラスタ プロパティの値を設定します。

オフセット配列は、変更するクラスタ エレメントのオフセットを指定します。空の値または空の配列を指定すると、指定した値ですべてのクラスタ エレメントのオフセットが変更されます。

値の配列により、指定されたクラスタ エレメントのオフセット用に設定する値が指定されました。値の配列のサイズは、次のいずれかに一致する必要があります: エレメント サイズのサイズ(例: RGBA = 4 つの値)または指定されたオフセットの数をエレメント サイズのサイズで乗算したサイズ(例: 2 つのオフセット * RGB = 6 つの値)。前者の場合、指定された値は、指定されたクラスタ エレメントのすべてのオフセットに対して設定されます。後者の場合、指定された値は指定された該当するクラスタ エレメントのオフセットに適用されます。

スクリプト構文

SetClusterPropertyValues( ClusterProp, Offsets, Values, [Mode], [ClampValues] );

パラメータ

パラメータ タイプ 説明
ClusterProp ClusterProperty 変更するクラスタ プロパティ
Offsets [Array(配列)] 変更するクラスタ エレメントのオフセットの配列
Values [Array(配列)] 指定されたクラスタ エレメントのオフセット用に設定する値の配列
Mode siSetValueMode 現在の値に新しい値を設定するときに、算術モードを指定します。

デフォルト値: siSetValueModeAbsolute

ClampValues ブール 値をクランプする場合は True

現在、最小パラメータおよび最大パラメータを持つ WeightMap プロパティに値を設定するときのみ有効です。

デフォルト値: false

1. VBScript の例

'

' This example shows how to set values on cluster elements of a WeightMap

'

' Create a WeightMap on a sphere

NewScene , False

CreatePrim "Sphere", "MeshSurface"

dim oWMapColl, oWMap, oWMapArray

set oWMapColl = CreateWeightMap

set oWMap = oWMapColl.Item(0)

SetClusterPropertyValues oWMap, Array(0, 1), Array(0.25, 0.5)

oWMapArray = oWMap.Elements.Array

LogMessage( "Setting different values on the first and second cluster elements" )

LogMessage( "WeightMap value for cluster element 0 : " & oWMapArray( 0 , 0 ) )

LogMessage( "WeightMap value for cluster element 1 : " & oWMapArray( 0 , 1 ) )

SetClusterPropertyValues oWMap, Array(10, 20, 30), 0.75

oWMapArray = oWMap.Elements.Array

LogMessage( "Setting the same value on many cluster elements" )

LogMessage( "WeightMap value for cluster element 10 : " & oWMapArray( 0 , 10 ) )

LogMessage( "WeightMap value for cluster element 20 : " & oWMapArray( 0 , 20 ) )

LogMessage( "WeightMap value for cluster element 30 : " & oWMapArray( 0 , 30 ) )

SetClusterPropertyValues oWMap, , Array(0.25), siSetValueModeAdditive

oWMapArray = oWMap.Elements.Array

LogMessage( "Adds the same value on all cluster elements" )

LogMessage( "WeightMap value for cluster element 0  : " & oWMapArray( 0 , 0 ) )

LogMessage( "WeightMap value for cluster element 1  : " & oWMapArray( 0 , 1 ) )

LogMessage( "WeightMap value for cluster element 10 : " & oWMapArray( 0 , 10 ) )

LogMessage( "WeightMap value for cluster element 20 : " & oWMapArray( 0 , 20 ) )

LogMessage( "WeightMap value for cluster element 30 : " & oWMapArray( 0 , 30 ) )

SetClusterPropertyValues oWMap, 10, -2, siSetValueModeAbsolute, True

SetClusterPropertyValues oWMap, 20, -2, siSetValueModeAbsolute, False

oWMapArray = oWMap.Elements.Array

LogMessage( "Playing with the ClampValues argument" )

LogMessage( "WeightMap value for cluster element 0  : " & oWMapArray( 0 , 0 ) )

LogMessage( "WeightMap value for cluster element 1  : " & oWMapArray( 0 , 1 ) )

LogMessage( "WeightMap value for cluster element 10 : " & oWMapArray( 0 , 10 ) )

LogMessage( "WeightMap value for cluster element 20 : " & oWMapArray( 0 , 20 ) )

LogMessage( "WeightMap value for cluster element 30 : " & oWMapArray( 0 , 30 ) )

' Output:

' INFO : Setting different values on the first and second cluster elements

' INFO : WeightMap value for cluster element 0 : 0.25

' INFO : WeightMap value for cluster element 1 : 0.5

' INFO : Setting the same value on many cluster elements

' INFO : WeightMap value for cluster element 10 : 0.75

' INFO : WeightMap value for cluster element 20 : 0.75

' INFO : WeightMap value for cluster element 30 : 0.75

' INFO : Adds the same value on all cluster elements

' INFO : WeightMap value for cluster element 0  : 0.5

' INFO : WeightMap value for cluster element 1  : 0.75

' INFO : WeightMap value for cluster element 10 : 1

' INFO : WeightMap value for cluster element 20 : 1

' INFO : WeightMap value for cluster element 30 : 1

' INFO : Playing with the ClampValues argument

' INFO : WeightMap value for cluster element 0  : 0.5

' INFO : WeightMap value for cluster element 1  : 0.75

' INFO : WeightMap value for cluster element 10 : 0

' INFO : WeightMap value for cluster element 20 : -2

' INFO : WeightMap value for cluster element 30 : 1

2. Python の例

#

# This example shows how to set values on cluster elements of a CAV

#

from win32com.client import constants as c

# Create a CAV on a sphere

app = Application

app.NewScene("", False)

app.CreatePrim("Sphere", "MeshSurface", "", "")

oCAVColl = app.CreateVertexColorSupport("", "", "", "")

oCAV = app.Dictionary.GetObject("sphere.polymsh.cls.UV_Cluster_AUTO.Vertex_Color")

app.ChangeVertexColorDatatype(oCAV, 1)

app.SetClusterPropertyValues(oCAV, [0, 1], [0.25, 0.5, 0.75, 1, 1, 0.75, 0.5, 0.25])

oCAVArray = oCAV.Elements.Array

app.LogMessage( "Setting different values on the first and second cluster elements" )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 0, Red    : " + str(oCAVArray[ 0 ][ 0 ]) )

app.LogMessage( "CAV value for cluster element 0, Green  : " + str(oCAVArray[ 1 ][ 0 ]) )

app.LogMessage( "CAV value for cluster element 0, Blue   : " + str(oCAVArray[ 2 ][ 0 ]) )

app.LogMessage( "CAV value for cluster element 0, Alpha  : " + str(oCAVArray[ 3 ][ 0 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 1, Red    : " + str(oCAVArray[ 0 ][ 1 ]) )

app.LogMessage( "CAV value for cluster element 1, Green  : " + str(oCAVArray[ 1 ][ 1 ]) )

app.LogMessage( "CAV value for cluster element 1, Blue   : " + str(oCAVArray[ 2 ][ 1 ]) )

app.LogMessage( "CAV value for cluster element 1, Alpha  : " + str(oCAVArray[ 3 ][ 1 ]) )

app.SetClusterPropertyValues(oCAV, [10, 20, 30], [0.5, 1, 0.25, 0.75])

oCAVArray = oCAV.Elements.Array

app.LogMessage( "Setting the same value on many cluster elements" )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 10, Red   : " + str(oCAVArray[ 0 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Green : " + str(oCAVArray[ 1 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Blue  : " + str(oCAVArray[ 2 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Alpha : " + str(oCAVArray[ 3 ][ 10 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 20, Red   : " + str(oCAVArray[ 0 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Green : " + str(oCAVArray[ 1 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Blue  : " + str(oCAVArray[ 2 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Alpha : " + str(oCAVArray[ 3 ][ 20 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 30, Red   : " + str(oCAVArray[ 0 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Green : " + str(oCAVArray[ 1 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Blue  : " + str(oCAVArray[ 2 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Alpha : " + str(oCAVArray[ 3 ][ 30 ]) )

app.SetClusterPropertyValues(oCAV, None, [0.75, 0.25, 1, 0.5])

oCAVArray = oCAV.Elements.Array

app.LogMessage( "Setting the same value on all cluster elements" )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 0, Red    : " + str(oCAVArray[ 0 ][ 0 ]) )

app.LogMessage( "CAV value for cluster element 0, Green  : " + str(oCAVArray[ 1 ][ 0 ]) )

app.LogMessage( "CAV value for cluster element 0, Blue   : " + str(oCAVArray[ 2 ][ 0 ]) )

app.LogMessage( "CAV value for cluster element 0, Alpha  : " + str(oCAVArray[ 3 ][ 0 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 1, Red    : " + str(oCAVArray[ 0 ][ 1 ]) )

app.LogMessage( "CAV value for cluster element 1, Green  : " + str(oCAVArray[ 1 ][ 1 ]) )

app.LogMessage( "CAV value for cluster element 1, Blue   : " + str(oCAVArray[ 2 ][ 1 ]) )

app.LogMessage( "CAV value for cluster element 1, Alpha  : " + str(oCAVArray[ 3 ][ 1 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 10, Red   : " + str(oCAVArray[ 0 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Green : " + str(oCAVArray[ 1 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Blue  : " + str(oCAVArray[ 2 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Alpha : " + str(oCAVArray[ 3 ][ 10 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 20, Red   : " + str(oCAVArray[ 0 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Green : " + str(oCAVArray[ 1 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Blue  : " + str(oCAVArray[ 2 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Alpha : " + str(oCAVArray[ 3 ][ 20 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 30, Red   : " + str(oCAVArray[ 0 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Green : " + str(oCAVArray[ 1 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Blue  : " + str(oCAVArray[ 2 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Alpha : " + str(oCAVArray[ 3 ][ 30 ]) )

app.SetClusterPropertyValues(oCAV, [10, 20, 30], [-10, None, None, None], c.siSetValueModeAddPercentage)

oCAVArray = oCAV.Elements.Array

app.LogMessage( "Removing a 10% of the Red channel on many cluster elements" )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 10, Red   : " + str(oCAVArray[ 0 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Green : " + str(oCAVArray[ 1 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Blue  : " + str(oCAVArray[ 2 ][ 10 ]) )

app.LogMessage( "CAV value for cluster element 10, Alpha : " + str(oCAVArray[ 3 ][ 10 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 20, Red   : " + str(oCAVArray[ 0 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Green : " + str(oCAVArray[ 1 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Blue  : " + str(oCAVArray[ 2 ][ 20 ]) )

app.LogMessage( "CAV value for cluster element 20, Alpha : " + str(oCAVArray[ 3 ][ 20 ]) )

app.LogMessage( "--------------------------------------" )

app.LogMessage( "CAV value for cluster element 30, Red   : " + str(oCAVArray[ 0 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Green : " + str(oCAVArray[ 1 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Blue  : " + str(oCAVArray[ 2 ][ 30 ]) )

app.LogMessage( "CAV value for cluster element 30, Alpha : " + str(oCAVArray[ 3 ][ 30 ]) )

# Output:

# INFO : Setting different values on the first and second cluster elements

# INFO : --------------------------------------

# INFO : CAV value for cluster element 0, Red    : 0.25

# INFO : CAV value for cluster element 0, Green  : 0.5

# INFO : CAV value for cluster element 0, Blue   : 0.75

# INFO : CAV value for cluster element 0, Alpha  : 1.0

# INFO : --------------------------------------

# INFO : CAV value for cluster element 1, Red    : 1.0

# INFO : CAV value for cluster element 1, Green  : 0.75

# INFO : CAV value for cluster element 1, Blue   : 0.5

# INFO : CAV value for cluster element 1, Alpha  : 0.25

# INFO : Setting the same value on many cluster elements

# INFO : --------------------------------------

# INFO : CAV value for cluster element 10, Red   : 0.5

# INFO : CAV value for cluster element 10, Green : 1.0

# INFO : CAV value for cluster element 10, Blue  : 0.25

# INFO : CAV value for cluster element 10, Alpha : 0.75

# INFO : --------------------------------------

# INFO : CAV value for cluster element 20, Red   : 0.5

# INFO : CAV value for cluster element 20, Green : 1.0

# INFO : CAV value for cluster element 20, Blue  : 0.25

# INFO : CAV value for cluster element 20, Alpha : 0.75

# INFO : --------------------------------------

# INFO : CAV value for cluster element 30, Red   : 0.5

# INFO : CAV value for cluster element 30, Green : 1.0

# INFO : CAV value for cluster element 30, Blue  : 0.25

# INFO : CAV value for cluster element 30, Alpha : 0.75

# INFO : Setting the same value on all cluster elements

# INFO : --------------------------------------

# INFO : CAV value for cluster element 0, Red    : 0.75

# INFO : CAV value for cluster element 0, Green  : 0.25

# INFO : CAV value for cluster element 0, Blue   : 1.0

# INFO : CAV value for cluster element 0, Alpha  : 0.5

# INFO : --------------------------------------

# INFO : CAV value for cluster element 1, Red    : 0.75

# INFO : CAV value for cluster element 1, Green  : 0.25

# INFO : CAV value for cluster element 1, Blue   : 1.0

# INFO : CAV value for cluster element 1, Alpha  : 0.5

# INFO : --------------------------------------

# INFO : CAV value for cluster element 10, Red   : 0.75

# INFO : CAV value for cluster element 10, Green : 0.25

# INFO : CAV value for cluster element 10, Blue  : 1.0

# INFO : CAV value for cluster element 10, Alpha : 0.5

# INFO : --------------------------------------

# INFO : CAV value for cluster element 20, Red   : 0.75

# INFO : CAV value for cluster element 20, Green : 0.25

# INFO : CAV value for cluster element 20, Blue  : 1.0

# INFO : CAV value for cluster element 20, Alpha : 0.5

# INFO : --------------------------------------

# INFO : CAV value for cluster element 30, Red   : 0.75

# INFO : CAV value for cluster element 30, Green : 0.25

# INFO : CAV value for cluster element 30, Blue  : 1.0

# INFO : CAV value for cluster element 30, Alpha : 0.5

# INFO : Removing a 10% of the Red channel on many cluster elements

# INFO : --------------------------------------

# INFO : CAV value for cluster element 10, Red   : 0.675

# INFO : CAV value for cluster element 10, Green : 0.25

# INFO : CAV value for cluster element 10, Blue  : 1.0

# INFO : CAV value for cluster element 10, Alpha : 0.5

# INFO : --------------------------------------

# INFO : CAV value for cluster element 20, Red   : 0.675

# INFO : CAV value for cluster element 20, Green : 0.25

# INFO : CAV value for cluster element 20, Blue  : 1.0

# INFO : CAV value for cluster element 20, Alpha : 0.5

# INFO : --------------------------------------

# INFO : CAV value for cluster element 30, Red   : 0.675

# INFO : CAV value for cluster element 30, Green : 0.25

# INFO : CAV value for cluster element 30, Blue  : 1.0

# INFO : CAV value for cluster element 30, Alpha : 0.5