This template class encapsulates ICEAttribute data as a 1D array. CICEAttributeDataArray objects are read-only and can be filled with the methods supplied with the ICEAttribute class. CICEAttributeDataArray is zero-based and can be one of the following types:
All types are associated to specific ICEAttribute types. Therefore, you need to declare the right array object type that matches the ICEAttribute data type you want to access. Otherwise a runtime error will occur and the returned array will be empty.
using namespace XSI; CValue CreatePrim( const CString& in_presetobj, const CString& in_geometrytype, const CString& in_name, const CString& in_parent ); X3DObject grid = CreatePrim( L"Grid", L"MeshSurface", L"", L""); ICEAttribute attr = grid.GetActivePrimitive().GetGeometry().GetICEAttributeFromName( L"PointPosition" ); CICEAttributeDataArrayVector3f points; attr.GetDataArray( points ); Application xsi; for( ULONG i=0; i<points.GetCount( ); i++ ) { xsi.LogMessage( CString( points[ i ] ) ); } // Helper CValue CreatePrim( const CString& in_presetobj, const CString& in_geometrytype, const CString& in_name, const CString& in_parent ) { CValueArray args(4); CValue retval; args[0]= in_presetobj; args[1]= in_geometrytype; args[2]= in_name; args[3]= in_parent; Application app; app.ExecuteCommand( L"CreatePrim", args, retval ); return retval; }
#include <xsi_iceattributedataarray.h>
Public Member Functions |
|
CICEAttributeDataArray () | |
~CICEAttributeDataArray () | |
const T & | operator[] (ULONG in_index) const |
T & | operator[] (ULONG in_index) |
CICEAttributeDataArray | ( | ) | [inline] |
Constructor.
~CICEAttributeDataArray | ( | ) | [inline] |
Destructor.
const T& operator[] | ( | ULONG | in_index | ) | const [inline] |
Accessor to the encapsulated array. This operator is called when reading the data so the return value is read-only.
in_index | Index in the array. The index must be smaller than the number of elements in the array, otherwise the results are unpredictable. If the array is constant, the function always return the first item's value. |
T& operator[] | ( | ULONG | in_index | ) | [inline] |
Accessor to the encapsulated array. This operator is used for writing to the data array.
in_index | Index in the array. The index must be smaller than the number of elements in the array, otherwise the results are unpredictable. |