Related Scripting Object: ClusterPropertyCollection
An array of cluster property elements in a ClusterProperty object. More...
#include <xsi_clusterproperty.h>
Public Member Functions |
|
| CClusterPropertyElementArray () | |
| CClusterPropertyElementArray (const CClusterPropertyElementArray &in_array) | |
| virtual | ~CClusterPropertyElementArray () |
| CClusterPropertyElementArray & | operator= (const CClusterPropertyElementArray &in_array) |
| CDoubleArray | GetArray () const |
| CStatus | PutArray (const CDoubleArray &in_values) |
| LONG | GetCount () const |
| CDoubleArray | GetItem (LONG in_index) const |
| CStatus | PutItem (LONG in_index, const CDoubleArray &in_values) |
| CDoubleArray | GetItemsByIndex (const CLongArray &in_indices) const |
| CStatus | PutItemsByIndex (const CLongArray &in_indices, const CDoubleArray &in_values) |
| LONG | GetValueSize () const |
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:
using namespace XSI; Application app; Model root = app.GetActiveSceneRoot(); X3DObject myCube; root.AddGeometry( L"Cube", L"MeshSurface", L"", myCube ); // install the texture support object 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; } // get the sample point cluster and print out its UVW values 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() ); }
| CClusterPropertyElementArray | ( | const CClusterPropertyElementArray & | in_array | ) |
Copy constructor.
| in_array | constant CClusterPropertyElementArray object. |
Default destructor
| CClusterPropertyElementArray& operator= | ( | const CClusterPropertyElementArray & | in_array | ) |
Creates an array from a reference object.
| in_array | constant CClusterPropertyElementArray object. |
Returns an array of element values which contains CClusterPropertyElementArray::GetCount() * CClusterPropertyElementArray::GetValueSize() double values. The array is laid out so that all values for an element are contiguous.
Sets the values on the underlying ClusterProperty.
| in_values | Array of element values |
CStatus::Fail failure
Returns the number of cluster element values
Returns the cluster element values at a given index.
| in_index | Element index. |
Sets the cluster element values at a given index.
| in_index | Element index. | |
| in_values | Array of element values. |
CStatus::Fail failure
CStatus::InvalidArgument The index is greater than the number of elements or smaller than zero.
Returns cluster element values by indices.
| in_indices | Array of indices |
Sets cluster element values by indices.
| in_indices | Array of indices | |
| in_values | Array of element values |
CStatus::Fail failure
CStatus::InvalidArgument If an index is greater than the number of elements or smaller than zero.
Returns the number of values per element in the cluster. For instance, a uvw cluster property returns 3(uvw) and in the case of a vertex color cluster property it returns 4(rgba).