FbxLayerElementTemplate< Type > Class Template 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 1015 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

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

1024  {
1025  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1026  return *mDirectArray;
1027  }
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 1033 of file fbxlayer.h.

1034  {
1035  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1036  return *mDirectArray;
1037  }
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 1043 of file fbxlayer.h.

1044  {
1045  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1046  return *mIndexArray;
1047  }
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 1053 of file fbxlayer.h.

1054  {
1055  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1056  return *mIndexArray;
1057  }
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 1063 of file fbxlayer.h.

1064  {
1065  bool ret = true;
1066  mDirectArray->Clear();
1067  ret = (mDirectArray->GetStatus() == LockAccessStatus::eSuccess);
1068 
1069  mIndexArray->Clear();
1070  ret |= (mIndexArray->GetStatus() == LockAccessStatus::eSuccess);
1071 
1072  return ret;
1073  }
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 1081 of file fbxlayer.h.

1082  {
1083  bool ret = true;
1084 
1085  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1087  {
1088  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1089  if( directArray.GetCount() != mDirectArray->GetCount() ||
1090  !directArray.ReadLock() || !mDirectArray->ReadLock() )
1091  {
1092  ret = false;
1093  }
1094 
1095  if( ret && !mDirectArray->IsEqual(directArray) )
1096  ret = false;
1097 
1098  directArray.ReadUnlock();
1099  mDirectArray->ReadUnlock();
1100  }
1101 
1102  if (ret)
1103  {
1104  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1106  {
1107  const FbxLayerElementArrayTemplate<int>& indexArray = pOther.GetIndexArray();
1108  if( indexArray.GetCount() != mIndexArray->GetCount() ||
1109  !indexArray.ReadLock() || !mIndexArray->ReadLock() )
1110  {
1111  ret = false;
1112  }
1113 
1114  if( ret && !mIndexArray->IsEqual(indexArray) )
1115  ret = false;
1116 
1117  indexArray.ReadUnlock();
1118  mIndexArray->ReadUnlock();
1119  }
1120  }
1121 
1122  if (ret == false)
1123  return false;
1124 
1125  return FbxLayerElement::operator==(pOther);
1126  }
FbxLayerElementArrayTemplate< int > & GetIndexArray() const
Returns the index array of Layer Elements.
Definition: fbxlayer.h:1043
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:851
FbxLayerElementArrayTemplate< Type > & GetDirectArray() const
Returns the direct array of Layer Elements.
Definition: fbxlayer.h:1023
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 1131 of file fbxlayer.h.

1132  {
1133  FBX_ASSERT(mDirectArray != NULL);
1134  FBX_ASSERT(mIndexArray != NULL);
1135 
1136  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1137  pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)
1138  {
1139  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1140  *mDirectArray = directArray;
1141  }
1142 
1143  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1144  pOther.GetReferenceMode() == FbxLayerElement::eIndexToDirect)
1145  {
1146  const FbxLayerElementArrayTemplate<int>& indexArray = pOther.GetIndexArray();
1147  *mIndexArray = indexArray;
1148  }
1149 
1150  FbxLayerElement* myself = (FbxLayerElement*)this;
1151  FbxLayerElement* myOther = (FbxLayerElement*)&pOther;
1152  *myself = *myOther;
1153  return *this;
1154  }
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:851
#define NULL
Definition: fbxarch.h:210
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 1163 of file fbxlayer.h.

1164  {
1165  return RemapIndexArrayTo(this, pNewMapping, mIndexArray);
1166  }
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: