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

#include <fbxlayer.h>

Class 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.

Definition at line 1022 of file 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...
 

Member Function Documentation

◆ GetDirectArray() [1/2]

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 1030 of file fbxlayer.h.

1031  {
1032  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1033  return *mDirectArray;
1034  }

◆ GetDirectArray() [2/2]

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 1040 of file fbxlayer.h.

1041  {
1042  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1043  return *mDirectArray;
1044  }

◆ GetIndexArray() [1/2]

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 1050 of file fbxlayer.h.

1051  {
1052  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1053  return *mIndexArray;
1054  }

◆ GetIndexArray() [2/2]

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 1060 of file fbxlayer.h.

1061  {
1062  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1063  return *mIndexArray;
1064  }

◆ Clear()

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 1070 of file fbxlayer.h.

1071  {
1072  bool ret = true;
1073  mDirectArray->Clear();
1074  ret = (mDirectArray->GetStatus() == LockAccessStatus::eSuccess);
1075 
1076  mIndexArray->Clear();
1077  ret |= (mIndexArray->GetStatus() == LockAccessStatus::eSuccess);
1078 
1079  return ret;
1080  }

◆ operator==()

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 1088 of file fbxlayer.h.

1089  {
1090  bool ret = true;
1091 
1092  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1094  {
1095  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1096  if( directArray.GetCount() != mDirectArray->GetCount() ||
1097  !directArray.ReadLock() || !mDirectArray->ReadLock() )
1098  {
1099  ret = false;
1100  }
1101 
1102  if( ret && !mDirectArray->IsEqual(directArray) )
1103  ret = false;
1104 
1105  directArray.ReadUnlock();
1106  mDirectArray->ReadUnlock();
1107  }
1108 
1109  if (ret)
1110  {
1111  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1113  {
1114  const FbxLayerElementArrayTemplate<int>& indexArray = pOther.GetIndexArray();
1115  if( indexArray.GetCount() != mIndexArray->GetCount() ||
1116  !indexArray.ReadLock() || !mIndexArray->ReadLock() )
1117  {
1118  ret = false;
1119  }
1120 
1121  if( ret && !mIndexArray->IsEqual(indexArray) )
1122  ret = false;
1123 
1124  indexArray.ReadUnlock();
1125  mIndexArray->ReadUnlock();
1126  }
1127  }
1128 
1129  if (ret == false)
1130  return false;
1131 
1132  return FbxLayerElement::operator==(pOther);
1133  }
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:858
int ReadUnlock() const
Releases a read lock on this array.
int GetCount() const
Returns the count of items in the data buffer.
int ReadLock() const
Increments the number of read locks on this array.
FbxLayerElementArrayTemplate< int > & GetIndexArray() const
Returns the index array of Layer Elements.
Definition: fbxlayer.h:1050
FbxLayerElementArrayTemplate< Type > & GetDirectArray() const
Returns the direct array of Layer Elements.
Definition: fbxlayer.h:1030
EReferenceMode GetReferenceMode() const
Returns the Reference Mode.
Definition: fbxlayer.h:189
bool operator==(const FbxLayerElement &pOther) const
Equivalence operator.
Definition: fbxlayer.h:205

◆ operator=()

FbxLayerElementTemplate& operator= ( FbxLayerElementTemplate< Type > const &  pOther)
inline

Assignment operator.

Parameters
pOtherAnother element assigned to this one

Definition at line 1138 of file fbxlayer.h.

1139  {
1140  FBX_ASSERT(mDirectArray != NULL);
1141  FBX_ASSERT(mIndexArray != NULL);
1142 
1143  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1144  pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)
1145  {
1146  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1147  *mDirectArray = directArray;
1148  }
1149 
1150  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1151  pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)
1152  {
1153  const FbxLayerElementArrayTemplate<int>& indexArray = pOther.GetIndexArray();
1154  *mIndexArray = indexArray;
1155  }
1156 
1157  FbxLayerElement* myself = (FbxLayerElement*)this;
1158  FbxLayerElement* myOther = (FbxLayerElement*)&pOther;
1159  *myself = *myOther;
1160  return *this;
1161  }
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:858
#define NULL
Definition: fbxarch.h:210
Base class for elements of layers (FbxLayer).
Definition: fbxlayer.h:38

◆ RemapIndexTo()

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 1170 of file fbxlayer.h.

1171  {
1172  return RemapIndexArrayTo(this, pNewMapping, mIndexArray);
1173  }
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: