An array of cluster property elements in a ClusterProperty object.
The cluster property maps the cluster element indices to property values (such as RGB vertex color). The value of the element in a cluster property element array is the cluster property value.
You can set elements using CClusterPropertyElementArray::PutItems and this is accessible from an operator. Unlike CClusterElementArray, a CClusterPropertyElementArray object allows editing of element values.
The following lists all cluster properties along with their data type values returned through CClusterPropertyElementArray::GetItem:
- Vertex color property: array of RGBA values
- Envelope weight property: array containing the weight value for each deformer
- Weight map property: array of only 1 value which is the weight value
- UV property: array of UVW values
- Warning:
- This specialized array is returned by ClusterProperty::GetElements, it is not meant to be created and modified in user-defined functions. If you want to add and remove arbitrary items to a collection, you must use a CRefArray instead.
- See also:
- ClusterProperty, Cluster
- Example:
using namespace XSI;
Application app;
Model root = app.GetActiveSceneRoot();
X3DObject myCube;
root.AddGeometry( L"Cube", L"MeshSurface", L"", myCube );
CValueArray args(4);
args[0] = CValue( CString(L"Image") );
args[1] = CValue(myCube);
args[2] = CValue((short)1);
args[3] = CValue(false);
CStatus st;
CValue outArg;
st = app.ExecuteCommand( L"BlendInPresets", args, outArg );
if ( st.GetCode() != CStatus::OK )
{
app.LogMessage( L"BlendInPresets failed" );
return;
}
args[0] = CValue(myCube);
args[1] = CValue((LONG)siTxtUV);
args[2] = CValue((LONG)siTxtDefaultSpherical);
args[3] = CValue(CString(L"Texture_Support"));
st = app.ExecuteCommand( L"CreateTextureSupport", args, outArg );
if ( st.GetCode() != CStatus::OK )
{
app.LogMessage( L"CreateTextureSupport failed" );
return;
}
Geometry geom(myCube.GetActivePrimitive().GetGeometry());
CRefArray samplePoints;
geom.GetClusters().Filter(siSampledPointCluster, CStringArray(), L"",
samplePoints );
Cluster cluster(samplePoints.GetItem(0));
ClusterProperty UVWProp(myCube.GetMaterial().GetCurrentUV());
CClusterPropertyElementArray uvwElementArray(UVWProp.GetElements());
CDoubleArray uvwArray(uvwElementArray.GetArray());
for ( LONG i=0; i< uvwArray.GetCount(); i += uvwElementArray.GetValueSize())
{
app.LogMessage( L"UVW: " +
CValue(uvwArray[i]).GetAsText() + L"," +
CValue(uvwArray[i+1]).GetAsText() + L"," +
CValue(uvwArray[i+2]).GetAsText() );
}