fbxsdk/scene/geometry/fbxlayer.h Source File

fbxlayer.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_SCENE_GEOMETRY_LAYER_H_
14 #define _FBXSDK_SCENE_GEOMETRY_LAYER_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
19 #include <fbxsdk/core/fbxstream.h>
22 
23 #include <fbxsdk/fbxsdk_nsbegin.h>
24 
26 class FbxLayerContainer;
27 
39 {
40 public:
75  enum EType
76  {
78 
79  //Non-Texture layer element types
80  //Note: Make sure to update static index below if you change this enum!
86  eUV,
94 
95  //Texture layer element types
96  //Note: Make sure to update static index below if you change this enum!
114 
115  eTypeCount
116  };
117 
118  const static int sTypeTextureStartIndex = int(eTextureDiffuse);
119  const static int sTypeTextureEndIndex = int(eTypeCount) - 1;
120  const static int sTypeTextureCount = sTypeTextureEndIndex - sTypeTextureStartIndex + 1;
121  const static int sTypeNonTextureStartIndex = int(eNormal);
122  const static int sTypeNonTextureEndIndex = int(eVisibility);
123  const static int sTypeNonTextureCount = sTypeNonTextureEndIndex - sTypeNonTextureStartIndex + 1;
124  static const char* const sTextureNames[];
125  static const char* const sTextureUVNames[];
126  static const char* const sNonTextureNames[];
127  static const FbxDataType sTextureDataTypes[];
128  static const char* const sTextureChannelNames[];
129 
141  {
147  eAllSame
148  };
149 
164  {
167  eIndexToDirect
168  };
169 
170 
174  void SetMappingMode(EMappingMode pMappingMode) { mMappingMode = pMappingMode; }
175 
179  void SetReferenceMode(EReferenceMode pReferenceMode) { mReferenceMode = pReferenceMode; }
180 
184  EMappingMode GetMappingMode() const { return mMappingMode; }
185 
189  EReferenceMode GetReferenceMode() const { return mReferenceMode; }
190 
194  void SetName(const char* pName) { mName = FbxString(pName); }
195 
199  const char* GetName() const { return ((FbxLayerElement*)this)->mName.Buffer(); }
200 
205  bool operator==(const FbxLayerElement& pOther) const
206  {
207  return (mName == pOther.mName) &&
208  (mMappingMode == pOther.mMappingMode) &&
209  (mReferenceMode == pOther.mReferenceMode);
210  }
211 
217  {
218  mMappingMode = pOther.mMappingMode;
219  mReferenceMode = pOther.mReferenceMode;
220  // name, type and owner should not be copied because they are
221  // initialized when this object is created
222  return *this;
223  }
224 
226  void Destroy();
227 
229  virtual bool Clear()
230  {
231  return true;
232  }
233 
234 /*****************************************************************************************************************************
235 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
236 *****************************************************************************************************************************/
237 #ifndef DOXYGEN_SHOULD_SKIP_THIS
238  void SetType(const FbxDataType* pType) { mType = pType; }
239  const FbxLayerContainer* GetOwner() const { return mOwner; }
240 
241 protected:
242  FbxLayerElement()
243  : mMappingMode(eNone)
244  , mReferenceMode(eDirect)
245  , mName("")
246  , mOwner(NULL)
247  {
248  }
249 
250  virtual ~FbxLayerElement()
251  {
252  }
253 
254  EMappingMode mMappingMode;
255  EReferenceMode mReferenceMode;
256 
257  FbxString mName;
258  const FbxDataType* mType;
259  FbxLayerContainer* mOwner;
260 
261  void Destruct() { FbxDelete(this); }
262  virtual void SetOwner(FbxLayerContainer* pOwner, int pInstance = 0);
263 
265 
266 public:
267  virtual int MemorySize() const { return 0; }
268  virtual bool ContentWriteTo(FbxStream& pStream) const;
269  virtual bool ContentReadFrom(const FbxStream& pStream);
270 
271  friend class FbxLayerContainer;
272 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
273 };
274 
281 {
282 public:
296  {
305  eDirectLockExist
306  };
307 };
308 
309 //Special conversion types, we do not want them to resolve to undefined.
310 typedef FbxHandle* FbxRefPtr;
314 
315 inline EFbxType FbxTypeOf(const FbxRefPtr&){ return eFbxReference; }
319 
326 {
327 public:
332 
336  FbxLayerElementArray(EFbxType pDataType);
337 
339  virtual ~FbxLayerElementArray();
340 
342 
347 
349  inline void ClearStatus() { mStatus = LockAccessStatus::eSuccess; }
350 
352  inline LockAccessStatus::ELockAccessStatus GetStatus() const { return mStatus; }
354 
359 
363  inline bool IsWriteLocked() const { return mWriteLock; };
364 
368  inline int GetReadLockCount() const { return mReadLockCount; }
370 
374  bool IsInUse() const;
375 
379  int ReadLock() const;
380 
384  int ReadUnlock() const;
385 
390  bool WriteLock() const;
391 
394  void WriteUnlock() const;
395 
400  bool ReadWriteLock() const;
401 
404  void ReadWriteUnlock() const;
405 
406 
413  {
414  eReadLock = 1,
415  eWriteLock = 2,
416  eReadWriteLock = 3
417  };
418 
431  virtual void* GetLocked(ELockMode pLockMode, EFbxType pDataType);
432 
444  void* GetLocked(ELockMode pLockMode=eReadWriteLock) { return GetLocked(pLockMode, mDataType); }
445 
457  template <class T> inline T* GetLocked(T*, ELockMode pLockMode=eReadWriteLock) {T v; return (T*)GetLocked(pLockMode, FbxTypeOf(v)); }
458 
469  virtual void Release(void** pDataPtr, EFbxType pDataType);
470 
480  void Release(void** pDataPtr) { Release(pDataPtr, mDataType); }
481 
492  template <class T> inline void Release(T** pDataPtr, T* dummy)
493  {
494  T*** voidPtr = &pDataPtr;
495  Release((void**)*voidPtr, FbxTypeOf(*dummy));
496  }
497 
500  virtual size_t GetStride() const;
501 
506 
508  int GetCount() const;
509 
513  void SetCount(int pCount);
514 
516  void Clear();
517 
521  void Resize(int pItemCount);
522 
526  void AddMultiple(int pItemCount);
527 
533  int Add(const void* pItem, EFbxType pValueType);
534 
542  int InsertAt(int pIndex, const void* pItem, EFbxType pValueType);
543 
550  void SetAt(int pIndex, const void* pItem, EFbxType pValueType);
551 
557  void SetLast(const void* pItem, EFbxType pValueType);
558 
565  void RemoveAt(int pIndex, void** pItem, EFbxType pValueType);
566 
572  void RemoveLast(void** pItem, EFbxType pValueType);
573 
579  bool RemoveIt(void** pItem, EFbxType pValueType);
580 
588  bool GetAt(int pIndex, void** pItem, EFbxType pValueType) const;
589 
595  bool GetFirst(void** pItem, EFbxType pValueType) const;
596 
602  bool GetLast(void** pItem, EFbxType pValueType) const;
603 
610  int Find(const void* pItem, EFbxType pValueType) const;
611 
619  int FindAfter(int pAfterIndex, const void* pItem, EFbxType pValueType) const;
620 
628  int FindBefore(int pBeforeIndex, const void* pItem, EFbxType pValueType) const;
629 
634  bool IsEqual(const FbxLayerElementArray& pArray) const;
635 
640  template <class T> inline int Add(T const& pItem) { return Add((const void*)&pItem, FbxTypeOf(pItem)); }
641 
648  template <class T> inline int InsertAt(int pIndex, T const& pItem) { return InsertAt(pIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
649 
655  template <class T> inline void SetAt(int pIndex, T const& pItem) { SetAt(pIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
656 
661  template <class T> inline void SetLast(T const& pItem) { SetLast((const void*)&pItem, FbxTypeOf(pItem)); }
662 
668  template <class T> inline void RemoveAt(int pIndex, T* pItem)
669  {
670  T** voidPtr = &pItem;
671  RemoveAt(pIndex, (void**)voidPtr, FbxTypeOf(*pItem));
672  }
673 
678  template <class T> inline void RemoveLast(T* pItem)
679  {
680  T** voidPtr = &pItem;
681  RemoveLast((void**)voidPtr, FbxTypeOf(*pItem));
682  }
683 
688  template <class T> inline bool RemoveIt(T* pItem)
689  {
690  T** voidPtr = &pItem;
691  return RemoveIt((void**)voidPtr, FbxTypeOf(*pItem));
692  }
693 
700  template <class T> inline bool GetAt(int pIndex, T* pItem) const
701  {
702  T** voidPtr = &pItem;
703  return GetAt(pIndex, (void**)voidPtr, FbxTypeOf(*pItem));
704  }
705 
710  template <class T> inline bool GetFirst(T* pItem) const
711  {
712  T** voidPtr = &pItem;
713  return GetFirst((void**)voidPtr, FbxTypeOf(*pItem));
714  }
715 
720  template <class T> inline bool GetLast(T* pItem) const
721  {
722  T** voidPtr = &pItem;
723  return GetLast((void**)voidPtr, FbxTypeOf(*pItem));
724  }
725 
731  template <class T> inline int Find(T const& pItem) const { return Find((const void*)&pItem, FbxTypeOf(pItem)); }
732 
739  template <class T> inline int FindAfter(int pAfterIndex, T const& pItem) const { return FindAfter(pAfterIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
740 
747  template <class T> inline int FindBefore(int pBeforeIndex, T const& pItem) const { return FindBefore(pBeforeIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
748 
749 
753  template<typename T> inline void CopyTo(FbxArray<T>& pDst)
754  {
755  T src;
756  T* srcPtr = &src;
757 
758  pDst.Clear();
759  if (mDataType != FbxTypeOf(src))
760  {
762  return;
763  }
764 
765  pDst.Resize(GetCount());
766  for (int i = 0; i < GetCount(); i++)
767  {
768  if (GetAt(i, (void**)&srcPtr, mDataType))
769  {
770  pDst.SetAt(i, src);
771  }
772  }
773  SetStatus(LockAccessStatus::eSuccess);
774  }
776 
777 protected:
778  void* GetDataPtr();
779  void* GetReference(int pIndex, EFbxType pValueType);
780  void GetReferenceTo(int pIndex, void** pRef, EFbxType pValueType);
781 
783  {
784  const_cast<FbxLayerElementArray*>(this)->mStatus = pVal;
785  }
786 
787  void SetImplementation(void* pImplementation);
788  inline void* GetImplementation() { return mImplementation; }
789  virtual void ConvertDataType(EFbxType pDataType, void** pDataPtr, size_t* pStride);
790 
792 
793 private:
795 
796  int mReadLockCount;
797  bool mWriteLock;
798  void* mImplementation;
799  size_t mStride;
800  int mDirectLockOn;
801  bool mDirectAccessOn;
802 
803  FbxArray<void*> mConvertedData;
804 
805 };
806 
810 template <typename T>
812 {
817  {
818  mLockedData = mArray.GetLocked((T*)NULL, FbxLayerElementArray::eReadLock);
819  }
820 
825  {
826  if( mLockedData )
827  {
828  mArray.Release((void **) &mLockedData);
829  }
830  }
831 
835  const T* GetData() const
836  {
837  return mLockedData;
838  }
839 
840 private:
841  FbxLayerElementArray& mArray;
842  T* mLockedData;
843 };
844 
846 
851 template <class T> class FbxLayerElementArrayTemplate : public FbxLayerElementArray
852 {
853 public:
854 
859  FbxLayerElementArray(pDataType)
860  {
861  }
862 
867  inline int Add( T const &pItem ) { return FbxLayerElementArray::Add(pItem); }
868 
874  inline int InsertAt(int pIndex, T const &pItem) { return FbxLayerElementArray::InsertAt(pIndex, pItem); }
875 
880  inline void SetAt(int pIndex, T const &pItem) { FbxLayerElementArray::SetAt(pIndex, pItem); }
881 
885  inline void SetLast( T const &pItem) { FbxLayerElementArray::SetLast(pItem); }
886 
891  inline T RemoveAt(int pIndex) { T lValue; FbxLayerElementArray::RemoveAt(pIndex, &lValue); return lValue; }
892 
896  inline T RemoveLast() { T lValue; FbxLayerElementArray::RemoveLast(&lValue); return lValue; }
897 
902  inline bool RemoveIt(T const &pItem) { return FbxLayerElementArray::RemoveIt(&pItem); }
903 
909  inline T GetAt(int pIndex) const { T lValue; FbxLayerElementArray::GetAt(pIndex, &lValue); return lValue; }
910 
914  inline T GetFirst() const { T lValue; FbxLayerElementArray::GetFirst(&lValue); return lValue; }
915 
919  inline T GetLast() const { T lValue; FbxLayerElementArray::GetLast(&lValue); return lValue; }
920 
926  inline int Find(T const &pItem) { return FbxLayerElementArray::Find(pItem); }
927 
934  inline int FindAfter(int pAfterIndex, T const &pItem) { return FbxLayerElementArray::FindAfter(pAfterIndex, pItem); }
935 
942  inline int FindBefore(int pBeforeIndex, T const &pItem) { return FbxLayerElementArray::FindBefore(pBeforeIndex, pItem); }
943 
949  T operator[](int pIndex) const { T lValue; FbxLayerElementArray::GetAt(pIndex, &lValue); return lValue; }
950 
955  {
957  if (WriteLock())
958  {
959  SetCount(pArrayTemplate.GetCount());
960  for (int i = 0; i < pArrayTemplate.GetCount(); i++)
961  SetAt(i, pArrayTemplate.GetAt(i));
962  WriteUnlock();
964  }
965  return *this;
966  }
967 
972  {
973  if ( this != &pArrayTemplate )
974  {
976  if (WriteLock())
977  {
978  SetCount(pArrayTemplate.GetCount());
979  for (int i = 0; i < pArrayTemplate.GetCount(); i++)
980  SetAt(i, pArrayTemplate.GetAt(i));
981  WriteUnlock();
983  }
984  }
985  return *this;
986  }
987 
988 private:
989  // This one is not the best thing to do, but at least I don't get deprecated calls inside this file.
990  // Note that FbxLayerElementUserData is kind of a weird class in the first place anyway. So either
991  // we clean it up, or we live with this piece of code ;-)
993  T& AsReference(int pIndex) { T* v = (T*)FbxLayerElementArray::GetReference(pIndex, mDataType); return (v)?*v:dummy;}
994 
995  T dummy;
996 };
997 
998 
1006 extern FBXSDK_DLL int RemapIndexArrayTo(FbxLayerElement* pLayerEl,
1007  FbxLayerElement::EMappingMode pNewMapping,
1008  FbxLayerElementArrayTemplate<int>* pIndexArray);
1009 
1010 
1015 template <class Type> class FbxLayerElementTemplate : public FbxLayerElement
1016 {
1017 public:
1018 
1024  {
1025  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1026  return *mDirectArray;
1027  }
1028 
1034  {
1035  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1036  return *mDirectArray;
1037  }
1038 
1044  {
1045  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1046  return *mIndexArray;
1047  }
1048 
1054  {
1055  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1056  return *mIndexArray;
1057  }
1058 
1063  bool Clear()
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  }
1074 
1075 public:
1076 
1081  bool operator==(const FbxLayerElementTemplate& pOther) const
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  }
1127 
1132  {
1133  FBX_ASSERT(mDirectArray != NULL);
1134  FBX_ASSERT(mIndexArray != NULL);
1135 
1136  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1138  {
1139  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1140  *mDirectArray = directArray;
1141  }
1142 
1143  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
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  }
1155 
1164  {
1165  return RemapIndexArrayTo(this, pNewMapping, mIndexArray);
1166  }
1167 
1168 /*****************************************************************************************************************************
1169 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1170 *****************************************************************************************************************************/
1171 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1172 protected:
1174  {
1175  mDirectArray = NULL;
1176  mIndexArray = NULL;
1177  }
1178 
1180  {
1181  FbxDelete(mDirectArray);
1182  FbxDelete(mIndexArray);
1183  }
1184 
1185  virtual void AllocateArrays()
1186  {
1187  mDirectArray = FbxNew< FbxLayerElementArrayTemplate<Type> >(mType->GetType());
1188  mIndexArray = FbxNew< FbxLayerElementArrayTemplate<int> >(FbxIntDT.GetType());
1189  }
1190 
1191 public:
1192  virtual int MemorySize() const
1193  {
1194  int size = FbxLayerElement::MemorySize();
1195  size += (mDirectArray->GetCount()*sizeof(Type));
1196  size += (mIndexArray->GetCount()*sizeof(int));
1197  return size;
1198  }
1199 
1204  virtual bool ContentWriteTo(FbxStream& pStream) const
1205  {
1206  void* a;
1207  int s,v;
1208  int count = 0;
1209 
1210  // direct array
1211  count = mDirectArray->GetCount();
1212  s = pStream.Write(&count, sizeof(int));
1213  if (s != sizeof(int)) return false;
1214  if (count > 0)
1215  {
1216  a = mDirectArray->GetLocked();
1217  FBX_ASSERT(a != NULL);
1218  v = count*sizeof(Type);
1219  s = pStream.Write(a, v);
1220  mDirectArray->Release(&a);
1221  if (s != v) return false;
1222  }
1223 
1224  // index array
1225  count = mIndexArray->GetCount();
1226  s = pStream.Write(&count, sizeof(int));
1227  if (s != sizeof(int)) return false;
1228  if (count > 0)
1229  {
1230  a = mIndexArray->GetLocked();
1231  FBX_ASSERT(a != NULL);
1232  v = count*sizeof(int);
1233  s = pStream.Write(a, v);
1234  mIndexArray->Release(&a);
1235  if (s != v) return false;
1236  }
1237 
1238  return FbxLayerElement::ContentWriteTo(pStream);
1239  }
1240 
1241  virtual bool ContentReadFrom(const FbxStream& pStream)
1242  {
1243  void* a;
1244  int s,v;
1245  int count = 0;
1246 
1247  // direct array
1248  s = pStream.Read(&count, sizeof(int));
1249  if (s != sizeof(int)) return false;
1250  mDirectArray->Resize(count);
1251  if (count > 0)
1252  {
1253  a = mDirectArray->GetLocked();
1254  FBX_ASSERT(a != NULL);
1255  v = count*sizeof(Type);
1256  s = pStream.Read(a, v);
1257  mDirectArray->Release(&a);
1258  if (s != v) return false;
1259  }
1260 
1261  // index array
1262  s = pStream.Read(&count, sizeof(int));
1263  if (s != sizeof(int)) return false;
1264  mIndexArray->Resize(count);
1265  if (count > 0)
1266  {
1267  a = mIndexArray->GetLocked();
1268  FBX_ASSERT(a != NULL);
1269  v = count*sizeof(int);
1270  s = pStream.Read(a, v);
1271  mIndexArray->Release(&a);
1272  if (s != v) return false;
1273  }
1274  return FbxLayerElement::ContentReadFrom(pStream);
1275  }
1277 
1278  typedef Type ArrayElementType;
1279  typedef FbxLayerElementArrayTemplate<Type> DirectArrayType;
1280  typedef FbxLayerElementArrayTemplate<int> IndexArrayType;
1281 
1282  FbxLayerElementArrayTemplate<Type>* mDirectArray;
1283  FbxLayerElementArrayTemplate<int>* mIndexArray;
1284 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1285 };
1286 
1287 #define FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(classDesc) \
1288  FBXSDK_FRIEND_NEW(); \
1289  static Fbx##classDesc* Create(FbxLayerContainer* pOwner, const char* pName);
1290 
1297 {
1298 public:
1299 
1303  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementNormal);
1304 
1305 protected:
1308 };
1309 
1314 {
1315 public:
1316 
1320  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementBinormal);
1321 
1322 protected:
1325 };
1326 
1331 {
1332 public:
1333 
1337  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementTangent);
1338 
1339 protected:
1342 };
1343 
1388 {
1389 public:
1391 
1395  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementMaterial);
1396 
1402  class LayerElementArrayProxy : public FbxLayerElementArrayTemplate<FbxSurfaceMaterial*>
1403  {
1404  public:
1406 
1408  void SetContainer( FbxLayerContainer* pContainer, int pInstance = 0);
1409  };
1410 
1411 /*****************************************************************************************************************************
1412 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1413 *****************************************************************************************************************************/
1414 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1415  virtual void AllocateArrays();
1416  virtual void SetOwner( FbxLayerContainer* pOwner, int pInstance = 0);
1417  virtual void SetInstance( int pInstance ) { SetOwner( mOwner, pInstance ); }
1418 
1419 protected:
1422 
1423 private:
1425  {
1426  return ParentClass::GetDirectArray();
1427  }
1428 
1430  {
1431  return ParentClass::GetDirectArray();
1432  }
1433 
1434  friend class FbxLayerContainer;
1435 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1436 };
1437 
1444 {
1445 public:
1446 
1450  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementPolygonGroup);
1451 
1452 protected:
1455 };
1456 
1472 {
1473 public:
1477  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementUV);
1478 
1479 protected:
1481  ~FbxLayerElementUV();
1482 };
1483 
1488 {
1489 public:
1490 
1494  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementVertexColor);
1495 
1496 protected:
1499 };
1500 
1501 template <class T> inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, int pIndex, bool* pStatus = NULL);
1502 template <class T> inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, int pIndex, bool* pStatus = NULL);
1503 template <class T> inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, const char* pName, bool* pStatus = NULL );
1504 template <class T> inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, const char* pName, bool* pStatus = NULL );
1505 
1512 {
1513 public:
1515 
1525  static FbxLayerElementUserData* Create(FbxLayerContainer* pOwner, const char* pName, int pId, FbxArray<FbxDataType>& pDataTypes, FbxArray<const char*>& pDataNames);
1526 
1532  static FbxLayerElementUserData* Create(FbxLayerContainer* pOwner, FbxLayerElementUserData const& pOther );
1533 
1540  {
1541  if( pIndex >= 0 || pIndex < GetDirectArray().GetCount() )
1542  {
1543  if (pStatus) *pStatus = true;
1544  return (FbxLayerElementArrayTemplate<void*>*)GetDirectArray().AsReference(pIndex);
1545  }
1546  else
1547  {
1548  if( pStatus ) *pStatus = false;
1549  FBX_ASSERT_NOW("Index out of bounds");
1551  }
1552  }
1553 
1559  const FbxLayerElementArrayTemplate<void*>* GetDirectArrayVoid( int pIndex, bool* pStatus = NULL) const
1560  {
1561  if( pIndex >= 0 || pIndex < GetDirectArray().GetCount() )
1562  {
1563  if (pStatus) *pStatus = true;
1564  return (FbxLayerElementArrayTemplate<void*>*)GetDirectArray().AsReference(pIndex);
1565  }
1566  else
1567  {
1568  if( pStatus ) *pStatus = false;
1569  FBX_ASSERT_NOW("Index out of bounds");
1571  }
1572  }
1573 
1574 
1580  FbxLayerElementArrayTemplate<void *>* GetDirectArrayVoid ( const char* pName, bool* pStatus = NULL )
1581  {
1582  FbxString lName( pName );
1583  for( int i = 0; i < mDataNames.GetCount(); ++i )
1584  {
1585  if( *mDataNames[i] == lName )
1586  return GetDirectArrayVoid(i, pStatus);
1587  }
1588 
1589  if (pStatus) *pStatus = false;
1591  }
1592 
1598  const FbxLayerElementArrayTemplate<void*>* GetDirectArrayVoid ( const char* pName, bool* pStatus = NULL ) const
1599  {
1600  FbxString lName( pName );
1601  for( int i = 0; i < mDataNames.GetCount(); ++i )
1602  {
1603  if( *mDataNames[i] == lName )
1604  return GetDirectArrayVoid(i, pStatus);
1605  }
1606 
1607  if (pStatus) *pStatus = false;
1609  }
1610 
1615  FbxDataType GetDataType( int pIndex ) const
1616  {
1617  if( pIndex < 0 || pIndex >= mDataTypes.GetCount() )
1618  return FbxUndefinedDT;
1619 
1620  return mDataTypes[pIndex];
1621  }
1622 
1627  FbxDataType GetDataType( const char* pName ) const
1628  {
1629  FbxString lName( pName );
1630 
1631  for( int i = 0; i < mDataNames.GetCount(); ++i )
1632  {
1633  if( *mDataNames[i] == lName )
1634  return mDataTypes[i];
1635  }
1636 
1637  return FbxUndefinedDT;
1638  }
1639 
1644  const char* GetDataName( int pIndex ) const
1645  {
1646  if( pIndex >= 0 && pIndex < mDataNames.GetCount() )
1647  return mDataNames[pIndex]->Buffer();
1648 
1649  return NULL;
1650  }
1651 
1655  void ResizeAllDirectArrays( int pSize )
1656  {
1657  for( int i = 0; i < GetDirectArray().GetCount(); ++i )
1658  {
1659  switch( mDataTypes[i].GetType() )
1660  {
1661  case eFbxBool: FbxGetDirectArray<bool>(this,i).Resize( pSize ) ; break;
1662  case eFbxInt: FbxGetDirectArray<int>(this,i).Resize( pSize ) ; break;
1663  case eFbxFloat: FbxGetDirectArray<float>(this,i).Resize( pSize ) ; break;
1664  case eFbxDouble: FbxGetDirectArray<double>(this,i).Resize( pSize ); break;
1665  //case eFbxDouble3: GetDirectArray< FbxDouble3 >(i).Resize( pSize ); break;
1666  //case eFbxDouble4: GetDirectArray< FbxDouble4 >(i).Resize( pSize ); break;
1667  //case eFbxDouble4x4: GetDirectArray< FbxDouble4x4>(i).Resize( pSize ); break;
1668  default:
1669  FBX_ASSERT_NOW("unknown type" ); break;
1670  }
1671  }
1672  }
1673 
1677  void RemoveFromAllDirectArrays( int pIndex )
1678  {
1679  for( int i = 0; i < GetDirectArray().GetCount(); ++i )
1680  {
1681  switch( mDataTypes[i].GetType() )
1682  {
1683  case eFbxBool: FbxGetDirectArray<bool>(this,i).RemoveAt( pIndex ) ; break;
1684  case eFbxInt: FbxGetDirectArray<int>(this,i).RemoveAt( pIndex ) ; break;
1685  case eFbxFloat: FbxGetDirectArray<float>(this,i).RemoveAt( pIndex ) ; break;
1686  case eFbxDouble: FbxGetDirectArray<double>(this,i).RemoveAt( pIndex ); break;
1687  //case eFbxDouble3: GetDirectArray< FbxDouble3 >(i).RemoveAt( pIndex ); break;
1688  //case eFbxDouble4: GetDirectArray< FbxDouble4 >(i).RemoveAt( pIndex ); break;
1689  //case eFbxDouble4x4: GetDirectArray< FbxDouble4x4>(i).RemoveAt( pIndex ); break;
1690  default:
1691  FBX_ASSERT_NOW("unknown type" ); break;
1692  }
1693  }
1694  }
1695 
1700  int GetArrayCount( int pIndex ) const
1701  {
1702  if( pIndex >= 0 && pIndex < GetDirectArray().GetCount() )
1703  {
1704  switch( mDataTypes[pIndex].GetType() )
1705  {
1706  case eFbxBool: return FbxGetDirectArray<bool>(this,pIndex).GetCount();
1707  case eFbxInt: return FbxGetDirectArray<int>(this,pIndex).GetCount();
1708  case eFbxFloat: return FbxGetDirectArray<float>(this,pIndex).GetCount();
1709  case eFbxDouble: return FbxGetDirectArray<double>(this,pIndex).GetCount();
1710  //case eFbxDouble3: return GetDirectArray< FbxDouble3 >(pIndex).GetCount();
1711  //case eFbxDouble4: return GetDirectArray< FbxDouble4 >(pIndex).GetCount();
1712  //case eFbxDouble4x4: return GetDirectArray< FbxDouble4x4>(pIndex).GetCount();
1713  default:
1714  FBX_ASSERT_NOW("Unknown type" ); break;
1715  }
1716  }
1717 
1718  return -1;
1719  }
1720 
1724  int GetId() const { return mId; }
1725 
1730  int GetDirectArrayCount() const { return GetDirectArray().GetCount(); }
1731 
1737  {
1738  if (this == &pOther)
1739  return *this;
1740 
1741  Clear();
1742 
1743  mId = pOther.mId;
1744  mDataTypes = pOther.mDataTypes;
1745  mDataNames.Resize(pOther.mDataNames.GetCount());
1746  for(int i = 0; i < pOther.mDataNames.GetCount(); ++i)
1747  mDataNames.SetAt(i, FbxNew< FbxString >( *pOther.mDataNames[i] ) );
1748 
1749  Init();
1750  for(int i = 0; i < pOther.GetDirectArrayCount(); ++i)
1751  {
1752  switch (mDataTypes[i].GetType())
1753  {
1754  case eFbxBool:
1755  FbxGetDirectArray<bool>(this, i) = FbxGetDirectArray<bool>(&pOther, i);
1756  break;
1757 
1758  case eFbxInt:
1759  FbxGetDirectArray<int>(this, i) = FbxGetDirectArray<int>(&pOther, i);
1760  break;
1761 
1762  case eFbxFloat:
1763  FbxGetDirectArray<float>(this, i) = FbxGetDirectArray<float>(&pOther, i);
1764  break;
1765 
1766  case eFbxDouble:
1767  FbxGetDirectArray<double>(this, i) = FbxGetDirectArray<double>(&pOther, i);
1768  break;
1769 
1770  default:
1771  FBX_ASSERT_NOW("Unknown type" );
1772  break;
1773  }
1774  }
1775 
1776  if ( ( mReferenceMode == FbxLayerElement::eIndex ||
1777  mReferenceMode == FbxLayerElement::eIndexToDirect) &&
1778  ( pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1780  {
1781  GetIndexArray() = pOther.GetIndexArray();
1782  }
1783 
1784  return *this;
1785  }
1786 
1790  bool Clear()
1791  {
1792  int i;
1793  const int lCount = GetDirectArray().GetCount();
1794  FbxLayerElementArray** directArray = NULL;
1795  directArray = GetDirectArray().GetLocked(directArray);
1796  for( i = 0; directArray != NULL && i < lCount; ++i )
1797  {
1798  if( directArray[i] )
1799  FbxDelete(directArray[i]);
1800  }
1801  FbxLayerElementArray*** ptr = &directArray;
1802  GetDirectArray().Release((void**)ptr);
1803  for( i = 0; i < mDataNames.GetCount(); ++i )
1804  {
1805  FBX_SAFE_DELETE(mDataNames[i]);
1806  }
1807  mDataNames.Clear();
1808  mDataTypes.Clear();
1809 
1811 
1812  return true;
1813  }
1814 
1819  virtual int MemorySize() const
1820  {
1822  size += sizeof(mId);
1823 
1824  for(int i = 0; i < mDataTypes.GetCount(); i++)
1825  {
1826  size += sizeof(mDataTypes[i]);
1827  }
1828  size += (mDataNames.GetCount() * sizeof(FbxString*));
1829 
1830  return size;
1831  }
1832 
1833 /*****************************************************************************************************************************
1834 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1835 *****************************************************************************************************************************/
1836 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1837 protected:
1847  FbxLayerElementUserData( int pId, FbxArray<FbxDataType>& pDataTypes, FbxArray<const char*>& pDataNames )
1848  :
1849  mId( pId ),
1850  mDataTypes( pDataTypes )
1851  {
1852  FBX_ASSERT( pDataTypes.GetCount() == pDataNames.GetCount() );
1853  for( int i = 0; i < pDataNames.GetCount(); ++i )
1854  {
1855  mDataNames.Add( FbxNew< FbxString >( pDataNames[i] ) );
1856  }
1857  }
1858 
1862  FbxLayerElementUserData( FbxLayerElementUserData const& pOther ) : mId(pOther.mId), mDataTypes(pOther.mDataTypes)
1863  {
1864  for (int lIndex = 0; lIndex < pOther.mDataNames.GetCount(); ++lIndex)
1865  {
1866  mDataNames.Add(FbxNew<FbxString>(*(pOther.mDataNames[lIndex])));
1867  }
1868 
1869  SetType(&FbxLayerElementUserDataDT);
1870  AllocateArrays();
1871 
1872  for(int i = 0; i < pOther.GetDirectArrayCount(); ++i)
1873  {
1874  switch (mDataTypes[i].GetType())
1875  {
1876  case eFbxBool:
1877  FbxGetDirectArray<bool>(this, i) = FbxGetDirectArray<bool>(&pOther, i);
1878  break;
1879 
1880  case eFbxInt:
1881  FbxGetDirectArray<int>(this, i) = FbxGetDirectArray<int>(&pOther, i);
1882  break;
1883 
1884  case eFbxFloat:
1885  FbxGetDirectArray<float>(this, i) = FbxGetDirectArray<float>(&pOther, i);
1886  break;
1887 
1888  case eFbxDouble:
1889  FbxGetDirectArray<double>(this, i) = FbxGetDirectArray<double>(&pOther, i);
1890  break;
1891 
1892  default:
1893  FBX_ASSERT_NOW("Unknown type" );
1894  break;
1895  }
1896  }
1897 
1898  if ( ( mReferenceMode == FbxLayerElement::eIndex ||
1899  mReferenceMode == FbxLayerElement::eIndexToDirect) &&
1900  ( pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1902  {
1903  GetIndexArray() = pOther.GetIndexArray();
1904  }
1905  }
1906 
1909  {
1910  Clear();
1911  }
1912 
1914  virtual void AllocateArrays()
1915  {
1917  Init();
1918  }
1919 
1920 
1921 private:
1922 
1923  void Init()
1924  {
1925  int i;
1926  GetDirectArray().Resize( mDataTypes.GetCount() );
1927 
1928  // initialize arrays
1929  for( i = 0; i < mDataTypes.GetCount(); ++i )
1930  {
1931  FbxHandle** dst = NULL;
1932  dst = GetDirectArray().GetLocked(dst);
1933  if (dst)
1934  {
1935  switch( mDataTypes[i].GetType() )
1936  {
1937  case eFbxBool: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<bool> >(mDataTypes[i].GetType()); break;
1938  case eFbxInt: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<int> >(mDataTypes[i].GetType()); break;
1939  case eFbxFloat: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<float> >(mDataTypes[i].GetType()); break;
1940  case eFbxDouble: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<double> >(mDataTypes[i].GetType()); break;
1941  default:
1942  FBX_ASSERT_NOW("Trying to assign an unknown type" ); break;
1943  }
1944  FbxHandle*** ptr = &dst;
1945  GetDirectArray().Release((void**)ptr);
1946  }
1947  }
1948  }
1949 
1950  int mId;
1951  FbxArray<FbxDataType> mDataTypes;
1952  FbxArray<FbxString*> mDataNames;
1953 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1954 };
1955 
1963 template <class T>
1964 inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray( FbxLayerElementUserData *pLayerElement,int pIndex, bool* pStatus)
1965 {
1966  return *(FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pIndex,pStatus);
1967 }
1968 
1976 template <class T>
1977 inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, int pIndex, bool* pStatus)
1978 {
1979  return *(const FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pIndex,pStatus);
1980 }
1981 
1982 
1990 template <class T>
1991 inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray( FbxLayerElementUserData *pLayerElement,const char* pName, bool* pStatus )
1992 {
1993  return *(FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pName,pStatus);
1994 }
1995 
2003 template <class T>
2004 inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, const char* pName, bool* pStatus )
2005 {
2006  return *(const FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pName,pStatus);
2007 }
2008 
2009 
2017 {
2018 public:
2020 
2026  static FbxLayerElementSmoothing* Create(FbxLayerContainer* pOwner, const char* pName);
2027 
2033  {
2034  if( pMode != FbxLayerElement::eDirect )
2035  {
2036  FBX_ASSERT_NOW( "Smoothing layer elements must be direct mapped" );
2037  return;
2038  }
2039  }
2040 
2041 /*****************************************************************************************************************************
2042 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2043 *****************************************************************************************************************************/
2044 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2045 protected:
2047  {
2048  mReferenceMode = FbxLayerElement::eDirect;
2049  }
2050 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2051 };
2052 
2057 {
2058 public:
2060 
2066  static FbxLayerElementCrease* Create(FbxLayerContainer* pOwner, const char* pName);
2067 
2073  {
2074  if( pMode != FbxLayerElement::eDirect )
2075  {
2076  FBX_ASSERT_NOW( "Crease layer elements must be direct mapped" );
2077  return;
2078  }
2079  }
2080 
2081 /*****************************************************************************************************************************
2082 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2083 *****************************************************************************************************************************/
2084 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2085 protected:
2087  {
2088  mReferenceMode = FbxLayerElement::eDirect;
2089  }
2090 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2091 };
2092 
2097 {
2098 public:
2100 
2106  static FbxLayerElementHole* Create(FbxLayerContainer* pOwner, const char* pName);
2107 
2113  {
2114  if( pMode != FbxLayerElement::eDirect )
2115  {
2116  FBX_ASSERT_NOW( "hole layer elements must be direct mapped" );
2117  return;
2118  }
2119  }
2120 
2121 /*****************************************************************************************************************************
2122 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2123 *****************************************************************************************************************************/
2124 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2125 protected:
2127  {
2128  mReferenceMode = FbxLayerElement::eDirect;
2129  }
2130 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2131 };
2132 
2136 {
2137 public:
2138 
2142  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementVisibility);
2143 
2144 /*****************************************************************************************************************************
2145 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2146 *****************************************************************************************************************************/
2147 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2148 protected:
2151 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2152 };
2153 
2173 {
2174 public:
2178  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementTexture);
2179 
2215  {
2247  eBlendModeCount
2248  };
2249 
2253  void SetBlendMode(EBlendMode pBlendMode) { mBlendMode = pBlendMode; }
2254 
2259  void SetAlpha(double pAlpha)
2260  {
2261  if (pAlpha > 1.0)
2262  mAlpha = 1.0;
2263  else if (pAlpha < 0.0)
2264  mAlpha = 0.0;
2265  else
2266  mAlpha = pAlpha;
2267  }
2268 
2272  EBlendMode GetBlendMode() const { return mBlendMode; }
2273 
2277  double GetAlpha() const { return mAlpha; }
2278 
2279 /*****************************************************************************************************************************
2280 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2281 *****************************************************************************************************************************/
2282 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2283  virtual int MemorySize() const
2284  {
2286  size += sizeof(mBlendMode);
2287  size += sizeof(mAlpha);
2288  return size;
2289  }
2290 
2291 protected:
2296  FbxLayerElementTexture() : mBlendMode(eTranslucent)
2297  {
2298  mReferenceMode = eIndexToDirect;
2299  mAlpha = 1.0;
2300  }
2301 
2302 private:
2303  EBlendMode mBlendMode;
2304  double mAlpha;
2305 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2306 };
2307 
2308 
2363 {
2364 
2365 public:
2367 
2372 
2377  FbxLayerElementNormal* GetNormals();
2378 
2383  const FbxLayerElementNormal* GetNormals() const;
2384 
2389  FbxLayerElementTangent* GetTangents();
2390 
2395  const FbxLayerElementTangent* GetTangents() const;
2396 
2401  FbxLayerElementBinormal* GetBinormals();
2402 
2407  const FbxLayerElementBinormal* GetBinormals() const;
2408 
2412  FbxLayerElementMaterial* GetMaterials();
2413 
2417  const FbxLayerElementMaterial* GetMaterials() const;
2418 
2422  FbxLayerElementPolygonGroup* GetPolygonGroups();
2423 
2427  const FbxLayerElementPolygonGroup* GetPolygonGroups() const;
2428 
2436 
2443  const FbxLayerElementUV* GetUVs(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse) const;
2444 
2445 
2448  int GetUVSetCount() const;
2449 
2452  FbxArray<FbxLayerElement::EType> GetUVSetChannels() const;
2453 
2456  FbxArray<const FbxLayerElementUV*> GetUVSets() const;
2457 
2462  FbxLayerElementVertexColor* GetVertexColors();
2463 
2468  const FbxLayerElementVertexColor* GetVertexColors() const;
2469 
2474  FbxLayerElementSmoothing* GetSmoothing();
2475 
2480  const FbxLayerElementSmoothing* GetSmoothing() const;
2481 
2486  FbxLayerElementCrease* GetVertexCrease();
2487 
2492  const FbxLayerElementCrease* GetVertexCrease() const;
2493 
2498  FbxLayerElementCrease* GetEdgeCrease();
2499 
2504  const FbxLayerElementCrease* GetEdgeCrease() const;
2505 
2510  FbxLayerElementHole* GetHole();
2511 
2516  const FbxLayerElementHole* GetHole() const;
2517 
2521  FbxLayerElementUserData* GetUserData();
2522 
2526  const FbxLayerElementUserData* GetUserData() const;
2527 
2531  FbxLayerElementVisibility* GetVisibility();
2532 
2536  const FbxLayerElementVisibility* GetVisibility() const;
2537 
2542  FbxLayerElementTexture* GetTextures(FbxLayerElement::EType pType);
2543 
2548  const FbxLayerElementTexture* GetTextures(FbxLayerElement::EType pType) const;
2549 
2554  void SetTextures(FbxLayerElement::EType pType, FbxLayerElementTexture* pTextures);
2555 
2574  FbxLayerElement* GetLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false);
2575 
2594  const FbxLayerElement* GetLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false) const;
2595 
2600  void SetNormals(FbxLayerElementNormal* pNormals);
2601 
2606  void SetBinormals(FbxLayerElementBinormal* pBinormals);
2607 
2612  void SetTangents(FbxLayerElementTangent* pTangents);
2613 
2617  void SetMaterials(FbxLayerElementMaterial* pMaterials);
2618 
2622  void SetPolygonGroups(FbxLayerElementPolygonGroup* pPolygonGroups);
2623 
2631 
2636  void SetVertexColors (FbxLayerElementVertexColor* pVertexColors);
2637 
2642  void SetSmoothing (FbxLayerElementSmoothing* pSmoothing);
2643 
2648  void SetVertexCrease (FbxLayerElementCrease* pCrease);
2649 
2654  void SetEdgeCrease (FbxLayerElementCrease* pCrease);
2655 
2660  void SetHole (FbxLayerElementHole* pHole);
2661 
2665  void SetUserData (FbxLayerElementUserData* pUserData);
2666 
2670  void SetVisibility( FbxLayerElementVisibility* pVisibility );
2671 
2690  void SetLayerElementOfType(FbxLayerElement* pLayerElement, FbxLayerElement::EType pType, bool pIsUV=false);
2691 
2698  FbxLayerElement* CreateLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false);
2699 
2703  void Clone(FbxLayer const& pSrcLayer);
2704 
2705 /*****************************************************************************************************************************
2706 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2707 *****************************************************************************************************************************/
2708 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2709 protected:
2711  FbxLayer& operator=(FbxLayer const& pSrcLayer);
2713 private:
2714 
2715  FbxLayer(FbxLayerContainer& pOwner);
2716  virtual ~FbxLayer();
2717 
2718  void Clear();
2719 
2720  FbxLayerContainer& mOwner;
2721 
2725 
2726 
2727  friend class FbxLayerContainer;
2728 
2729 public:
2734  bool ContentWriteTo(FbxStream& pStream) const;
2735  bool ContentReadFrom(const FbxStream& pStream);
2737  virtual int MemoryUsage() const;
2738 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2739 };
2740 
2744 #define FBXSDK_FOR_EACH_TEXTURE(lLayerIndex) for((lLayerIndex)=0;(lLayerIndex)<FbxLayerElement::sTypeTextureCount;(lLayerIndex)++)
2745 
2749 #define FBXSDK_FOR_EACH_NON_TEXTURE(lLayerIndex) for((lLayerIndex)=0;(lLayerIndex)<FbxLayerElement::sTypeNonTextureCount;(lLayerIndex)++)
2750 
2754 #define FBXSDK_TEXTURE_INDEX(ElementType) (int(ElementType)-FbxLayerElement::sTypeTextureStartIndex)
2755 
2759 #define FBXSDK_TEXTURE_TYPE(TextureIndex) (FbxLayerElement::EType((TextureIndex)+FbxLayerElement::sTypeTextureStartIndex))
2760 
2764 #define FBXSDK_NON_TEXTURE_INDEX(ElementType) (int(ElementType)-FbxLayerElement::sTypeNonTextureStartIndex)
2765 
2769 #define FBXSDK_NON_TEXTURE_TYPE(Index) (FbxLayerElement::EType((Index)+FbxLayerElement::sTypeNonTextureStartIndex))
2770 
2796 
2797 #undef FBXSDK_LAYER_ELEMENT_CREATE_DECLARE
2798 
2799 #include <fbxsdk/fbxsdk_nsend.h>
2800 
2801 #endif /* _FBXSDK_SCENE_GEOMETRY_LAYER_H_ */
int RemapIndexArrayTo(FbxLayerElement *pLayerEl, FbxLayerElement::EMappingMode pNewMapping, FbxLayerElementArrayTemplate< int > *pIndexArray)
Remap the index array to a new EMappingMode.
int GetId() const
Queries the this layer element's ID.
Definition: fbxlayer.h:1724
FbxDataType FbxLayerElementUserDataDT
void SetCount(int pCount)
Sets the count of items in the data buffer.
FbxLayerElementArrayTemplate< int > & GetIndexArray() const
Returns the index array of Layer Elements.
Definition: fbxlayer.h:1043
Layer element for mapping Tangents to a geometry.
Definition: fbxlayer.h:1330
bool RemoveIt(T const &pItem)
Removes one item from the data buffer.
Definition: fbxlayer.h:902
int GetReadLockCount() const
Retrieves the read lock count.
Definition: fbxlayer.h:368
FbxLayerElement & operator=(FbxLayerElement const &pOther)
Assignment operator.
Definition: fbxlayer.h:216
void * GetReference(int pIndex, EFbxType pValueType)
int GetArrayCount(int pIndex) const
Returns the direct array count for the attribute at pIndex.
Definition: fbxlayer.h:1700
FBX SDK environment definition.
void * GetImplementation()
Definition: fbxlayer.h:788
int FindAfter(int pAfterIndex, T const &pItem) const
Searches for an item after the specified index in the data buffer.
Definition: fbxlayer.h:739
void SetReferenceMode(EReferenceMode pReferenceMode)
Sets the Reference Mode.
Definition: fbxlayer.h:179
#define FBXSDK_FRIEND_NEW()
Definition: fbxnew.h:397
FbxLayer class provides a base for the layering mechanism.
Definition: fbxlayer.h:2362
Layer element for mapping materials (FbxSurfaceMaterial) to a geometry.
Definition: fbxlayer.h:1387
FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(const char *pName, bool *pStatus=((void *) 0))
Returns the direct array with the specified attribute name.
Definition: fbxlayer.h:1580
FbxLayerElementArrayTemplate(EFbxType pDataType)
Constructor.
Definition: fbxlayer.h:858
void RemoveLast(void **pItem, EFbxType pValueType)
Removes the last item from the data buffer.
static const int sTypeTextureCount
The count of texture type layer elements.
Definition: fbxlayer.h:120
32 bit signed integer.
bool Clear()
Removes all elements from the direct and the index arrays.
Definition: fbxlayer.h:1063
const T * GetData() const
Definition: fbxlayer.h:835
bool IsWriteLocked() const
Returns whether write is locked.
Definition: fbxlayer.h:363
FbxLayerElementBinormal FbxGeometryElementBinormal
Definition: fbxlayer.h:2785
FbxLayerElementNormal FbxGeometryElementNormal
Definition: fbxlayer.h:2784
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:851
const char * GetDataName(int pIndex) const
Returns the attribute name at the specified index.
Definition: fbxlayer.h:1644
EReferenceMode
Determines how the mapping information is stored in the array of coordinates.
Definition: fbxlayer.h:163
void SetReferenceMode(FbxLayerElement::EReferenceMode pMode)
Sets the Reference Mode.
Definition: fbxlayer.h:2072
Abstract class for implementing I/O operations through a stream of data.
Definition: fbxstream.h:26
Double width floating point value.
T RemoveAt(int pIndex)
Removes the specified item from the data buffer.
Definition: fbxlayer.h:891
EMappingMode GetMappingMode() const
Returns the Mapping Mode.
Definition: fbxlayer.h:184
#define NULL
Definition: fbxarch.h:210
int FindBefore(int pBeforeIndex, T const &pItem)
Searches for one item before the specified index in the data buffer.
Definition: fbxlayer.h:942
virtual int Read(void *, int) const =0
Read bytes from the stream and store them in the memory block.
FbxLayerElementArrayTemplate< Type > & GetDirectArray() const
Returns the direct array of Layer Elements.
Definition: fbxlayer.h:1023
This class contains material settings.
Utility class to manipulate strings.
Definition: fbxstring.h:66
void RemoveAt(int pIndex, T *pItem)
Removes the specified item from the data buffer.
Definition: fbxlayer.h:668
FbxDataType FbxUndefinedDT
void SetLast(T const &pItem)
Sets the value of the last item.
Definition: fbxlayer.h:885
Layer element for mapping custom user data to a geometry.
Definition: fbxlayer.h:1511
Contains a collection of FbxLayer objects.
int GetDirectArrayCount() const
Returns this layer element's direct array count.
Definition: fbxlayer.h:1730
Layer element for indicating if specified components are shown/hidden.
Definition: fbxlayer.h:2135
FBX SDK data type class.
Definition: fbxdatatypes.h:26
void SetAt(int pIndex, const void *pItem, EFbxType pValueType)
Sets the value for the specified item.
Layer element for mapping Vertex Colors to a geometry.
Definition: fbxlayer.h:1487
int RemapIndexTo(FbxLayerElement::EMappingMode pNewMapping)
Changes the Mapping mode to the new one and re-computes the index array.
Definition: fbxlayer.h:1163
int Find(const void *pItem, EFbxType pValueType) const
Searches for an item in the data buffer.
bool GetLast(T *pItem) const
Returns the last item's value.
Definition: fbxlayer.h:720
void SetAt(int pIndex, T const &pItem)
Sets the value of the specified item.
Definition: fbxlayer.h:880
void WriteUnlock() const
Releases the write lock on this array.
void SetMappingMode(EMappingMode pMappingMode)
Sets the Mapping Mode.
Definition: fbxlayer.h:174
FbxLayerElementVertexColor FbxGeometryElementVertexColor
Definition: fbxlayer.h:2790
T GetAt(const int pIndex) const
Retrieve a copy of the element at given index position in the array.
Definition: fbxarray.h:139
void SetName(const char *pName)
Sets the name of this object.
Definition: fbxlayer.h:194
Layer element for mapping UVs to a geometry.
Definition: fbxlayer.h:1471
void FbxDelete(T *p)
Deletion policy for pointer template classes that uses the FbxDelete() function.
Definition: fbxnew.h:341
Layer element for mapping Normals to a geometry.
Definition: fbxlayer.h:1296
int Find(T const &pItem)
Searches for an item in the data buffer.
Definition: fbxlayer.h:926
This class is the base class for textures, ie classes FbxFileTexture, FbxLayeredTexture and FbxProced...
Definition: fbxtexture.h:26
FbxLayerElementCrease FbxGeometryElementCrease
Definition: fbxlayer.h:2793
void SetReferenceMode(FbxLayerElement::EReferenceMode pMode)
Sets the Reference Mode.
Definition: fbxlayer.h:2032
void SetReferenceMode(FbxLayerElement::EReferenceMode pMode)
Sets the Reference Mode.
Definition: fbxlayer.h:2112
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 InsertAt(int pIndex, T const &pItem)
Inserts a new item at the specified position of the data buffer.
Definition: fbxlayer.h:648
bool RemoveIt(T *pItem)
Removes one item from the data buffer.
Definition: fbxlayer.h:688
ELockMode
Identifies the access mode to the data buffer.
Definition: fbxlayer.h:412
void SetLast(const void *pItem, EFbxType pValueType)
Sets the value of the last item.
const char * GetName() const
Returns the name of this object.
Definition: fbxlayer.h:199
T * FbxNew()
Definition: fbxnew.h:59
FbxLayerElementVisibility FbxGeometryElementVisibility
Definition: fbxlayer.h:2795
FbxSurfaceMaterial * FbxSurfaceMaterialPtr
Definition: fbxlayer.h:312
FbxLayerElementArrayTemplate< Type > & GetDirectArray()
Returns the direct array of Layer Elements.
Definition: fbxlayer.h:1033
FbxLayerElementTemplate< FbxSurfaceMaterial * > ParentClass
Definition: fbxlayer.h:1390
const FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(const char *pName, bool *pStatus=((void *) 0)) const
Returns the direct array with the specified attribute name.
Definition: fbxlayer.h:1598
T GetAt(int pIndex) const
Returns the specified item's value.
Definition: fbxlayer.h:909
void Clear()
Reset the number of element to zero and free the memory allocated.
Definition: fbxarray.h:350
int InsertAt(int pIndex, T const &pItem)
Inserts a new item at the specified position of the data buffer.
Definition: fbxlayer.h:874
void SetAlpha(double pAlpha)
Sets the transparency level between multiple texture levels.
Definition: fbxlayer.h:2259
bool operator==(const FbxLayerElementTemplate &pOther) const
Equivalence operator.
Definition: fbxlayer.h:1081
FbxLayerElementArray & operator=(const FbxArray< T > &pArrayTemplate)
Assignment operator.
Definition: fbxlayer.h:954
FbxDataType GetDataType(const char *pName) const
Returns the specified attribute data type.
Definition: fbxlayer.h:1627
Boolean.
bool GetFirst(T *pItem) const
Returns the first item's value.
Definition: fbxlayer.h:710
int FindBefore(int pBeforeIndex, T const &pItem) const
Searches for one item before the specified index in the data buffer.
Definition: fbxlayer.h:747
LockAccessStatus::ELockAccessStatus GetStatus() const
Retrieves the access state.
Definition: fbxlayer.h:352
FbxLayerElementMaterial FbxGeometryElementMaterial
Definition: fbxlayer.h:2787
T RemoveLast()
Removes the last item from the data buffer.
Definition: fbxlayer.h:896
FbxLayerElementTangent FbxGeometryElementTangent
Definition: fbxlayer.h:2786
FbxLayerElementTemplate & operator=(FbxLayerElementTemplate const &pOther)
Assignment operator.
Definition: fbxlayer.h:1131
FbxLayerElementArray is the base class for FbxLayerElementArrayTemplate, it provides lock handling an...
Definition: fbxlayer.h:325
EFbxType
Type identifier constants.
void SetAt(int pIndex, T const &pItem)
Sets the value of the specified item.
Definition: fbxlayer.h:655
This class complements the FbxLayerElement class.
Definition: fbxlayer.h:1015
bool RemoveIt(void **pItem, EFbxType pValueType)
Removes one item from the data buffer.
FbxTexture * FbxTexturePtr
Definition: fbxlayer.h:313
virtual bool Clear()
Clears all the data from this layer element.
Definition: fbxlayer.h:229
int GetCount() const
Returns the count of items in the data buffer.
EMappingMode
Determines how the element is mapped to a surface.
Definition: fbxlayer.h:140
#define FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(classDesc)
Definition: fbxlayer.h:1287
Layer element for indicating hole of polygon of a geometry.
Definition: fbxlayer.h:2096
void ClearStatus()
Clears the access state and sets it to eSuccess.
Definition: fbxlayer.h:349
void SetAt(const int pIndex, const T &pElement)
Set the element at given position in the array.
Definition: fbxarray.h:212
int Add(T const &pItem)
Appends a new item to the end of the data buffer.
Definition: fbxlayer.h:640
int Find(T const &pItem) const
Searches for an item in the data buffer.
Definition: fbxlayer.h:731
FbxLayerElementUserData & operator=(FbxLayerElementUserData const &pOther)
Assignment operator which performs a deep copy.
Definition: fbxlayer.h:1736
EFbxType FbxTypeOf(const FbxRefPtr &)
Definition: fbxlayer.h:315
static const int sTypeNonTextureCount
The count of non-texture type layer elements.
Definition: fbxlayer.h:123
void SetLast(T const &pItem)
Sets the value of the last item.
Definition: fbxlayer.h:661
void RemoveAt(int pIndex, void **pItem, EFbxType pValueType)
Removes the specified item from the data buffer.
FbxLayerElementArrayReadLock(FbxLayerElementArray &pArray)
Definition: fbxlayer.h:816
int InsertAt(int pIndex, const void *pItem, EFbxType pValueType)
Inserts a new item at the specified position of the data buffer.
virtual bool ContentReadFrom(const FbxStream &pStream)
Reads the content of the object from the given stream.
virtual int Write(const void *, int)=0
Writes a memory block.
FbxLayerElementArrayTemplate< FbxSurfaceMaterial * > ParentClass
Definition: fbxlayer.h:1405
EFbxType GetType() const
Retrieve this data type.
virtual void * GetLocked(ELockMode pLockMode, EFbxType pDataType)
Grants a locked access to the data buffer.
void Release(void **pDataPtr)
Unlock the data buffer.
Definition: fbxlayer.h:480
Layer element for indicating smoothness of components of a geometry.
Definition: fbxlayer.h:2016
FbxHandle * FbxRefPtr
Definition: fbxlayer.h:310
double GetAlpha() const
Returns the transparency level between multiple levels of textures.
Definition: fbxlayer.h:2277
Layer element for indicating crease of components of a geometry.
Definition: fbxlayer.h:2056
T GetLast() const
Returns the last item's value.
Definition: fbxlayer.h:919
bool WriteLock() const
Locks this array for writing.
FbxLayerElementUserData FbxGeometryElementUserData
Definition: fbxlayer.h:2791
virtual void Release(void **pDataPtr, EFbxType pDataType)
Unlock the data buffer.
FbxLayerElementSmoothing FbxGeometryElementSmoothing
Definition: fbxlayer.h:2792
EFbxType mDataType
Definition: fbxlayer.h:791
void Release(T **pDataPtr, T *dummy)
Unlock the data buffer.
Definition: fbxlayer.h:492
void RemoveFromAllDirectArrays(int pIndex)
Removes a single element at pIndex from every direct array.
Definition: fbxlayer.h:1677
Layer element for mapping Textures to a geometry.
Definition: fbxlayer.h:2172
EType
Layer Element type identifier.
Definition: fbxlayer.h:75
T operator[](int pIndex) const
Returns the specified item's value.
Definition: fbxlayer.h:949
int ReadUnlock() const
Releases a read lock on this array.
FbxLayerElementUV FbxGeometryElementUV
Definition: fbxlayer.h:2789
FbxLayerElementArray * FbxLayerElementArrayPtr
Definition: fbxlayer.h:311
bool Clear()
Removes all data from this layer element.
Definition: fbxlayer.h:1790
int FindAfter(int pAfterIndex, T const &pItem)
Searches for an item after the specified index in the data buffer.
Definition: fbxlayer.h:934
FbxLayerElementArrayTemplate< T > & FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, int pIndex, bool *pStatus=((void *) 0))
Returns the direct array with the given attribute index.
Definition: fbxlayer.h:1964
int Add(T const &pItem)
Appends a new item to the end of the data buffer.
Definition: fbxlayer.h:867
#define FBX_SAFE_DELETE(p)
Definition: fbxsdk_def.h:50
void * GetLocked(ELockMode pLockMode=eReadWriteLock)
Grants a locked access to the data buffer.
Definition: fbxlayer.h:444
T * GetLocked(T *, ELockMode pLockMode=eReadWriteLock)
Grants a locked access to the data buffer.
Definition: fbxlayer.h:457
Reference to object or property.
void RemoveLast(T *pItem)
Removes the last item from the data buffer.
Definition: fbxlayer.h:678
FbxLayerElementPolygonGroup FbxGeometryElementPolygonGroup
Definition: fbxlayer.h:2788
FbxDataType GetDataType(int pIndex) const
Returns the data type for the specified index.
Definition: fbxlayer.h:1615
#define FBXSDK_DLL
Definition: fbxarch.h:173
int FindAfter(int pAfterIndex, const void *pItem, EFbxType pValueType) const
Searches for an item after the specified index in the data buffer.
FbxDataType FbxIntDT
bool GetAt(int pIndex, void **pItem, EFbxType pValueType) const
Returns the specified item's value.
const FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(int pIndex, bool *pStatus=((void *) 0)) const
Returns the direct array with the specified attribute index.
Definition: fbxlayer.h:1559
FbxLayerElementArrayTemplate< int > & GetIndexArray()
Returns the index array of Layer Elements.
Definition: fbxlayer.h:1053
EBlendMode GetBlendMode() const
Returns the way Textures blend between layers.
Definition: fbxlayer.h:2272
bool Resize(const int pSize)
Inserts or erases elements at the end such that Size() becomes pSize, increasing capacity if needed...
Definition: fbxarray.h:297
FbxLayerElementHole FbxGeometryElementHole
Definition: fbxlayer.h:2794
Layer element for grouping related polygons together.
Definition: fbxlayer.h:1443
FbxLayerElement FbxGeometryElement
Defines geometry element classes.
Definition: fbxlayer.h:2783
void CopyTo(FbxArray< T > &pDst)
Copies the items in the data buffer to an array.
Definition: fbxlayer.h:753
EReferenceMode GetReferenceMode() const
Returns the Reference Mode.
Definition: fbxlayer.h:189
void ResizeAllDirectArrays(int pSize)
Resizes all direct arrays to the specified size.
Definition: fbxlayer.h:1655
FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(int pIndex, bool *pStatus=((void *) 0))
Returns the direct array with the specified attribute index.
Definition: fbxlayer.h:1539
FbxLayerElementArrayTemplate< T > & operator=(const FbxLayerElementArrayTemplate< T > &pArrayTemplate)
Assignment operator.
Definition: fbxlayer.h:971
EBlendMode
Lets you control how textures are combined when you apply multiple layers of texture to a surface...
Definition: fbxlayer.h:2214
void SetStatus(LockAccessStatus::ELockAccessStatus pVal) const
Definition: fbxlayer.h:782
bool GetFirst(void **pItem, EFbxType pValueType) const
Returns the first item's value.
bool GetAt(int pIndex, T *pItem) const
Returns the specified item's value.
Definition: fbxlayer.h:700
int Add(const void *pItem, EFbxType pValueType)
Appends a new item to the end of the data buffer.
bool GetLast(void **pItem, EFbxType pValueType) const
Returns the last item's value.
Base class for elements of layers (FbxLayer).
Definition: fbxlayer.h:38
virtual int MemorySize() const
Queries the amount of memory used by this object as well as its content.
Definition: fbxlayer.h:1819
virtual bool ContentWriteTo(FbxStream &pStream) const
Writes the content of the object to the given stream.
Class for array of basic elements such as pointers and basic types.
Definition: fbxarray.h:23
Floating point value.
int FindBefore(int pBeforeIndex, const void *pItem, EFbxType pValueType) const
Searches for an item before the specified index in the data buffer.
void SetBlendMode(EBlendMode pBlendMode)
Sets the way Textures blend between layers.
Definition: fbxlayer.h:2253
T GetFirst() const
Returns the first item's value.
Definition: fbxlayer.h:914
Layer element for mapping Binormals to a geometry.
Definition: fbxlayer.h:1313