FBX C++ API Reference
FbxLayerElementTemplate< Type > Class Template Reference

This class complements the FbxLayerElement class. More...

#include <fbxlayer.h>

+ Inheritance diagram for FbxLayerElementTemplate< Type >:

Public Member Functions

FbxLayerElementArrayTemplate< Type > & GetDirectArray () const
 Returns the direct array of Layer Elements. More...
 
FbxLayerElementArrayTemplate< Type > & GetDirectArray ()
 Returns the direct array of Layer Elements. More...
 
FbxLayerElementArrayTemplate< int > & GetIndexArray () const
 Returns the index array of Layer Elements. More...
 
FbxLayerElementArrayTemplate< int > & GetIndexArray ()
 Returns the index array of Layer Elements. More...
 
bool Clear ()
 Removes all elements from the direct and the index arrays. More...
 
bool operator== (const FbxLayerElementTemplate &pOther) const
 Equivalence operator. More...
 
FbxLayerElementTemplateoperator= (FbxLayerElementTemplate const &pOther)
 Assignment operator. More...
 
int RemapIndexTo (FbxLayerElement::EMappingMode pNewMapping)
 Changes the Mapping mode to the new one and re-computes the index array. More...
 
- Public Member Functions inherited from FbxLayerElement
void SetMappingMode (EMappingMode pMappingMode)
 Sets the Mapping Mode. More...
 
void SetReferenceMode (EReferenceMode pReferenceMode)
 Sets the Reference Mode. More...
 
EMappingMode GetMappingMode () const
 Returns the Mapping Mode. More...
 
EReferenceMode GetReferenceMode () const
 Returns the Reference Mode. More...
 
void SetName (const char *pName)
 Sets the name of this object. More...
 
const char * GetName () const
 Returns the name of this object. More...
 
bool operator== (const FbxLayerElement &pOther) const
 Equivalence operator. More...
 
FbxLayerElementoperator= (FbxLayerElement const &pOther)
 Assignment operator. More...
 
void Destroy ()
 Removes this layer element from its owner and delete it. More...
 

Additional Inherited Members

- Public Types inherited from FbxLayerElement
enum  EType {
  eUnknown, eNormal, eBiNormal, eTangent,
  eMaterial, ePolygonGroup, eUV, eVertexColor,
  eSmoothing, eVertexCrease, eEdgeCrease, eHole,
  eUserData, eVisibility, eTextureDiffuse, eTextureDiffuseFactor,
  eTextureEmissive, eTextureEmissiveFactor, eTextureAmbient, eTextureAmbientFactor,
  eTextureSpecular, eTextureSpecularFactor, eTextureShininess, eTextureNormalMap,
  eTextureBump, eTextureTransparency, eTextureTransparencyFactor, eTextureReflection,
  eTextureReflectionFactor, eTextureDisplacement, eTextureDisplacementVector, eTypeCount
}
 Layer Element type identifier. More...
 
enum  EMappingMode {
  eNone, eByControlPoint, eByPolygonVertex, eByPolygon,
  eByEdge, eAllSame
}
 Determines how the element is mapped to a surface. More...
 
enum  EReferenceMode { eDirect, eIndex, eIndexToDirect }
 Determines how the mapping information is stored in the array of coordinates. More...
 
- Static Public Attributes inherited from FbxLayerElement
static const int sTypeTextureStartIndex = int(eTextureDiffuse)
 The start index of texture type layer elements. More...
 
static const int sTypeTextureEndIndex = int(eTypeCount) - 1
 The end index of texture type layer elements. More...
 
static const int sTypeTextureCount = sTypeTextureEndIndex - sTypeTextureStartIndex + 1
 The count of texture type layer elements. More...
 
static const int sTypeNonTextureStartIndex = int(eNormal)
 The start index of non-texture type layer elements. More...
 
static const int sTypeNonTextureEndIndex = int(eVisibility)
 The end index of non-texture type layer elements. More...
 
static const int sTypeNonTextureCount = sTypeNonTextureEndIndex - sTypeNonTextureStartIndex + 1
 The count of non-texture type layer elements. More...
 
static const char *const sTextureNames []
 Array of names of texture type layer elements. More...
 
static const char *const sTextureUVNames []
 Array of names of UV layer elements. More...
 
static const char *const sNonTextureNames []
 Array of names of non-texture type layer elements. More...
 
static const FbxDataType sTextureDataTypes []
 Array of texture types. More...
 
static const char *const sTextureChannelNames []
 Array of texture channels. More...
 

Detailed Description

template<class Type>
class FbxLayerElementTemplate< Type >

This class complements the FbxLayerElement class.

It provides interfaces to access the direct array and index array of different layer elements.

Examples:
ImportScene/DisplayShape.cxx.

Definition at line 1042 of file fbxlayer.h.

Member Function Documentation

FbxLayerElementArrayTemplate<Type>& GetDirectArray ( ) const
inline

Returns the direct array of Layer Elements.

Returns
A reference to the Layer Elements direct array.
Remarks
You cannot put elements in the direct array when the reference mode is set to eIndex.

Definition at line 1050 of file fbxlayer.h.

1051  {
1052  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1053  return *mDirectArray;
1054  }
FbxLayerElementArrayTemplate<Type>& GetDirectArray ( )
inline

Returns the direct array of Layer Elements.

Returns
A reference to the Layer Elements direct array.
Remarks
You cannot put elements in the direct array when the reference mode is set to eIndex.

Definition at line 1060 of file fbxlayer.h.

1061  {
1062  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1063  return *mDirectArray;
1064  }
FbxLayerElementArrayTemplate<int>& GetIndexArray ( ) const
inline

Returns the index array of Layer Elements.

Returns
A reference to the index array.
Remarks
You cannot put elements in the index array when the mapping mode is set to eDirect.

Definition at line 1070 of file fbxlayer.h.

1071  {
1072  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1073  return *mIndexArray;
1074  }
FbxLayerElementArrayTemplate<int>& GetIndexArray ( )
inline

Returns the index array of Layer Elements.

Returns
A reference to the index array.
Remarks
You cannot put elements in the index array when the mapping mode is set to eDirect.

Definition at line 1080 of file fbxlayer.h.

1081  {
1082  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1083  return *mIndexArray;
1084  }
bool Clear ( )
inlinevirtual

Removes all elements from the direct and the index arrays.

Remarks
This function fails if there is a lock on the arrays.
Returns
True if successful, false if a lock is present.

Reimplemented from FbxLayerElement.

Definition at line 1090 of file fbxlayer.h.

1091  {
1092  bool ret = true;
1093  mDirectArray->Clear();
1094  ret = (mDirectArray->GetStatus() == LockAccessStatus::eSuccess);
1095 
1096  mIndexArray->Clear();
1097  ret |= (mIndexArray->GetStatus() == LockAccessStatus::eSuccess);
1098 
1099  return ret;
1100  }
bool operator== ( const FbxLayerElementTemplate< Type > &  pOther) const
inline

Equivalence operator.

Parameters
pOtherAnother element compared to this object
Returns
True if equal, false if unequal.

Definition at line 1108 of file fbxlayer.h.

1109  {
1110  bool ret = true;
1111 
1112  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1114  {
1115  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1116  if( directArray.GetCount() != mDirectArray->GetCount() ||
1117  !directArray.ReadLock() || !mDirectArray->ReadLock() )
1118  {
1119  ret = false;
1120  }
1121 
1122  if( ret && !mDirectArray->IsEqual(directArray) )
1123  ret = false;
1124 
1125  directArray.ReadUnlock();
1126  mDirectArray->ReadUnlock();
1127  }
1128 
1129  if (ret)
1130  {
1131  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1133  {
1134  const FbxLayerElementArrayTemplate<int>& indexArray = pOther.GetIndexArray();
1135  if( indexArray.GetCount() != mIndexArray->GetCount() ||
1136  !indexArray.ReadLock() || !mIndexArray->ReadLock() )
1137  {
1138  ret = false;
1139  }
1140 
1141  if( ret && !mIndexArray->IsEqual(indexArray) )
1142  ret = false;
1143 
1144  indexArray.ReadUnlock();
1145  mIndexArray->ReadUnlock();
1146  }
1147  }
1148 
1149  if (ret == false)
1150  return false;
1151 
1152  return FbxLayerElement::operator==(pOther);
1153  }
FbxLayerElementArrayTemplate< int > & GetIndexArray() const
Returns the index array of Layer Elements.
Definition: fbxlayer.h:1070
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:868
FbxLayerElementArrayTemplate< Type > & GetDirectArray() const
Returns the direct array of Layer Elements.
Definition: fbxlayer.h:1050
bool operator==(const FbxLayerElement &pOther) const
Equivalence operator.
Definition: fbxlayer.h:205
int ReadLock() const
Increments the number of read locks on this array.
int GetCount() const
Returns the count of items in the data buffer.
int ReadUnlock() const
Releases a read lock on this array.
EReferenceMode GetReferenceMode() const
Returns the Reference Mode.
Definition: fbxlayer.h:189
FbxLayerElementTemplate& operator= ( FbxLayerElementTemplate< Type > const &  pOther)
inline

Assignment operator.

Parameters
pOtherAnother element assigned to this one

Definition at line 1158 of file fbxlayer.h.

1159  {
1160  FBX_ASSERT(mDirectArray != NULL);
1161  FBX_ASSERT(mIndexArray != NULL);
1162 
1163  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1164  pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)
1165  {
1166  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1167  *mDirectArray = directArray;
1168  }
1169 
1170  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1171  pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)
1172  {
1173  const FbxLayerElementArrayTemplate<int>& indexArray = pOther.GetIndexArray();
1174  *mIndexArray = indexArray;
1175  }
1176 
1177  FbxLayerElement* myself = (FbxLayerElement*)this;
1178  FbxLayerElement* myOther = (FbxLayerElement*)&pOther;
1179  *myself = *myOther;
1180  return *this;
1181  }
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:868
#define NULL
Definition: fbxarch.h:213
Base class for elements of layers (FbxLayer).
Definition: fbxlayer.h:38
int RemapIndexTo ( FbxLayerElement::EMappingMode  pNewMapping)
inline

Changes the Mapping mode to the new one and re-computes the index array.

Parameters
pNewMappingNew mapping mode.
Returns
If the remapping is successful, returns 1. If an error occurs, returns 0. In case the function cannot remap to the desired mode because of incompatible modes or unsupported modes, returns -1.

Definition at line 1190 of file fbxlayer.h.

1191  {
1192  return RemapIndexArrayTo(this, pNewMapping, mIndexArray);
1193  }
int RemapIndexArrayTo(FbxLayerElement *pLayerEl, FbxLayerElement::EMappingMode pNewMapping, FbxLayerElementArrayTemplate< int > *pIndexArray)
Remap the index array to a new EMappingMode.

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