FBX C++ API Reference
SourceElementContentAccessor< TYPE > Struct Template Reference

A struct for convenient access to the content of COLLADA source element. More...

#include <fbxcolladaelement.h>

+ Inheritance diagram for SourceElementContentAccessor< TYPE >:

Public Member Functions

 SourceElementContentAccessor (xmlNode *pSourceElement)
 
- Public Member Functions inherited from ElementContentAccessor
 ElementContentAccessor ()
 
 ElementContentAccessor (xmlNode *pElement)
 
virtual ~ElementContentAccessor ()
 
template<typename TYPE >
bool GetNext (TYPE *pData)
 
template<typename TYPE >
int GetArray (TYPE *pArray, int pArraySize, int pSourceUnitOffset=0, int pSourceUnitValidCount=1, int pSourceUnitSize=1, int pDestUnitOffset=0, int pDestUnitValidCount=1, int pDestUnitSize=1, TYPE pDefaultValue=TYPE())
 

Public Attributes

int mCount
 
int mStride
 
int mOffset
 
bool mInconsistent
 
- Public Attributes inherited from ElementContentAccessor
xmlChar * mContent
 
const char * mPointer
 

Detailed Description

template<typename TYPE>
struct SourceElementContentAccessor< TYPE >

A struct for convenient access to the content of COLLADA source element.

Definition at line 110 of file fbxcolladaelement.h.

Constructor & Destructor Documentation

SourceElementContentAccessor ( xmlNode *  pSourceElement)
inline

Definition at line 112 of file fbxcolladaelement.h.

113  : mCount(0), mStride(1), mOffset(0), mInconsistent(false)
114  {
115  bool lReadCount = true;
116  xmlNode* lTechniqueElement = DAE_FindChildElementByTag(pSourceElement, COLLADA_TECHNIQUE_COMMON_ELEMENT);
117  if (lTechniqueElement)
118  {
119  xmlNode* lAccessorElement = DAE_FindChildElementByTag(lTechniqueElement, COLLADA_ACCESSOR_STRUCTURE);
120  if (lAccessorElement)
121  {
125  }
126  lReadCount = false;
127  }
128 
129  xmlNode * lDataArrayElement = DAE_FindChildElementByTag(pSourceElement, TypeToArrayTag<TYPE>());
130  // Some COLLADA exporters use IDREF_array instead of Name_array
131  if (!lDataArrayElement && TypeToArrayTag<TYPE>() == COLLADA_NAME_ARRAY_STRUCTURE)
132  lDataArrayElement = DAE_FindChildElementByTag(pSourceElement, COLLADA_IDREF_ARRAY_STRUCTURE);
133  FBX_ASSERT(lDataArrayElement);
134 
135  if (lDataArrayElement)
136  {
137  int arrayCount = 0;
138  DAE_GetElementAttributeValue(lDataArrayElement, COLLADA_COUNT_PROPERTY, arrayCount);
139  if (arrayCount > 0 && mCount > 0)
140  {
141  // validate that the numbers we get from the 'technique' make sense for the array
142  int s = arrayCount / mCount;
143  mInconsistent = (s != mStride);
144  }
145 
146  if (lReadCount)
147  mCount = arrayCount;
148  }
149 
150  mContent = xmlNodeGetContent(lDataArrayElement);
151  mPointer = (const char *)mContent;
152  }
#define COLLADA_ACCESSOR_STRUCTURE
#define COLLADA_COUNT_PROPERTY
#define COLLADA_STRIDE_PROPERTY
#define COLLADA_OFFSET_PROPERTY
#define COLLADA_IDREF_ARRAY_STRUCTURE
#define COLLADA_NAME_ARRAY_STRUCTURE
const FbxString DAE_GetElementAttributeValue(xmlNode *pElement, const char *pAttributeName)
Get the value of an attribute of an element.
#define COLLADA_TECHNIQUE_COMMON_ELEMENT
xmlNode * DAE_FindChildElementByTag(xmlNode *pParentElement, const char *pTag, xmlNode *pFindFrom=((void *) 0))
Find a child element with a given tag.

Member Data Documentation

int mCount

Definition at line 154 of file fbxcolladaelement.h.

int mStride

Definition at line 155 of file fbxcolladaelement.h.

int mOffset

Definition at line 156 of file fbxcolladaelement.h.

bool mInconsistent

Definition at line 157 of file fbxcolladaelement.h.


The documentation for this struct was generated from the following file: