FBX C++ API Reference
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fbxlayer.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2016 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  // Reference count added in case of shared objects or corrupted files that uses the same object.
242  // This will prevent the deletion of an object that is stil used.
243  void IncRefCount() { mRefCount++; }
244  int DecRefCount() { mRefCount--; if (mRefCount < 0) { mRefCount = 0; } return mRefCount; }
245 
246 protected:
247  FbxLayerElement()
248  : mMappingMode(eNone)
249  , mReferenceMode(eDirect)
250  , mName("")
251  , mOwner(NULL)
252  , mRefCount(0)
253  {
254  }
255 
256  virtual ~FbxLayerElement()
257  {
258  }
259 
260  EMappingMode mMappingMode;
261  EReferenceMode mReferenceMode;
262 
263  FbxString mName;
264  const FbxDataType* mType;
265  FbxLayerContainer* mOwner;
266  int mRefCount;
267 
268  void Destruct() { if (DecRefCount() == 0) { FbxDelete(this); } }
269  virtual void SetOwner(FbxLayerContainer* pOwner, int pInstance = 0);
270 
272 
273 public:
274  virtual int MemorySize() const { return 0; }
275  virtual bool ContentWriteTo(FbxStream& pStream) const;
276  virtual bool ContentReadFrom(const FbxStream& pStream);
277 
278  friend class FbxLayerContainer;
279 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
280 };
281 
288 {
289 public:
303  {
312  eDirectLockExist
313  };
314 };
315 
316 //Special conversion types, we do not want them to resolve to undefined.
317 typedef FbxHandle* FbxRefPtr;
321 
322 inline EFbxType FbxTypeOf(const FbxRefPtr&){ return eFbxReference; }
326 
333 {
334 public:
339 
343  FbxLayerElementArray(EFbxType pDataType);
344 
346  virtual ~FbxLayerElementArray();
347 
349 
354 
356  inline void ClearStatus() { mStatus = LockAccessStatus::eSuccess; }
357 
359  inline LockAccessStatus::ELockAccessStatus GetStatus() const { return mStatus; }
361 
366 
370  inline bool IsWriteLocked() const { return mWriteLock; };
371 
375  inline int GetReadLockCount() const { return mReadLockCount; }
377 
381  bool IsInUse() const;
382 
386  int ReadLock() const;
387 
391  int ReadUnlock() const;
392 
397  bool WriteLock() const;
398 
401  void WriteUnlock() const;
402 
407  bool ReadWriteLock() const;
408 
411  void ReadWriteUnlock() const;
412 
413 
420  {
421  eReadLock = 1,
422  eWriteLock = 2,
423  eReadWriteLock = 3
424  };
425 
438  virtual void* GetLocked(ELockMode pLockMode, EFbxType pDataType);
439 
451  void* GetLocked(ELockMode pLockMode=eReadWriteLock) { return GetLocked(pLockMode, mDataType); }
452 
464  template <class T> inline T* GetLocked(T*, ELockMode pLockMode=eReadWriteLock) {T v; return (T*)GetLocked(pLockMode, FbxTypeOf(v)); }
465 
476  virtual void Release(void** pDataPtr, EFbxType pDataType);
477 
487  void Release(void** pDataPtr) { Release(pDataPtr, mDataType); }
488 
499  template <class T> inline void Release(T** pDataPtr, T* dummy)
500  {
501  T*** voidPtr = &pDataPtr;
502  Release((void**)*voidPtr, FbxTypeOf(*dummy));
503  }
504 
507  virtual size_t GetStride() const;
508 
513 
515  int GetCount() const;
516 
520  void SetCount(int pCount);
521 
523  void Clear();
524 
528  void Resize(int pItemCount);
529 
533  void AddMultiple(int pItemCount);
534 
540  int Add(const void* pItem, EFbxType pValueType);
541 
549  int InsertAt(int pIndex, const void* pItem, EFbxType pValueType);
550 
557  void SetAt(int pIndex, const void* pItem, EFbxType pValueType);
558 
564  void SetLast(const void* pItem, EFbxType pValueType);
565 
572  void RemoveAt(int pIndex, void** pItem, EFbxType pValueType);
573 
579  void RemoveLast(void** pItem, EFbxType pValueType);
580 
586  bool RemoveIt(void** pItem, EFbxType pValueType);
587 
595  bool GetAt(int pIndex, void** pItem, EFbxType pValueType) const;
596 
602  bool GetFirst(void** pItem, EFbxType pValueType) const;
603 
609  bool GetLast(void** pItem, EFbxType pValueType) const;
610 
617  int Find(const void* pItem, EFbxType pValueType) const;
618 
626  int FindAfter(int pAfterIndex, const void* pItem, EFbxType pValueType) const;
627 
635  int FindBefore(int pBeforeIndex, const void* pItem, EFbxType pValueType) const;
636 
641  bool IsEqual(const FbxLayerElementArray& pArray) const;
642 
647  template <class T> inline int Add(T const& pItem) { return Add((const void*)&pItem, FbxTypeOf(pItem)); }
648 
655  template <class T> inline int InsertAt(int pIndex, T const& pItem) { return InsertAt(pIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
656 
662  template <class T> inline void SetAt(int pIndex, T const& pItem) { SetAt(pIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
663 
668  template <class T> inline void SetLast(T const& pItem) { SetLast((const void*)&pItem, FbxTypeOf(pItem)); }
669 
675  template <class T> inline void RemoveAt(int pIndex, T* pItem)
676  {
677  T** voidPtr = &pItem;
678  RemoveAt(pIndex, (void**)voidPtr, FbxTypeOf(*pItem));
679  }
680 
685  template <class T> inline void RemoveLast(T* pItem)
686  {
687  T** voidPtr = &pItem;
688  RemoveLast((void**)voidPtr, FbxTypeOf(*pItem));
689  }
690 
695  template <class T> inline bool RemoveIt(T* pItem)
696  {
697  T** voidPtr = &pItem;
698  return RemoveIt((void**)voidPtr, FbxTypeOf(*pItem));
699  }
700 
707  template <class T> inline bool GetAt(int pIndex, T* pItem) const
708  {
709  T** voidPtr = &pItem;
710  return GetAt(pIndex, (void**)voidPtr, FbxTypeOf(*pItem));
711  }
712 
717  template <class T> inline bool GetFirst(T* pItem) const
718  {
719  T** voidPtr = &pItem;
720  return GetFirst((void**)voidPtr, FbxTypeOf(*pItem));
721  }
722 
727  template <class T> inline bool GetLast(T* pItem) const
728  {
729  T** voidPtr = &pItem;
730  return GetLast((void**)voidPtr, FbxTypeOf(*pItem));
731  }
732 
738  template <class T> inline int Find(T const& pItem) const { return Find((const void*)&pItem, FbxTypeOf(pItem)); }
739 
746  template <class T> inline int FindAfter(int pAfterIndex, T const& pItem) const { return FindAfter(pAfterIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
747 
754  template <class T> inline int FindBefore(int pBeforeIndex, T const& pItem) const { return FindBefore(pBeforeIndex, (const void*)&pItem, FbxTypeOf(pItem)); }
755 
756 
760  template<typename T> inline void CopyTo(FbxArray<T>& pDst)
761  {
762  T src;
763  T* srcPtr = &src;
764 
765  pDst.Clear();
766  if (mDataType != FbxTypeOf(src))
767  {
769  return;
770  }
771 
772  pDst.Resize(GetCount());
773  for (int i = 0; i < GetCount(); i++)
774  {
775  if (GetAt(i, (void**)&srcPtr, mDataType))
776  {
777  pDst.SetAt(i, src);
778  }
779  }
780  SetStatus(LockAccessStatus::eSuccess);
781  }
783 
784 protected:
785  void* GetDataPtr();
786  void* GetReference(int pIndex, EFbxType pValueType);
787  void GetReferenceTo(int pIndex, void** pRef, EFbxType pValueType);
788 
790  {
791  const_cast<FbxLayerElementArray*>(this)->mStatus = pVal;
792  }
793 
794  void SetImplementation(void* pImplementation);
795  inline void* GetImplementation() { return mImplementation; }
796  virtual void ConvertDataType(EFbxType pDataType, void** pDataPtr, size_t* pStride);
797 
799 
800 private:
802 
803  int mReadLockCount;
804  bool mWriteLock;
805  void* mImplementation;
806  size_t mStride;
807  int mDirectLockOn;
808  bool mDirectAccessOn;
809 
810  FbxArray<void*> mConvertedData;
811 
812 };
813 
817 template <typename T>
819 {
824  {
825  mLockedData = mArray.GetLocked((T*)NULL, FbxLayerElementArray::eReadLock);
826  }
827 
832  {
833  if( mLockedData )
834  {
835  mArray.Release((void **) &mLockedData);
836  }
837  }
838 
842  const T* GetData() const
843  {
844  return mLockedData;
845  }
846 
847 private:
848  FbxLayerElementArray& mArray;
849  T* mLockedData;
850 };
851 
853 
858 template <class T> class FbxLayerElementArrayTemplate : public FbxLayerElementArray
859 {
860 public:
861 
866  FbxLayerElementArray(pDataType)
867  {
868  }
869 
874  inline int Add( T const &pItem ) { return FbxLayerElementArray::Add(pItem); }
875 
881  inline int InsertAt(int pIndex, T const &pItem) { return FbxLayerElementArray::InsertAt(pIndex, pItem); }
882 
887  inline void SetAt(int pIndex, T const &pItem) { FbxLayerElementArray::SetAt(pIndex, pItem); }
888 
892  inline void SetLast( T const &pItem) { FbxLayerElementArray::SetLast(pItem); }
893 
898  inline T RemoveAt(int pIndex) { T lValue; FbxLayerElementArray::RemoveAt(pIndex, &lValue); return lValue; }
899 
903  inline T RemoveLast() { T lValue; FbxLayerElementArray::RemoveLast(&lValue); return lValue; }
904 
909  inline bool RemoveIt(T const &pItem) { return FbxLayerElementArray::RemoveIt(&pItem); }
910 
916  inline T GetAt(int pIndex) const { T lValue; FbxLayerElementArray::GetAt(pIndex, &lValue); return lValue; }
917 
921  inline T GetFirst() const { T lValue; FbxLayerElementArray::GetFirst(&lValue); return lValue; }
922 
926  inline T GetLast() const { T lValue; FbxLayerElementArray::GetLast(&lValue); return lValue; }
927 
933  inline int Find(T const &pItem) { return FbxLayerElementArray::Find(pItem); }
934 
941  inline int FindAfter(int pAfterIndex, T const &pItem) { return FbxLayerElementArray::FindAfter(pAfterIndex, pItem); }
942 
949  inline int FindBefore(int pBeforeIndex, T const &pItem) { return FbxLayerElementArray::FindBefore(pBeforeIndex, pItem); }
950 
956  T operator[](int pIndex) const { T lValue; FbxLayerElementArray::GetAt(pIndex, &lValue); return lValue; }
957 
962  {
964  if (WriteLock())
965  {
966  SetCount(pArrayTemplate.GetCount());
967  for (int i = 0; i < pArrayTemplate.GetCount(); i++)
968  SetAt(i, pArrayTemplate.GetAt(i));
969  WriteUnlock();
970  SetStatus(LockAccessStatus::eSuccess);
971  }
972  return *this;
973  }
974 
979  {
980  if ( this != &pArrayTemplate )
981  {
983  if (WriteLock())
984  {
985  SetCount(pArrayTemplate.GetCount());
986  for (int i = 0; i < pArrayTemplate.GetCount(); i++)
987  SetAt(i, pArrayTemplate.GetAt(i));
988  WriteUnlock();
989  SetStatus(LockAccessStatus::eSuccess);
990  }
991  }
992  return *this;
993  }
994 
995 private:
996  // This one is not the best thing to do, but at least I don't get deprecated calls inside this file.
997  // Note that FbxLayerElementUserData is kind of a weird class in the first place anyway. So either
998  // we clean it up, or we live with this piece of code ;-)
1000  T& AsReference(int pIndex) { T* v = (T*)FbxLayerElementArray::GetReference(pIndex, mDataType); return (v)?*v:dummy;}
1001 
1002  T dummy;
1003 };
1004 
1005 
1013 extern FBXSDK_DLL int RemapIndexArrayTo(FbxLayerElement* pLayerEl,
1014  FbxLayerElement::EMappingMode pNewMapping,
1015  FbxLayerElementArrayTemplate<int>* pIndexArray);
1016 
1017 
1022 template <class Type> class FbxLayerElementTemplate : public FbxLayerElement
1023 {
1024 public:
1025 
1031  {
1032  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1033  return *mDirectArray;
1034  }
1035 
1041  {
1042  FBX_ASSERT(mReferenceMode == FbxLayerElement::eDirect || mReferenceMode == FbxLayerElement::eIndexToDirect);
1043  return *mDirectArray;
1044  }
1045 
1051  {
1052  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1053  return *mIndexArray;
1054  }
1055 
1061  {
1062  FBX_ASSERT(mReferenceMode == FbxLayerElement::eIndex || mReferenceMode == FbxLayerElement::eIndexToDirect);
1063  return *mIndexArray;
1064  }
1065 
1070  bool Clear()
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  }
1081 
1082 public:
1083 
1088  bool operator==(const FbxLayerElementTemplate& pOther) const
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  }
1134 
1139  {
1140  FBX_ASSERT(mDirectArray != NULL);
1141  FBX_ASSERT(mIndexArray != NULL);
1142 
1143  if (pOther.GetReferenceMode() == FbxLayerElement::eDirect ||
1145  {
1146  const FbxLayerElementArrayTemplate<Type>& directArray = pOther.GetDirectArray();
1147  *mDirectArray = directArray;
1148  }
1149 
1150  if (pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
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  }
1162 
1171  {
1172  return RemapIndexArrayTo(this, pNewMapping, mIndexArray);
1173  }
1174 
1175 /*****************************************************************************************************************************
1176 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1177 *****************************************************************************************************************************/
1178 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1179 protected:
1181  {
1182  mDirectArray = NULL;
1183  mIndexArray = NULL;
1184  }
1185 
1187  {
1188  FbxDelete(mDirectArray);
1189  FbxDelete(mIndexArray);
1190  }
1191 
1192  virtual void AllocateArrays()
1193  {
1194  mDirectArray = FbxNew< FbxLayerElementArrayTemplate<Type> >(mType->GetType());
1195  mIndexArray = FbxNew< FbxLayerElementArrayTemplate<int> >(FbxIntDT.GetType());
1196  }
1197 
1198 public:
1199  virtual int MemorySize() const
1200  {
1201  int size = FbxLayerElement::MemorySize();
1202  size += (mDirectArray->GetCount()*sizeof(Type));
1203  size += (mIndexArray->GetCount()*sizeof(int));
1204  return size;
1205  }
1206 
1211  virtual bool ContentWriteTo(FbxStream& pStream) const
1212  {
1213  void* a;
1214  int s,v;
1215  int count = 0;
1216 
1217  // direct array
1218  count = mDirectArray->GetCount();
1219  s = pStream.Write(&count, sizeof(int));
1220  if (s != sizeof(int)) return false;
1221  if (count > 0)
1222  {
1223  a = mDirectArray->GetLocked();
1224  FBX_ASSERT(a != NULL);
1225  v = count*sizeof(Type);
1226  s = pStream.Write(a, v);
1227  mDirectArray->Release(&a);
1228  if (s != v) return false;
1229  }
1230 
1231  // index array
1232  count = mIndexArray->GetCount();
1233  s = pStream.Write(&count, sizeof(int));
1234  if (s != sizeof(int)) return false;
1235  if (count > 0)
1236  {
1237  a = mIndexArray->GetLocked();
1238  FBX_ASSERT(a != NULL);
1239  v = count*sizeof(int);
1240  s = pStream.Write(a, v);
1241  mIndexArray->Release(&a);
1242  if (s != v) return false;
1243  }
1244 
1245  return FbxLayerElement::ContentWriteTo(pStream);
1246  }
1247 
1248  virtual bool ContentReadFrom(const FbxStream& pStream)
1249  {
1250  void* a;
1251  int s,v;
1252  int count = 0;
1253 
1254  // direct array
1255  s = pStream.Read(&count, sizeof(int));
1256  if (s != sizeof(int)) return false;
1257  mDirectArray->Resize(count);
1258  if (count > 0)
1259  {
1260  a = mDirectArray->GetLocked();
1261  FBX_ASSERT(a != NULL);
1262  v = count*sizeof(Type);
1263  s = pStream.Read(a, v);
1264  mDirectArray->Release(&a);
1265  if (s != v) return false;
1266  }
1267 
1268  // index array
1269  s = pStream.Read(&count, sizeof(int));
1270  if (s != sizeof(int)) return false;
1271  mIndexArray->Resize(count);
1272  if (count > 0)
1273  {
1274  a = mIndexArray->GetLocked();
1275  FBX_ASSERT(a != NULL);
1276  v = count*sizeof(int);
1277  s = pStream.Read(a, v);
1278  mIndexArray->Release(&a);
1279  if (s != v) return false;
1280  }
1281  return FbxLayerElement::ContentReadFrom(pStream);
1282  }
1284 
1285  typedef Type ArrayElementType;
1286  typedef FbxLayerElementArrayTemplate<Type> DirectArrayType;
1287  typedef FbxLayerElementArrayTemplate<int> IndexArrayType;
1288 
1289  FbxLayerElementArrayTemplate<Type>* mDirectArray;
1290  FbxLayerElementArrayTemplate<int>* mIndexArray;
1291 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1292 };
1293 
1294 #define FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(classDesc) \
1295  FBXSDK_FRIEND_NEW(); \
1296  static Fbx##classDesc* Create(FbxLayerContainer* pOwner, const char* pName);
1297 
1304 {
1305 public:
1306 
1310  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementNormal);
1311 
1312 protected:
1315 };
1316 
1321 {
1322 public:
1323 
1327  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementBinormal);
1328 
1329 protected:
1332 };
1333 
1338 {
1339 public:
1340 
1344  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementTangent);
1345 
1346 protected:
1349 };
1350 
1395 {
1396 public:
1398 
1402  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementMaterial);
1403 
1409  class LayerElementArrayProxy : public FbxLayerElementArrayTemplate<FbxSurfaceMaterial*>
1410  {
1411  public:
1413 
1415  void SetContainer( FbxLayerContainer* pContainer, int pInstance = 0);
1416  };
1417 
1418 /*****************************************************************************************************************************
1419 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1420 *****************************************************************************************************************************/
1421 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1422  virtual void AllocateArrays();
1423  virtual void SetOwner( FbxLayerContainer* pOwner, int pInstance = 0);
1424  virtual void SetInstance( int pInstance ) { SetOwner( mOwner, pInstance ); }
1425 
1426 protected:
1429 
1430 private:
1432  {
1433  return ParentClass::GetDirectArray();
1434  }
1435 
1437  {
1438  return ParentClass::GetDirectArray();
1439  }
1440 
1441  friend class FbxLayerContainer;
1442 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1443 };
1444 
1451 {
1452 public:
1453 
1457  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementPolygonGroup);
1458 
1459 protected:
1462 };
1463 
1479 {
1480 public:
1484  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementUV);
1485 
1486 protected:
1488  ~FbxLayerElementUV();
1489 };
1490 
1495 {
1496 public:
1497 
1501  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementVertexColor);
1502 
1503 protected:
1506 };
1507 
1508 template <class T> inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, int pIndex, bool* pStatus = NULL);
1509 template <class T> inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, int pIndex, bool* pStatus = NULL);
1510 template <class T> inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, const char* pName, bool* pStatus = NULL );
1511 template <class T> inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, const char* pName, bool* pStatus = NULL );
1512 
1519 {
1520 public:
1522 
1532  static FbxLayerElementUserData* Create(FbxLayerContainer* pOwner, const char* pName, int pId, FbxArray<FbxDataType>& pDataTypes, FbxArray<const char*>& pDataNames);
1533 
1539  static FbxLayerElementUserData* Create(FbxLayerContainer* pOwner, FbxLayerElementUserData const& pOther );
1540 
1547  {
1548  if( pIndex >= 0 || pIndex < GetDirectArray().GetCount() )
1549  {
1550  if (pStatus) *pStatus = true;
1551  return (FbxLayerElementArrayTemplate<void*>*)GetDirectArray().AsReference(pIndex);
1552  }
1553  else
1554  {
1555  if( pStatus ) *pStatus = false;
1556  FBX_ASSERT_NOW("Index out of bounds");
1558  }
1559  }
1560 
1566  const FbxLayerElementArrayTemplate<void*>* GetDirectArrayVoid( int pIndex, bool* pStatus = NULL) const
1567  {
1568  if( pIndex >= 0 || pIndex < GetDirectArray().GetCount() )
1569  {
1570  if (pStatus) *pStatus = true;
1571  return (FbxLayerElementArrayTemplate<void*>*)GetDirectArray().AsReference(pIndex);
1572  }
1573  else
1574  {
1575  if( pStatus ) *pStatus = false;
1576  FBX_ASSERT_NOW("Index out of bounds");
1578  }
1579  }
1580 
1581 
1587  FbxLayerElementArrayTemplate<void *>* GetDirectArrayVoid ( const char* pName, bool* pStatus = NULL )
1588  {
1589  FbxString lName( pName );
1590  for( int i = 0; i < mDataNames.GetCount(); ++i )
1591  {
1592  if( *mDataNames[i] == lName )
1593  return GetDirectArrayVoid(i, pStatus);
1594  }
1595 
1596  if (pStatus) *pStatus = false;
1598  }
1599 
1605  const FbxLayerElementArrayTemplate<void*>* GetDirectArrayVoid ( const char* pName, bool* pStatus = NULL ) const
1606  {
1607  FbxString lName( pName );
1608  for( int i = 0; i < mDataNames.GetCount(); ++i )
1609  {
1610  if( *mDataNames[i] == lName )
1611  return GetDirectArrayVoid(i, pStatus);
1612  }
1613 
1614  if (pStatus) *pStatus = false;
1616  }
1617 
1622  FbxDataType GetDataType( int pIndex ) const
1623  {
1624  if( pIndex < 0 || pIndex >= mDataTypes.GetCount() )
1625  return FbxUndefinedDT;
1626 
1627  return mDataTypes[pIndex];
1628  }
1629 
1634  FbxDataType GetDataType( const char* pName ) const
1635  {
1636  FbxString lName( pName );
1637 
1638  for( int i = 0; i < mDataNames.GetCount(); ++i )
1639  {
1640  if( *mDataNames[i] == lName )
1641  return mDataTypes[i];
1642  }
1643 
1644  return FbxUndefinedDT;
1645  }
1646 
1651  const char* GetDataName( int pIndex ) const
1652  {
1653  if( pIndex >= 0 && pIndex < mDataNames.GetCount() )
1654  return mDataNames[pIndex]->Buffer();
1655 
1656  return NULL;
1657  }
1658 
1662  void ResizeAllDirectArrays( int pSize )
1663  {
1664  for( int i = 0; i < GetDirectArray().GetCount(); ++i )
1665  {
1666  switch( mDataTypes[i].GetType() )
1667  {
1668  case eFbxBool: FbxGetDirectArray<bool>(this,i).Resize( pSize ) ; break;
1669  case eFbxInt: FbxGetDirectArray<int>(this,i).Resize( pSize ) ; break;
1670  case eFbxFloat: FbxGetDirectArray<float>(this,i).Resize( pSize ) ; break;
1671  case eFbxDouble: FbxGetDirectArray<double>(this,i).Resize( pSize ); break;
1672  //case eFbxDouble3: GetDirectArray< FbxDouble3 >(i).Resize( pSize ); break;
1673  //case eFbxDouble4: GetDirectArray< FbxDouble4 >(i).Resize( pSize ); break;
1674  //case eFbxDouble4x4: GetDirectArray< FbxDouble4x4>(i).Resize( pSize ); break;
1675  default:
1676  FBX_ASSERT_NOW("unknown type" ); break;
1677  }
1678  }
1679  }
1680 
1684  void RemoveFromAllDirectArrays( int pIndex )
1685  {
1686  for( int i = 0; i < GetDirectArray().GetCount(); ++i )
1687  {
1688  switch( mDataTypes[i].GetType() )
1689  {
1690  case eFbxBool: FbxGetDirectArray<bool>(this,i).RemoveAt( pIndex ) ; break;
1691  case eFbxInt: FbxGetDirectArray<int>(this,i).RemoveAt( pIndex ) ; break;
1692  case eFbxFloat: FbxGetDirectArray<float>(this,i).RemoveAt( pIndex ) ; break;
1693  case eFbxDouble: FbxGetDirectArray<double>(this,i).RemoveAt( pIndex ); break;
1694  //case eFbxDouble3: GetDirectArray< FbxDouble3 >(i).RemoveAt( pIndex ); break;
1695  //case eFbxDouble4: GetDirectArray< FbxDouble4 >(i).RemoveAt( pIndex ); break;
1696  //case eFbxDouble4x4: GetDirectArray< FbxDouble4x4>(i).RemoveAt( pIndex ); break;
1697  default:
1698  FBX_ASSERT_NOW("unknown type" ); break;
1699  }
1700  }
1701  }
1702 
1707  int GetArrayCount( int pIndex ) const
1708  {
1709  if( pIndex >= 0 && pIndex < GetDirectArray().GetCount() )
1710  {
1711  switch( mDataTypes[pIndex].GetType() )
1712  {
1713  case eFbxBool: return FbxGetDirectArray<bool>(this,pIndex).GetCount();
1714  case eFbxInt: return FbxGetDirectArray<int>(this,pIndex).GetCount();
1715  case eFbxFloat: return FbxGetDirectArray<float>(this,pIndex).GetCount();
1716  case eFbxDouble: return FbxGetDirectArray<double>(this,pIndex).GetCount();
1717  //case eFbxDouble3: return GetDirectArray< FbxDouble3 >(pIndex).GetCount();
1718  //case eFbxDouble4: return GetDirectArray< FbxDouble4 >(pIndex).GetCount();
1719  //case eFbxDouble4x4: return GetDirectArray< FbxDouble4x4>(pIndex).GetCount();
1720  default:
1721  FBX_ASSERT_NOW("Unknown type" ); break;
1722  }
1723  }
1724 
1725  return -1;
1726  }
1727 
1731  int GetId() const { return mId; }
1732 
1737  int GetDirectArrayCount() const { return GetDirectArray().GetCount(); }
1738 
1744  {
1745  if (this == &pOther)
1746  return *this;
1747 
1748  Clear();
1749 
1750  mId = pOther.mId;
1751  mDataTypes = pOther.mDataTypes;
1752  mDataNames.Resize(pOther.mDataNames.GetCount());
1753  for(int i = 0; i < pOther.mDataNames.GetCount(); ++i)
1754  mDataNames.SetAt(i, FbxNew< FbxString >( *pOther.mDataNames[i] ) );
1755 
1756  Init();
1757  for(int i = 0; i < pOther.GetDirectArrayCount(); ++i)
1758  {
1759  switch (mDataTypes[i].GetType())
1760  {
1761  case eFbxBool:
1762  FbxGetDirectArray<bool>(this, i) = FbxGetDirectArray<bool>(&pOther, i);
1763  break;
1764 
1765  case eFbxInt:
1766  FbxGetDirectArray<int>(this, i) = FbxGetDirectArray<int>(&pOther, i);
1767  break;
1768 
1769  case eFbxFloat:
1770  FbxGetDirectArray<float>(this, i) = FbxGetDirectArray<float>(&pOther, i);
1771  break;
1772 
1773  case eFbxDouble:
1774  FbxGetDirectArray<double>(this, i) = FbxGetDirectArray<double>(&pOther, i);
1775  break;
1776 
1777  default:
1778  FBX_ASSERT_NOW("Unknown type" );
1779  break;
1780  }
1781  }
1782 
1783  if ( ( mReferenceMode == FbxLayerElement::eIndex ||
1784  mReferenceMode == FbxLayerElement::eIndexToDirect) &&
1785  ( pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1787  {
1788  GetIndexArray() = pOther.GetIndexArray();
1789  }
1790 
1791  return *this;
1792  }
1793 
1797  bool Clear()
1798  {
1799  int i;
1800  const int lCount = GetDirectArray().GetCount();
1801  FbxLayerElementArray** directArray = NULL;
1802  directArray = GetDirectArray().GetLocked(directArray);
1803  for( i = 0; directArray != NULL && i < lCount; ++i )
1804  {
1805  if( directArray[i] )
1806  FbxDelete(directArray[i]);
1807  }
1808  FbxLayerElementArray*** ptr = &directArray;
1809  GetDirectArray().Release((void**)ptr);
1810  for( i = 0; i < mDataNames.GetCount(); ++i )
1811  {
1812  FBX_SAFE_DELETE(mDataNames[i]);
1813  }
1814  mDataNames.Clear();
1815  mDataTypes.Clear();
1816 
1818 
1819  return true;
1820  }
1821 
1826  virtual int MemorySize() const
1827  {
1829  size += sizeof(mId);
1830 
1831  for(int i = 0; i < mDataTypes.GetCount(); i++)
1832  {
1833  size += sizeof(mDataTypes[i]);
1834  }
1835  size += (mDataNames.GetCount() * sizeof(FbxString*));
1836 
1837  return size;
1838  }
1839 
1840 /*****************************************************************************************************************************
1841 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1842 *****************************************************************************************************************************/
1843 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1844 protected:
1854  FbxLayerElementUserData( int pId, FbxArray<FbxDataType>& pDataTypes, FbxArray<const char*>& pDataNames )
1855  :
1856  mId( pId ),
1857  mDataTypes( pDataTypes )
1858  {
1859  FBX_ASSERT( pDataTypes.GetCount() == pDataNames.GetCount() );
1860  for( int i = 0; i < pDataNames.GetCount(); ++i )
1861  {
1862  mDataNames.Add( FbxNew< FbxString >( pDataNames[i] ) );
1863  }
1864  }
1865 
1869  FbxLayerElementUserData( FbxLayerElementUserData const& pOther ) : mId(pOther.mId), mDataTypes(pOther.mDataTypes)
1870  {
1871  for (int lIndex = 0; lIndex < pOther.mDataNames.GetCount(); ++lIndex)
1872  {
1873  mDataNames.Add(FbxNew<FbxString>(*(pOther.mDataNames[lIndex])));
1874  }
1875 
1876  SetType(&FbxLayerElementUserDataDT);
1877  AllocateArrays();
1878 
1879  for(int i = 0; i < pOther.GetDirectArrayCount(); ++i)
1880  {
1881  switch (mDataTypes[i].GetType())
1882  {
1883  case eFbxBool:
1884  FbxGetDirectArray<bool>(this, i) = FbxGetDirectArray<bool>(&pOther, i);
1885  break;
1886 
1887  case eFbxInt:
1888  FbxGetDirectArray<int>(this, i) = FbxGetDirectArray<int>(&pOther, i);
1889  break;
1890 
1891  case eFbxFloat:
1892  FbxGetDirectArray<float>(this, i) = FbxGetDirectArray<float>(&pOther, i);
1893  break;
1894 
1895  case eFbxDouble:
1896  FbxGetDirectArray<double>(this, i) = FbxGetDirectArray<double>(&pOther, i);
1897  break;
1898 
1899  default:
1900  FBX_ASSERT_NOW("Unknown type" );
1901  break;
1902  }
1903  }
1904 
1905  if ( ( mReferenceMode == FbxLayerElement::eIndex ||
1906  mReferenceMode == FbxLayerElement::eIndexToDirect) &&
1907  ( pOther.GetReferenceMode() == FbxLayerElement::eIndex ||
1909  {
1910  GetIndexArray() = pOther.GetIndexArray();
1911  }
1912  }
1913 
1916  {
1917  Clear();
1918  }
1919 
1921  virtual void AllocateArrays()
1922  {
1924  Init();
1925  }
1926 
1927 
1928 private:
1929 
1930  void Init()
1931  {
1932  int i;
1933  GetDirectArray().Resize( mDataTypes.GetCount() );
1934 
1935  // initialize arrays
1936  for( i = 0; i < mDataTypes.GetCount(); ++i )
1937  {
1938  FbxHandle** dst = NULL;
1939  dst = GetDirectArray().GetLocked(dst);
1940  if (dst)
1941  {
1942  switch( mDataTypes[i].GetType() )
1943  {
1944  case eFbxBool: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<bool> >(mDataTypes[i].GetType()); break;
1945  case eFbxInt: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<int> >(mDataTypes[i].GetType()); break;
1946  case eFbxFloat: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<float> >(mDataTypes[i].GetType()); break;
1947  case eFbxDouble: dst[i] = (FbxHandle*)FbxNew< FbxLayerElementArrayTemplate<double> >(mDataTypes[i].GetType()); break;
1948  default:
1949  FBX_ASSERT_NOW("Trying to assign an unknown type" ); break;
1950  }
1951  FbxHandle*** ptr = &dst;
1952  GetDirectArray().Release((void**)ptr);
1953  }
1954  }
1955  }
1956 
1957  int mId;
1958  FbxArray<FbxDataType> mDataTypes;
1959  FbxArray<FbxString*> mDataNames;
1960 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1961 };
1962 
1970 template <class T>
1971 inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray( FbxLayerElementUserData *pLayerElement,int pIndex, bool* pStatus)
1972 {
1973  return *(FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pIndex,pStatus);
1974 }
1975 
1983 template <class T>
1984 inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, int pIndex, bool* pStatus)
1985 {
1986  return *(const FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pIndex,pStatus);
1987 }
1988 
1989 
1997 template <class T>
1998 inline FbxLayerElementArrayTemplate<T>& FbxGetDirectArray( FbxLayerElementUserData *pLayerElement,const char* pName, bool* pStatus )
1999 {
2000  return *(FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pName,pStatus);
2001 }
2002 
2010 template <class T>
2011 inline FbxLayerElementArrayTemplate<T> const& FbxGetDirectArray(FbxLayerElementUserData const *pLayerElement, const char* pName, bool* pStatus )
2012 {
2013  return *(const FbxLayerElementArrayTemplate<T>*)pLayerElement->GetDirectArrayVoid(pName,pStatus);
2014 }
2015 
2016 
2024 {
2025 public:
2027 
2033  static FbxLayerElementSmoothing* Create(FbxLayerContainer* pOwner, const char* pName);
2034 
2040  {
2041  if( pMode != FbxLayerElement::eDirect )
2042  {
2043  FBX_ASSERT_NOW( "Smoothing layer elements must be direct mapped" );
2044  return;
2045  }
2046  }
2047 
2048 /*****************************************************************************************************************************
2049 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2050 *****************************************************************************************************************************/
2051 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2052 protected:
2054  {
2055  mReferenceMode = FbxLayerElement::eDirect;
2056  }
2057 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2058 };
2059 
2064 {
2065 public:
2067 
2073  static FbxLayerElementCrease* Create(FbxLayerContainer* pOwner, const char* pName);
2074 
2080  {
2081  if( pMode != FbxLayerElement::eDirect )
2082  {
2083  FBX_ASSERT_NOW( "Crease layer elements must be direct mapped" );
2084  return;
2085  }
2086  }
2087 
2088 /*****************************************************************************************************************************
2089 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2090 *****************************************************************************************************************************/
2091 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2092 protected:
2094  {
2095  mReferenceMode = FbxLayerElement::eDirect;
2096  }
2097 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2098 };
2099 
2104 {
2105 public:
2107 
2113  static FbxLayerElementHole* Create(FbxLayerContainer* pOwner, const char* pName);
2114 
2120  {
2121  if( pMode != FbxLayerElement::eDirect )
2122  {
2123  FBX_ASSERT_NOW( "hole layer elements must be direct mapped" );
2124  return;
2125  }
2126  }
2127 
2128 /*****************************************************************************************************************************
2129 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2130 *****************************************************************************************************************************/
2131 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2132 protected:
2134  {
2135  mReferenceMode = FbxLayerElement::eDirect;
2136  }
2137 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2138 };
2139 
2143 {
2144 public:
2145 
2149  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementVisibility);
2150 
2151 /*****************************************************************************************************************************
2152 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2153 *****************************************************************************************************************************/
2154 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2155 protected:
2158 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2159 };
2160 
2180 {
2181 public:
2185  FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(LayerElementTexture);
2186 
2222  {
2254  eBlendModeCount
2255  };
2256 
2260  void SetBlendMode(EBlendMode pBlendMode) { mBlendMode = pBlendMode; }
2261 
2266  void SetAlpha(double pAlpha)
2267  {
2268  if (pAlpha > 1.0)
2269  mAlpha = 1.0;
2270  else if (pAlpha < 0.0)
2271  mAlpha = 0.0;
2272  else
2273  mAlpha = pAlpha;
2274  }
2275 
2279  EBlendMode GetBlendMode() const { return mBlendMode; }
2280 
2284  double GetAlpha() const { return mAlpha; }
2285 
2286 /*****************************************************************************************************************************
2287 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2288 *****************************************************************************************************************************/
2289 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2290  virtual int MemorySize() const
2291  {
2293  size += sizeof(mBlendMode);
2294  size += sizeof(mAlpha);
2295  return size;
2296  }
2297 
2298 protected:
2303  FbxLayerElementTexture() : mBlendMode(eTranslucent)
2304  {
2305  mReferenceMode = eIndexToDirect;
2306  mAlpha = 1.0;
2307  }
2308 
2309 private:
2310  EBlendMode mBlendMode;
2311  double mAlpha;
2312 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2313 };
2314 
2315 
2370 {
2371 
2372 public:
2374 
2379 
2384  FbxLayerElementNormal* GetNormals();
2385 
2390  const FbxLayerElementNormal* GetNormals() const;
2391 
2396  FbxLayerElementTangent* GetTangents();
2397 
2402  const FbxLayerElementTangent* GetTangents() const;
2403 
2408  FbxLayerElementBinormal* GetBinormals();
2409 
2414  const FbxLayerElementBinormal* GetBinormals() const;
2415 
2419  FbxLayerElementMaterial* GetMaterials();
2420 
2424  const FbxLayerElementMaterial* GetMaterials() const;
2425 
2429  FbxLayerElementPolygonGroup* GetPolygonGroups();
2430 
2434  const FbxLayerElementPolygonGroup* GetPolygonGroups() const;
2435 
2443 
2450  const FbxLayerElementUV* GetUVs(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse) const;
2451 
2452 
2455  int GetUVSetCount() const;
2456 
2459  FbxArray<FbxLayerElement::EType> GetUVSetChannels() const;
2460 
2463  FbxArray<const FbxLayerElementUV*> GetUVSets() const;
2464 
2469  FbxLayerElementVertexColor* GetVertexColors();
2470 
2475  const FbxLayerElementVertexColor* GetVertexColors() const;
2476 
2481  FbxLayerElementSmoothing* GetSmoothing();
2482 
2487  const FbxLayerElementSmoothing* GetSmoothing() const;
2488 
2493  FbxLayerElementCrease* GetVertexCrease();
2494 
2499  const FbxLayerElementCrease* GetVertexCrease() const;
2500 
2505  FbxLayerElementCrease* GetEdgeCrease();
2506 
2511  const FbxLayerElementCrease* GetEdgeCrease() const;
2512 
2517  FbxLayerElementHole* GetHole();
2518 
2523  const FbxLayerElementHole* GetHole() const;
2524 
2528  FbxLayerElementUserData* GetUserData();
2529 
2533  const FbxLayerElementUserData* GetUserData() const;
2534 
2538  FbxLayerElementVisibility* GetVisibility();
2539 
2543  const FbxLayerElementVisibility* GetVisibility() const;
2544 
2549  FbxLayerElementTexture* GetTextures(FbxLayerElement::EType pType);
2550 
2555  const FbxLayerElementTexture* GetTextures(FbxLayerElement::EType pType) const;
2556 
2561  void SetTextures(FbxLayerElement::EType pType, FbxLayerElementTexture* pTextures);
2562 
2581  FbxLayerElement* GetLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false);
2582 
2601  const FbxLayerElement* GetLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false) const;
2602 
2607  void SetNormals(FbxLayerElementNormal* pNormals);
2608 
2613  void SetBinormals(FbxLayerElementBinormal* pBinormals);
2614 
2619  void SetTangents(FbxLayerElementTangent* pTangents);
2620 
2624  void SetMaterials(FbxLayerElementMaterial* pMaterials);
2625 
2629  void SetPolygonGroups(FbxLayerElementPolygonGroup* pPolygonGroups);
2630 
2638 
2643  void SetVertexColors (FbxLayerElementVertexColor* pVertexColors);
2644 
2649  void SetSmoothing (FbxLayerElementSmoothing* pSmoothing);
2650 
2655  void SetVertexCrease (FbxLayerElementCrease* pCrease);
2656 
2661  void SetEdgeCrease (FbxLayerElementCrease* pCrease);
2662 
2667  void SetHole (FbxLayerElementHole* pHole);
2668 
2672  void SetUserData (FbxLayerElementUserData* pUserData);
2673 
2677  void SetVisibility( FbxLayerElementVisibility* pVisibility );
2678 
2697  void SetLayerElementOfType(FbxLayerElement* pLayerElement, FbxLayerElement::EType pType, bool pIsUV=false);
2698 
2705  FbxLayerElement* CreateLayerElementOfType(FbxLayerElement::EType pType, bool pIsUV=false);
2706 
2710  void Clone(FbxLayer const& pSrcLayer);
2711 
2712 /*****************************************************************************************************************************
2713 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
2714 *****************************************************************************************************************************/
2715 #ifndef DOXYGEN_SHOULD_SKIP_THIS
2716 protected:
2718  FbxLayer& operator=(FbxLayer const& pSrcLayer);
2720 private:
2721 
2722  FbxLayer(FbxLayerContainer& pOwner);
2723  virtual ~FbxLayer();
2724 
2725  void Clear();
2726 
2727  FbxLayerContainer& mOwner;
2728 
2732 
2733 
2734  friend class FbxLayerContainer;
2735 
2736 public:
2741  bool ContentWriteTo(FbxStream& pStream) const;
2742  bool ContentReadFrom(const FbxStream& pStream);
2744  virtual int MemoryUsage() const;
2745 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
2746 };
2747 
2751 #define FBXSDK_FOR_EACH_TEXTURE(lLayerIndex) for((lLayerIndex)=0;(lLayerIndex)<FbxLayerElement::sTypeTextureCount;(lLayerIndex)++)
2752 
2756 #define FBXSDK_FOR_EACH_NON_TEXTURE(lLayerIndex) for((lLayerIndex)=0;(lLayerIndex)<FbxLayerElement::sTypeNonTextureCount;(lLayerIndex)++)
2757 
2761 #define FBXSDK_TEXTURE_INDEX(ElementType) (int(ElementType)-FbxLayerElement::sTypeTextureStartIndex)
2762 
2766 #define FBXSDK_TEXTURE_TYPE(TextureIndex) (FbxLayerElement::EType((TextureIndex)+FbxLayerElement::sTypeTextureStartIndex))
2767 
2771 #define FBXSDK_NON_TEXTURE_INDEX(ElementType) (int(ElementType)-FbxLayerElement::sTypeNonTextureStartIndex)
2772 
2776 #define FBXSDK_NON_TEXTURE_TYPE(Index) (FbxLayerElement::EType((Index)+FbxLayerElement::sTypeNonTextureStartIndex))
2777 
2803 
2804 #undef FBXSDK_LAYER_ELEMENT_CREATE_DECLARE
2805 
2806 #include <fbxsdk/fbxsdk_nsend.h>
2807 
2808 #endif /* _FBXSDK_SCENE_GEOMETRY_LAYER_H_ */
int GetReadLockCount() const
Retrieves the read lock count.
Definition: fbxlayer.h:375
int RemapIndexArrayTo(FbxLayerElement *pLayerEl, FbxLayerElement::EMappingMode pNewMapping, FbxLayerElementArrayTemplate< int > *pIndexArray)
Remap the index array to a new EMappingMode.
FbxDataType FbxLayerElementUserDataDT
Layer element for mapping Tangents to a geometry.
Definition: fbxlayer.h:1337
bool RemoveIt(T const &pItem)
Removes one item from the data buffer.
Definition: fbxlayer.h:909
FbxDataType GetDataType(const char *pName) const
Returns the specified attribute data type.
Definition: fbxlayer.h:1634
FbxLayerElement & operator=(FbxLayerElement const &pOther)
Assignment operator.
Definition: fbxlayer.h:216
void * GetReference(int pIndex, EFbxType pValueType)
const FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(int pIndex, bool *pStatus=((void *) 0)) const
Returns the direct array with the specified attribute index.
Definition: fbxlayer.h:1566
FBX SDK environment definition.
void * GetImplementation()
Definition: fbxlayer.h:795
void SetStatus(LockAccessStatus::ELockAccessStatus pVal) const
Definition: fbxlayer.h:789
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:2369
int FindBefore(int pBeforeIndex, const void *pItem, EFbxType pValueType) const
Searches for an item before the specified index in the data buffer.
int FindBefore(int pBeforeIndex, T const &pItem) const
Searches for one item before the specified index in the data buffer.
Definition: fbxlayer.h:754
Layer element for mapping materials (FbxSurfaceMaterial) to a geometry.
Definition: fbxlayer.h:1394
virtual bool ContentWriteTo(FbxStream &pStream) const
Writes the content of the object to the given stream.
FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(const char *pName, bool *pStatus=((void *) 0))
Returns the direct array with the specified attribute name.
Definition: fbxlayer.h:1587
FbxLayerElementArrayTemplate(EFbxType pDataType)
Constructor.
Definition: fbxlayer.h:865
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:1070
FbxLayerElementBinormal FbxGeometryElementBinormal
Definition: fbxlayer.h:2792
FbxLayerElementNormal FbxGeometryElementNormal
Definition: fbxlayer.h:2791
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
Definition: fbxlayer.h:858
EReferenceMode
Determines how the mapping information is stored in the array of coordinates.
Definition: fbxlayer.h:163
int ReadUnlock() const
Releases a read lock on this array.
void SetReferenceMode(FbxLayerElement::EReferenceMode pMode)
Sets the Reference Mode.
Definition: fbxlayer.h:2079
Abstract class for implementing I/O operations through a stream of data.
Definition: fbxstream.h:26
Double width floating point value.
bool IsWriteLocked() const
Returns whether write is locked.
Definition: fbxlayer.h:370
T RemoveAt(int pIndex)
Removes the specified item from the data buffer.
Definition: fbxlayer.h:898
#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:949
virtual int Read(void *, int) const =0
Read bytes from the stream and store them in the memory block.
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:675
FbxDataType FbxUndefinedDT
void SetLast(T const &pItem)
Sets the value of the last item.
Definition: fbxlayer.h:892
Layer element for mapping custom user data to a geometry.
Definition: fbxlayer.h:1518
Contains a collection of FbxLayer objects.
Layer element for indicating if specified components are shown/hidden.
Definition: fbxlayer.h:2142
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:1494
int RemapIndexTo(FbxLayerElement::EMappingMode pNewMapping)
Changes the Mapping mode to the new one and re-computes the index array.
Definition: fbxlayer.h:1170
EFbxType GetType() const
Retrieve this data type.
void SetAt(int pIndex, T const &pItem)
Sets the value of the specified item.
Definition: fbxlayer.h:887
void SetMappingMode(EMappingMode pMappingMode)
Sets the Mapping Mode.
Definition: fbxlayer.h:174
FbxLayerElementVertexColor FbxGeometryElementVertexColor
Definition: fbxlayer.h:2797
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:1478
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:1303
int Find(T const &pItem)
Searches for an item in the data buffer.
Definition: fbxlayer.h:933
This class is the base class for textures, ie classes FbxFileTexture, FbxLayeredTexture and FbxProced...
Definition: fbxtexture.h:26
FbxLayerElementCrease FbxGeometryElementCrease
Definition: fbxlayer.h:2800
void SetReferenceMode(FbxLayerElement::EReferenceMode pMode)
Sets the Reference Mode.
Definition: fbxlayer.h:2039
void SetReferenceMode(FbxLayerElement::EReferenceMode pMode)
Sets the Reference Mode.
Definition: fbxlayer.h:2119
int InsertAt(int pIndex, T const &pItem)
Inserts a new item at the specified position of the data buffer.
Definition: fbxlayer.h:655
bool RemoveIt(T *pItem)
Removes one item from the data buffer.
Definition: fbxlayer.h:695
ELockMode
Identifies the access mode to the data buffer.
Definition: fbxlayer.h:419
void SetLast(const void *pItem, EFbxType pValueType)
Sets the value of the last item.
bool GetAt(int pIndex, T *pItem) const
Returns the specified item&#39;s value.
Definition: fbxlayer.h:707
T * FbxNew()
Definition: fbxnew.h:59
FbxLayerElementVisibility FbxGeometryElementVisibility
Definition: fbxlayer.h:2802
FbxSurfaceMaterial * FbxSurfaceMaterialPtr
Definition: fbxlayer.h:319
FbxLayerElementArrayTemplate< Type > & GetDirectArray()
Returns the direct array of Layer Elements.
Definition: fbxlayer.h:1040
EBlendMode GetBlendMode() const
Returns the way Textures blend between layers.
Definition: fbxlayer.h:2279
FbxLayerElementTemplate< FbxSurfaceMaterial * > ParentClass
Definition: fbxlayer.h:1397
LockAccessStatus::ELockAccessStatus GetStatus() const
Retrieves the access state.
Definition: fbxlayer.h:359
void Clear()
Reset the number of element to zero and free the memory allocated.
Definition: fbxarray.h:352
int InsertAt(int pIndex, T const &pItem)
Inserts a new item at the specified position of the data buffer.
Definition: fbxlayer.h:881
void SetAlpha(double pAlpha)
Sets the transparency level between multiple texture levels.
Definition: fbxlayer.h:2266
FbxLayerElementArray & operator=(const FbxArray< T > &pArrayTemplate)
Assignment operator.
Definition: fbxlayer.h:961
int GetCount() const
Returns the count of items in the data buffer.
Boolean.
const T * GetData() const
Definition: fbxlayer.h:842
bool GetLast(T *pItem) const
Returns the last item&#39;s value.
Definition: fbxlayer.h:727
T GetAt(const int pIndex) const
Retrieve a copy of the element at given index position in the array.
Definition: fbxarray.h:139
FbxLayerElementMaterial FbxGeometryElementMaterial
Definition: fbxlayer.h:2794
T RemoveLast()
Removes the last item from the data buffer.
Definition: fbxlayer.h:903
FbxLayerElementTangent FbxGeometryElementTangent
Definition: fbxlayer.h:2793
FbxLayerElementTemplate & operator=(FbxLayerElementTemplate const &pOther)
Assignment operator.
Definition: fbxlayer.h:1138
double GetAlpha() const
Returns the transparency level between multiple levels of textures.
Definition: fbxlayer.h:2284
FbxLayerElementArray is the base class for FbxLayerElementArrayTemplate, it provides lock handling an...
Definition: fbxlayer.h:332
T GetLast() const
Returns the last item&#39;s value.
Definition: fbxlayer.h:926
EFbxType
Type identifier constants.
void SetAt(int pIndex, T const &pItem)
Sets the value of the specified item.
Definition: fbxlayer.h:662
This class complements the FbxLayerElement class.
Definition: fbxlayer.h:1022
T GetAt(int pIndex) const
Returns the specified item&#39;s value.
Definition: fbxlayer.h:916
int ReadLock() const
Increments the number of read locks on this array.
bool RemoveIt(void **pItem, EFbxType pValueType)
Removes one item from the data buffer.
FbxTexture * FbxTexturePtr
Definition: fbxlayer.h:320
virtual bool Clear()
Clears all the data from this layer element.
Definition: fbxlayer.h:229
EMappingMode
Determines how the element is mapped to a surface.
Definition: fbxlayer.h:140
#define FBXSDK_LAYER_ELEMENT_CREATE_DECLARE(classDesc)
Definition: fbxlayer.h:1294
Layer element for indicating hole of polygon of a geometry.
Definition: fbxlayer.h:2103
EMappingMode GetMappingMode() const
Returns the Mapping Mode.
Definition: fbxlayer.h:184
void ClearStatus()
Clears the access state and sets it to eSuccess.
Definition: fbxlayer.h:356
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:647
const char * GetDataName(int pIndex) const
Returns the attribute name at the specified index.
Definition: fbxlayer.h:1651
int FindAfter(int pAfterIndex, T const &pItem) const
Searches for an item after the specified index in the data buffer.
Definition: fbxlayer.h:746
FbxLayerElementUserData & operator=(FbxLayerElementUserData const &pOther)
Assignment operator which performs a deep copy.
Definition: fbxlayer.h:1743
EFbxType FbxTypeOf(const FbxRefPtr &)
Definition: fbxlayer.h:322
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:668
int GetDirectArrayCount() const
Returns this layer element&#39;s direct array count.
Definition: fbxlayer.h:1737
void RemoveAt(int pIndex, void **pItem, EFbxType pValueType)
Removes the specified item from the data buffer.
FbxLayerElementArrayReadLock(FbxLayerElementArray &pArray)
Definition: fbxlayer.h:823
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:1412
virtual void * GetLocked(ELockMode pLockMode, EFbxType pDataType)
Grants a locked access to the data buffer.
FbxLayerElementArrayTemplate< int > & GetIndexArray() const
Returns the index array of Layer Elements.
Definition: fbxlayer.h:1050
bool GetFirst(void **pItem, EFbxType pValueType) const
Returns the first item&#39;s value.
int Find(const void *pItem, EFbxType pValueType) const
Searches for an item in the data buffer.
void Release(void **pDataPtr)
Unlock the data buffer.
Definition: fbxlayer.h:487
Layer element for indicating smoothness of components of a geometry.
Definition: fbxlayer.h:2023
FbxHandle * FbxRefPtr
Definition: fbxlayer.h:317
FbxLayerElementArrayTemplate< Type > & GetDirectArray() const
Returns the direct array of Layer Elements.
Definition: fbxlayer.h:1030
Layer element for indicating crease of components of a geometry.
Definition: fbxlayer.h:2063
FbxLayerElementUserData FbxGeometryElementUserData
Definition: fbxlayer.h:2798
virtual void Release(void **pDataPtr, EFbxType pDataType)
Unlock the data buffer.
FbxLayerElementSmoothing FbxGeometryElementSmoothing
Definition: fbxlayer.h:2799
EFbxType mDataType
Definition: fbxlayer.h:798
bool operator==(const FbxLayerElementTemplate &pOther) const
Equivalence operator.
Definition: fbxlayer.h:1088
void Release(T **pDataPtr, T *dummy)
Unlock the data buffer.
Definition: fbxlayer.h:499
void RemoveFromAllDirectArrays(int pIndex)
Removes a single element at pIndex from every direct array.
Definition: fbxlayer.h:1684
Layer element for mapping Textures to a geometry.
Definition: fbxlayer.h:2179
EType
Layer Element type identifier.
Definition: fbxlayer.h:75
T operator[](int pIndex) const
Returns the specified item&#39;s value.
Definition: fbxlayer.h:956
FbxLayerElementUV FbxGeometryElementUV
Definition: fbxlayer.h:2796
FbxLayerElementArray * FbxLayerElementArrayPtr
Definition: fbxlayer.h:318
bool Clear()
Removes all data from this layer element.
Definition: fbxlayer.h:1797
int FindAfter(int pAfterIndex, T const &pItem)
Searches for an item after the specified index in the data buffer.
Definition: fbxlayer.h:941
FbxLayerElementArrayTemplate< T > & FbxGetDirectArray(FbxLayerElementUserData *pLayerElement, int pIndex, bool *pStatus=((void *) 0))
Returns the direct array with the given attribute index.
Definition: fbxlayer.h:1971
int Add(T const &pItem)
Appends a new item to the end of the data buffer.
Definition: fbxlayer.h:874
#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:451
T * GetLocked(T *, ELockMode pLockMode=eReadWriteLock)
Grants a locked access to the data buffer.
Definition: fbxlayer.h:464
Reference to object or property.
void RemoveLast(T *pItem)
Removes the last item from the data buffer.
Definition: fbxlayer.h:685
FbxLayerElementPolygonGroup FbxGeometryElementPolygonGroup
Definition: fbxlayer.h:2795
EReferenceMode GetReferenceMode() const
Returns the Reference Mode.
Definition: fbxlayer.h:189
#define FBXSDK_DLL
Definition: fbxarch.h:173
T GetFirst() const
Returns the first item&#39;s value.
Definition: fbxlayer.h:921
virtual int MemorySize() const
Queries the amount of memory used by this object as well as its content.
Definition: fbxlayer.h:1826
FbxDataType FbxIntDT
FbxLayerElementArrayTemplate< int > & GetIndexArray()
Returns the index array of Layer Elements.
Definition: fbxlayer.h:1060
bool Resize(const int pSize)
Inserts or erases elements at the end such that Size() becomes pSize, increasing capacity if needed...
Definition: fbxarray.h:299
FbxLayerElementHole FbxGeometryElementHole
Definition: fbxlayer.h:2801
Layer element for grouping related polygons together.
Definition: fbxlayer.h:1450
FbxLayerElement FbxGeometryElement
Defines geometry element classes.
Definition: fbxlayer.h:2790
int Find(T const &pItem) const
Searches for an item in the data buffer.
Definition: fbxlayer.h:738
void CopyTo(FbxArray< T > &pDst)
Copies the items in the data buffer to an array.
Definition: fbxlayer.h:760
bool GetLast(void **pItem, EFbxType pValueType) const
Returns the last item&#39;s value.
int GetArrayCount(int pIndex) const
Returns the direct array count for the attribute at pIndex.
Definition: fbxlayer.h:1707
bool GetAt(int pIndex, void **pItem, EFbxType pValueType) const
Returns the specified item&#39;s value.
void ResizeAllDirectArrays(int pSize)
Resizes all direct arrays to the specified size.
Definition: fbxlayer.h:1662
FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(int pIndex, bool *pStatus=((void *) 0))
Returns the direct array with the specified attribute index.
Definition: fbxlayer.h:1546
const FbxLayerElementArrayTemplate< void * > * GetDirectArrayVoid(const char *pName, bool *pStatus=((void *) 0)) const
Returns the direct array with the specified attribute name.
Definition: fbxlayer.h:1605
FbxLayerElementArrayTemplate< T > & operator=(const FbxLayerElementArrayTemplate< T > &pArrayTemplate)
Assignment operator.
Definition: fbxlayer.h:978
EBlendMode
Lets you control how textures are combined when you apply multiple layers of texture to a surface...
Definition: fbxlayer.h:2221
const char * GetName() const
Returns the name of this object.
Definition: fbxlayer.h:199
int Add(const void *pItem, EFbxType pValueType)
Appends a new item to the end of the data buffer.
Base class for elements of layers (FbxLayer).
Definition: fbxlayer.h:38
int GetId() const
Queries the this layer element&#39;s ID.
Definition: fbxlayer.h:1731
int FindAfter(int pAfterIndex, const void *pItem, EFbxType pValueType) const
Searches for an item after the specified index in the data buffer.
bool operator==(const FbxLayerElement &pOther) const
Equivalence operator.
Definition: fbxlayer.h:205
Class for array of basic elements such as pointers and basic types.
Definition: fbxarray.h:23
FbxDataType GetDataType(int pIndex) const
Returns the data type for the specified index.
Definition: fbxlayer.h:1622
Floating point value.
void SetBlendMode(EBlendMode pBlendMode)
Sets the way Textures blend between layers.
Definition: fbxlayer.h:2260
bool GetFirst(T *pItem) const
Returns the first item&#39;s value.
Definition: fbxlayer.h:717
Layer element for mapping Binormals to a geometry.
Definition: fbxlayer.h:1320