This reference page is linked to from the following overview topics: Softimage 2014.
#include <xsi_iceattributedataarray.h>
This class is a specialization of CICEAttributeDataArray which allows access to the ICEAttribute data as a 1D array of type siICENodeDataString. CICEAttributeDataArrayString objects are read-only and can be filled with the methods supplied with the ICEAttribute class.
using namespace XSI; Application app; X3DObject x3dObj = app.GetSelection().GetItem(0); ICEAttribute attr = x3dObj.GetActivePrimitive().GetGeometry().GetICEAttributeFromName( L"MyStringAttribute" ); // Log the data pointer address and size of data. CICEAttributeDataArrayString strData; attr.GetDataArray( strData ); for( ULONG i=0; i<strData.GetCount( ); i++ ) { ULONG nCount; const CICEAttributeDataArrayString::TData* pStr; strData.GetData( i, &pStr, nCount ); app.LogMessage( CString( pStr, nCount ) + L":" + CString( nCount ) ); }
Public Member Functions |
|
SICPPSDK_INLINE | CICEAttributeDataArrayString () |
SICPPSDK_INLINE | ~CICEAttributeDataArrayString () |
SICPPSDK_INLINE CStatus | GetData (ULONG in_index, const TData **out_ppStr, ULONG &out_nCount) const |
SICPPSDK_INLINE CStatus | GetData (ULONG in_index, CString &out_str) const |
SICPPSDK_INLINE CStatus | SetData (ULONG in_index, const CString &in_str) |
SICPPSDK_INLINE CString | operator[] (ULONG in_index) const |
CStatus | SetArray (const TData **in_ppData, ULONG in_count) |
SICPPSDK_INLINE CICEAttributeDataArrayString | ( | ) | [inline] |
Default Constructor.
SICPPSDK_INLINE ~CICEAttributeDataArrayString | ( | ) | [inline] |
Destructor.
CStatus GetData | ( | ULONG | in_index, |
const TData ** | out_ppStr, | ||
ULONG & | out_nCount | ||
) | const |
Returns a pointer to the string stored at a specific index. The data is read-only and cannot be modified.
out_ppStr
is not
null-terminated, the caller must make sure to take the number of
characters in account when manipulating the string.in_index | Array index of the user data to retrieve. The size is 0 if no data is stored at this index. |
out_ppStr | Read-only pointer to the data. |
out_nCount | Number of characters in the string. |
Returns a CString object set with a copy of the string stored at a specific index.
in_index | Array index of the string to retrieve. The object is empty if no string is stored at this index. |
out_str | Copy of the string. |
Accessor to string array 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. |
SICPPSDK_INLINE CString operator[] | ( | ULONG | in_index | ) | const |
CStatus SetArray | ( | const TData ** | in_ppData, |
ULONG | in_count | ||
) |
Set all the values in the string ICE attribute
in_ppData | Input string array. The strings must be null-terminated. |
in_count | Number of strings in the input array |
Application xsi; Model root = xsi.GetActiveSceneRoot(); X3DObject cone( CreatePrim( L"cone", L"MeshSurface", L"", L"") ); { ICEAttribute attr = cone.GetActivePrimitive().GetGeometry().AddICEAttribute( "DataArrayString", XSI::siICENodeDataString, XSI::siICENodeStructureSingle, XSI::siICENodeContextComponent0D ); CString l_connSet(L"cone"); ApplyOp( L"ICETree", l_connSet, siConstructionModeModeling ); AddICECompoundNode("Set Data", "cone.polymsh.ICETree"); AddICENode("$XSI_DSPRESETS\\ICENodes\\GetDataNode.Preset", "cone.polymsh.ICETree"); SetValue("cone.polymsh.ICETree.SceneReferenceNode.reference", "self.DataArrayString"); SetValue("cone.polymsh.ICETree.Set_Data.Reference", "self.foo"); ConnectICENodes("cone.polymsh.ICETree.Set_Data.Value", "cone.polymsh.ICETree.SceneReferenceNode.value"); ConnectICENodes("cone.polymsh.ICETree.port1", "cone.polymsh.ICETree.Set_Data.Execute"); DisplayPortValues("cone.polymsh.ICETree.Set_Data.Value", true, 0, true, "", 0, 0, 0, 1, false, true, 0.62, 1, 0.62, 1, false, 0, 10000, 1, false, false, 0, 10, false, true, false, 100); CICEAttributeDataArrayString data; attr.GetDataArray( data ); CICEAttributeDataLogger<CString>::Log( attr ); ULONG l_nbElem = attr.GetElementCount(); { typedef const wchar_t* RawWStringType; RawWStringType* l_Values = new RawWStringType[l_nbElem]; for (ULONG i=0; i<l_nbElem; i++) l_Values[i] = (i%2==0) ? L"odd" : L"even"; data.SetArray(l_Values, l_nbElem); CICEAttributeDataLogger<CString>::Log( attr ); delete[] l_Values; } // These have no effect since the reference returned by operator[] are only temporary data[0] = L"str 0"; // These work data.SetData(0, L"First string"); data.SetData(4, L"String value at index 4"); }