Definition in file fbxcolladaelement.h.
Classes |
|
| struct | ElementContentAccessor |
| A struct for convenient access to the
content of common COLLADA element. More... |
|
| struct | SourceElementContentAccessor< TYPE > |
| A struct for convenient access to the
content of COLLADA source element. More... |
|
| class | ElementBase |
| Representing a common COLLADA element.
More... |
|
Functions |
|
| template<typename T > | |
| const FbxString | TypeToArrayTag () |
| template<> | |
| const FbxString | TypeToArrayTag< bool > () |
| template<> | |
| const FbxString | TypeToArrayTag< int > () |
| template<> | |
| const FbxString | TypeToArrayTag< FbxString > () |
| template<typename T > | |
| const FbxString | TypeToParameterTag () |
| template<> | |
| const FbxString | TypeToParameterTag< bool > () |
| template<> | |
| const FbxString | TypeToParameterTag< int > () |
| template<> | |
| const FbxString | TypeToParameterTag< FbxString > () |
| const FbxString | URL (const FbxString &pID) |
| Convert from ID to URL, just add a prefix
"#". |
|
| template<typename T > | |
| xmlNode * | AddSourceElement (xmlNode *pParentElement, const char *pID, const T *pData, int pCount, int pStride=1) |
| Convert the array data to a source element
under specific parent element. |
|
| template<typename TYPE > | |
| FbxLayerElementArray * | PopulateLayerElementDirectArray (FbxLayerElement *pLayerElement, xmlNode *pSourceElement, int pSize) |
| Populate the layer element with direct array
and return index array for later use. |
|
| const FbxString TypeToArrayTag | ( | ) | [inline] |
Definition at line 22 of file fbxcolladaelement.h.
{
return COLLADA_FLOAT_ARRAY_STRUCTURE;
}
| const FbxString TypeToArrayTag< bool > | ( | ) | [inline] |
Definition at line 28 of file fbxcolladaelement.h.
{
return COLLADA_BOOL_ARRAY_STRUCTURE;
}
| const FbxString TypeToArrayTag< int > | ( | ) | [inline] |
Definition at line 34 of file fbxcolladaelement.h.
{
return COLLADA_INT_ARRAY_STRUCTURE;
}
Definition at line 40 of file fbxcolladaelement.h.
{
return COLLADA_NAME_ARRAY_STRUCTURE;
}
| const FbxString TypeToParameterTag | ( | ) | [inline] |
Definition at line 47 of file fbxcolladaelement.h.
{
return COLLADA_FLOAT_TYPE;
}
| const FbxString TypeToParameterTag< bool > | ( | ) | [inline] |
Definition at line 53 of file fbxcolladaelement.h.
{
return COLLADA_BOOL_TYPE;
}
| const FbxString TypeToParameterTag< int > | ( | ) | [inline] |
Definition at line 59 of file fbxcolladaelement.h.
{
return COLLADA_INT_TYPE;
}
Definition at line 65 of file fbxcolladaelement.h.
{
return COLLADA_NAME_TYPE;
}
Convert from ID to URL, just add a prefix "#".
| The | ID string. |
Definition at line 195 of file fbxcolladaelement.h.
{
return FbxString("#") + pID;
}
| xmlNode* AddSourceElement | ( | xmlNode * | pParentElement, |
| const char * | pID, | ||
| const T * | pData, | ||
| int | pCount, | ||
| int | pStride = 1 |
||
| ) |
Convert the array data to a source element under specific parent element.
| pParentElement | The parent element. |
| pID | The ID of the new source element. |
| pData | The array data. |
| pCount | The length of the array. |
| pStride | The stride of each unit in the array. For example, when you export an array of FbxDouble3 of size 10, you convert it to a double array of size 30 with a stride 3 and call this method. |
Definition at line 211 of file fbxcolladaelement.h.
{
FBX_ASSERT(pParentElement && pData);
if (!pParentElement || !pData)
return NULL;
xmlNode * lSourceElement = DAE_AddChildElement(pParentElement, COLLADA_SOURCE_STRUCTURE);
DAE_AddAttribute(lSourceElement, COLLADA_ID_PROPERTY, pID);
FbxString lContent;
const int lDataCount = pCount * pStride;
for (int lIndex = 0; lIndex < lDataCount; ++lIndex)
{
lContent += ToString(pData[lIndex]);
if (lIndex != lDataCount - 1)
lContent += " ";
}
const FbxString lArrayID = FbxString(pID) + "-array";
xmlNode * lArrayElement = DAE_AddChildElement(lSourceElement, TypeToArrayTag<T>(), lContent);
DAE_AddAttribute(lArrayElement, COLLADA_ID_PROPERTY, lArrayID);
DAE_AddAttribute(lArrayElement, COLLADA_COUNT_PROPERTY, lDataCount);
xmlNode * lTechniqueCommonElement = DAE_AddChildElement(lSourceElement,
COLLADA_TECHNIQUE_COMMON_ELEMENT);
xmlNode * lAccessElement = DAE_AddChildElement(lTechniqueCommonElement,
COLLADA_ACCESSOR_STRUCTURE);
DAE_AddAttribute(lAccessElement, COLLADA_SOURCE_PROPERTY, URL(lArrayID));
DAE_AddAttribute(lAccessElement, COLLADA_COUNT_PROPERTY, pCount);
DAE_AddAttribute(lAccessElement, COLLADA_STRIDE_PROPERTY, pStride);
for (int lStrideIndex = 0; lStrideIndex < pStride; ++lStrideIndex)
{
xmlNode * lParamElement = DAE_AddChildElement(lAccessElement, COLLADA_PARAMETER_STRUCTURE);
DAE_AddAttribute(lParamElement, COLLADA_TYPE_PROPERTY, TypeToParameterTag<T>());
}
return lSourceElement;
}
| FbxLayerElementArray* PopulateLayerElementDirectArray | ( | FbxLayerElement * | pLayerElement, |
| xmlNode * | pSourceElement, | ||
| int | pSize | ||
| ) |
Populate the layer element with direct array and return index array for later use.
| pLayerElement | The layer element to be populated. |
| pSourceElement | The source element containing the direct array data. |
| pSize | The count of double data of direct array element. |
Definition at line 257 of file fbxcolladaelement.h.
{
SourceElementContentAccessor<TYPE> lSourceElementAccessor(pSourceElement);
FbxLayerElementTemplate<TYPE> * lLayerElement = (FbxLayerElementTemplate<TYPE> *)pLayerElement;
lLayerElement->SetMappingMode(FbxLayerElement::eByPolygonVertex);
lLayerElement->SetReferenceMode(FbxLayerElement::eIndexToDirect);
lLayerElement->GetDirectArray().SetCount(lSourceElementAccessor.mCount);
TYPE * lArray = NULL;
lArray = lLayerElement->GetDirectArray().GetLocked(lArray);
lSourceElementAccessor.GetArray((double *)lArray, 0, pSize,
lSourceElementAccessor.mStride, 0, pSize, sizeof(TYPE)/sizeof(double), 1.0);
lLayerElement->GetDirectArray().Release(&lArray, lArray);
return &(lLayerElement->GetIndexArray());
}