SetClusterPropertyValues

Introduced

v9.0 (2011)

Description

Sets the values of a cluster property.

The offsets array designates the cluster elements offsets to modify. Specifying an empty value or an empty array will modify all cluster elements offsets with the specified values.

The values array designated the values to set for the specified cluster element offsets. The size of values array must match one of the following: the size of an element size (e.g. RGBA = 4 values) or the size of the number of offsets specified multiplicated by the size of an element size (e.g. 2 offsets * RGB = 6 values). In the first case, the specified values will be set to all the specified cluster element offsets, while in the case, the specified values will be applied to their corresponding specified cluster element offset.

Scripting Syntax

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

Parameters

Parameter Type Description
ClusterProp ClusterProperty Cluster property to modify
Offsets Array Array of cluster element offsets to modify
Values Array Array of values to set for the specified cluster element offsets
Mode siSetValueMode Specifies the mathematical mode when setting a new value to a current value.

Default Value: siSetValueModeAbsolute

ClampValues Boolean True to clamp values

Currently, only meaningful when setting values on WeightMap properties, which have a minimum and a maximum parameters.

Default Value: false

Examples

1. VBScript Example

'

' 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 Example

#

# 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