00001
00004 #ifndef _KFbxTypes_h
00005 #define _KFbxTypes_h
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <kaydaradef.h>
00043 #ifndef KFBX_DLL
00044 #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046
00047 #ifndef MB_FBXSDK
00048 #include <kbaselib_nsuse.h>
00049 #endif
00050 #include <kbaselib_forward.h>
00051 #include <klib/kdebug.h>
00052 #include <klib/kstring.h>
00053 #include <klib/ktime.h>
00054
00055 #include <kfbxplugins/kfbxcolor.h>
00056 #include <kfbxplugins/kfbxsystemunit.h>
00057 #include <fbxfilesdk_nsbegin.h>
00058
00059 class KFbxSdkManager;
00060
00061
00062 typedef enum {
00063 eUNIDENTIFIED,
00064 eBOOL1,
00065 eINTEGER1,
00066 eFLOAT1,
00067 eDOUBLE1,
00068 eDOUBLE2,
00069 eDOUBLE3,
00070 eDOUBLE4,
00071 eDOUBLE44,
00072 eENUM,
00073 eSTRING,
00074 eTIME,
00075 eREFERENCE,
00076 eBLOB,
00077 eDISTANCE,
00078 eDATETIME,
00079 eMAX_TYPES,
00080 } EFbxType;
00081
00082
00083 template<class T> class fbxVectorTemplate2 {
00084 public:
00085 inline fbxVectorTemplate2() { *this = 0; }
00086 inline fbxVectorTemplate2(T pValue) { *this = pValue; }
00087 inline fbxVectorTemplate2(T pData0,T pData1) { mData[0] = pData0; mData[1] = pData1; }
00088 inline ~fbxVectorTemplate2() {}
00089 public:
00090 inline T &operator[](int pIndex) { return mData[pIndex]; }
00091 inline T const&operator[](int pIndex) const { return mData[pIndex]; }
00092 inline fbxVectorTemplate2<T> &operator=(T const & pValue) { mData[0] = pValue; mData[1] = pValue; return *this; }
00093 inline fbxVectorTemplate2<T> &operator=(const fbxVectorTemplate2<T> & pRHS) { mData[0] = pRHS.mData[0]; mData[1] = pRHS.mData[1]; return *this; }
00094 inline bool operator==(fbxVectorTemplate2<T> const & pRHS) const { return ((mData[0] == pRHS.mData[0]) && (mData[1] == pRHS.mData[1])); }
00095 inline bool operator!=(fbxVectorTemplate2<T> const & pRHS) const { return !operator==( pRHS ); }
00096
00097 operator T*() { return mData; }
00098 operator T const*() const { return mData; }
00099
00100 public:
00101 T mData[2];
00102 };
00103
00104 template<class T> class fbxVectorTemplate3 {
00105 public:
00106 inline fbxVectorTemplate3() { *this = 0; }
00107 inline fbxVectorTemplate3(T pValue) { *this = pValue; }
00108 inline fbxVectorTemplate3(T pData0,T pData1,T pData2) { mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; }
00109 inline ~fbxVectorTemplate3() {}
00110 public:
00111 inline T &operator[](int pIndex) { return mData[pIndex]; }
00112 inline T const&operator[](int pIndex) const { return mData[pIndex]; }
00113 inline fbxVectorTemplate3<T> &operator=(int pValue) { mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; return *this; }
00114 inline fbxVectorTemplate3<T> &operator=(T const &pValue) { mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; return *this; }
00115 inline fbxVectorTemplate3<T> &operator=(const fbxVectorTemplate3<T> & pRHS) { mData[0] = pRHS.mData[0]; mData[1] = pRHS.mData[1]; mData[2] = pRHS.mData[2]; return *this; }
00116 inline bool operator==(fbxVectorTemplate3<T> const & pRHS) const { return ((mData[0] == pRHS.mData[0]) && (mData[1] == pRHS.mData[1]) && (mData[2] == pRHS.mData[2])); }
00117 inline bool operator!=(fbxVectorTemplate3<T> const & pRHS) const { return !operator==(pRHS); }
00118
00119 inline operator T*() { return mData; }
00120 inline operator T const*() const { return mData; }
00121
00122 public:
00123 T mData[3];
00124 };
00125
00126 template<class T> class fbxVectorTemplate4 {
00127 public:
00128 inline fbxVectorTemplate4() { *this = 0; }
00129 inline fbxVectorTemplate4(T pValue) { *this = pValue; }
00130 inline fbxVectorTemplate4(T pData0,T pData1,T pData2,T pData3) { mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; mData[3] = pData3; }
00131 inline ~fbxVectorTemplate4() {}
00132 public:
00133 inline T &operator[](int pIndex) { return mData[pIndex]; }
00134 inline operator fbxVectorTemplate3<T>& () const { return *((fbxVectorTemplate3<T> *)this); }
00135 inline T const&operator[](int pIndex) const { return mData[pIndex]; }
00136 inline fbxVectorTemplate4<T> &operator=(int pValue) { mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; mData[3] = pValue; return *this; }
00137 inline fbxVectorTemplate4<T> &operator=(T const &pValue) { mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; mData[3] = pValue; return *this; }
00138 inline fbxVectorTemplate4<T> &operator=(fbxVectorTemplate3<T> const &pValue) { mData[0] = pValue[0]; mData[1] = pValue[1]; mData[2] = pValue[2]; return *this; }
00139 inline fbxVectorTemplate4<T> &operator=(const fbxVectorTemplate4<T> & pRHS) { mData[0] = pRHS.mData[0]; mData[1] = pRHS.mData[1]; mData[2] = pRHS.mData[2]; mData[3] = pRHS.mData[3]; return *this; }
00140 inline bool operator==(fbxVectorTemplate4<T> const & pRHS) const { return ((mData[0] == pRHS.mData[0]) && (mData[1] == pRHS.mData[1]) && (mData[2] == pRHS.mData[2]) && (mData[3] == pRHS.mData[3])); }
00141 inline bool operator!=(fbxVectorTemplate4<T> const & pRHS) const { return !operator==( pRHS ); }
00142 inline operator T*() { return mData; }
00143 inline operator T const*() const { return mData; }
00144
00145 public:
00146 T mData[4];
00147 };
00148
00149
00154 class KFBX_DLL fbxBlob {
00155 public:
00160
00162 inline fbxBlob() { mData = 0; mSize = 0; mRefCount = 0; }
00163
00167 fbxBlob(int pSize);
00168
00172 inline fbxBlob(const fbxBlob & pRHS) { mData = 0; mSize = 0; mRefCount = 0; *this = pRHS; }
00173
00178 inline fbxBlob(const void * pData, int pSize) { mData = 0; mSize = 0; mRefCount = 0; Assign(pData,pSize); }
00179
00181 ~fbxBlob();
00182
00184 public:
00189
00194 fbxBlob &operator=(fbxBlob const &pValue);
00195
00200 void Assign(const void * pData, int pSize);
00202
00207
00212 bool operator==(fbxBlob const & pRHS) const;
00213
00218 inline bool operator!=(fbxBlob const & pRHS) const { return !operator==( pRHS ); }
00220
00222 void * Modify();
00223
00228
00232 const void * Access() const { return mData; }
00233
00237 inline int Size() const { return mSize; }
00239
00241 void Clear();
00242
00243 protected:
00244 int * mRefCount;
00245 void * mData;
00246 int mSize;
00247
00248 };
00249
00253 class KFBX_DLL fbxDistance {
00254 public:
00259
00261 fbxDistance(): mUnit(1.0), mValue(0.0) { }
00262
00267 fbxDistance(float pValue, KFbxSystemUnit pUnit): mUnit(1.0), mValue(0.0) {
00268 mValue = pValue;
00269 mUnit = pUnit;
00270 }
00271
00277 fbxDistance(float pValue, const char* pUnit);
00278
00280 ~fbxDistance() { }
00281
00283 public:
00284
00289
00294 fbxDistance &operator=(fbxDistance const& pValue) {
00295 mValue = pValue.mValue;
00296 mUnit = pValue.mUnit;
00297 return *this;
00298 }
00300
00305
00310 bool operator==(fbxDistance const & pRHS) const { return ( (mValue == pRHS.mValue) && (mUnit == pRHS.mUnit) ); }
00311
00316 bool operator!=(fbxDistance const& pRHS) const { return !operator==(pRHS); }
00318
00319
00320 KString const unitName() const { return mUnit.GetScaleFactorAsString(); }
00321
00326
00330 KFbxSystemUnit const unit() const { return mUnit; }
00331
00335 float const value() const { return mValue; }
00337
00341 float const internalValue() const {
00342 KFbxSystemUnit internalUnit(KFbxSystemUnit::Inch);
00343 float internalValue = (float)(mValue * mUnit.GetConversionFactorTo(internalUnit));
00344 return internalValue;
00345 }
00346
00351 float const valueAs( KFbxSystemUnit const& pUnit ) const
00352 {
00353 float convertedValue = (float)(mValue * mUnit.GetConversionFactorTo(pUnit));
00354 return convertedValue;
00355 }
00356
00357 private:
00358 float mValue;
00359 KFbxSystemUnit mUnit;
00360 };
00361
00362
00363
00364
00365
00373 class KFBX_DLL fbxDateTime
00374 {
00375 public:
00376 kShort mMillisecond;
00377 kShort mYear;
00378
00379 kByte mMonth;
00380 kByte mDay;
00381 kByte mHour;
00382 kByte mMinute;
00383 kByte mSecond;
00384
00385 public:
00390
00392 fbxDateTime() { Clear(); }
00393
00403 fbxDateTime(int pDay, int pMonth, int pYear, int pHour, int pMin, int pSec, int pMillisecond = 0);
00404
00406
00411
00416 bool operator==(const fbxDateTime& pRHS) const;
00417
00422 bool operator!=(const fbxDateTime& pRHS) const
00423 {
00424 return !(*this == pRHS);
00425 }
00427
00429 void Clear()
00430 {
00431 mMillisecond = mYear = 0;
00432 mMonth = mDay = mHour = mMinute = mSecond = 0;
00433 }
00434
00435
00439 bool isValid() const;
00440
00441
00442
00452 void setDate(int pDay, int pMonth, int pYear);
00453
00460 void setTime(int pHour, int pMin, int pSec, int pMillisecond = 0);
00462
00463
00469
00473 KString toString() const;
00474
00481 bool fromString(const char*);
00483
00487 static fbxDateTime currentDateTimeGMT();
00488 };
00489
00490
00491 typedef bool fbxBool1;
00492 typedef int fbxInteger1;
00493 typedef float fbxFloat1;
00494 typedef double fbxDouble1;
00495 typedef fbxVectorTemplate2<double> fbxDouble2;
00496 typedef fbxVectorTemplate3<double> fbxDouble3;
00497 typedef fbxVectorTemplate4<double> fbxDouble4;
00498 typedef fbxVectorTemplate4<fbxDouble4> fbxDouble44;
00499 typedef int fbxEnum;
00500 typedef KString fbxString;
00501 typedef KTime fbxTime;
00502 typedef fbxBlob KFbxBlob;
00503 class fbxReference {};
00504 typedef fbxDistance KFbxDistance;
00505
00506
00507 const size_t FbxTypeSizeOf[eMAX_TYPES] = {
00508 0,
00509 sizeof(fbxBool1),
00510 sizeof(fbxInteger1),
00511 sizeof(fbxFloat1),
00512 sizeof(fbxDouble1),
00513 sizeof(fbxDouble2),
00514 sizeof(fbxDouble3),
00515 sizeof(fbxDouble4),
00516 sizeof(fbxDouble44),
00517 sizeof(fbxEnum),
00518 sizeof(fbxString),
00519 sizeof(fbxTime),
00520 sizeof(fbxReference),
00521 sizeof(fbxBlob),
00522 sizeof(fbxDistance),
00523 sizeof(fbxDateTime)
00524 };
00525
00526
00527 template <class T> inline EFbxType FbxTypeOf( T const &pItem ) { K_ASSERT_MSG_NOW("Unknown type" ); return eUNIDENTIFIED; }
00528
00529 inline EFbxType FbxTypeOf( fbxBool1 const &pItem ) { return eBOOL1; }
00530 inline EFbxType FbxTypeOf( fbxInteger1 const &pItem ) { return eINTEGER1; }
00531 inline EFbxType FbxTypeOf( fbxFloat1 const &pItem ) { return eFLOAT1; }
00532 inline EFbxType FbxTypeOf( fbxDouble1 const &pItem ) { return eDOUBLE1; }
00533 inline EFbxType FbxTypeOf( fbxDouble2 const &pItem ) { return eDOUBLE2; }
00534 inline EFbxType FbxTypeOf( fbxDouble3 const &pItem ) { return eDOUBLE3; }
00535 inline EFbxType FbxTypeOf( fbxDouble4 const &pItem ) { return eDOUBLE4; }
00536 inline EFbxType FbxTypeOf( fbxDouble44 const &pItem ) { return eDOUBLE44; }
00537
00538 inline EFbxType FbxTypeOf( fbxString const &pItem ) { return eSTRING; }
00539 inline EFbxType FbxTypeOf( fbxTime const &pItem ) { return eTIME; }
00540 inline EFbxType FbxTypeOf( fbxReference const &pItem ) { return eREFERENCE; }
00541 inline EFbxType FbxTypeOf( fbxBlob const &pItem ) { return eBLOB; }
00542 inline EFbxType FbxTypeOf( fbxDistance const &pItem) { return eDISTANCE; }
00543 inline EFbxType FbxTypeOf( fbxDateTime const &pItem) { return eDATETIME; }
00544
00545
00546
00547
00548
00549
00550
00551
00552 template <class T> inline EFbxType _FbxTypeOf( T* const &pItem) { return eREFERENCE; }
00553 inline EFbxType _FbxTypeOf( fbxBool1 const &pItem ) { return eBOOL1; }
00554 inline EFbxType _FbxTypeOf( fbxInteger1 const &pItem ) { return eINTEGER1; }
00555 inline EFbxType _FbxTypeOf( fbxFloat1 const &pItem ) { return eFLOAT1; }
00556 inline EFbxType _FbxTypeOf( fbxDouble1 const &pItem ) { return eDOUBLE1; }
00557 inline EFbxType _FbxTypeOf( fbxDouble2 const &pItem ) { return eDOUBLE2; }
00558 inline EFbxType _FbxTypeOf( fbxDouble3 const &pItem ) { return eDOUBLE3; }
00559 inline EFbxType _FbxTypeOf( fbxDouble4 const &pItem ) { return eDOUBLE4; }
00560 inline EFbxType _FbxTypeOf( fbxDouble44 const &pItem ) { return eDOUBLE44; }
00561
00562 inline EFbxType _FbxTypeOf( fbxString const &pItem ) { return eSTRING; }
00563 inline EFbxType _FbxTypeOf( fbxTime const &pItem ) { return eTIME; }
00564 inline EFbxType _FbxTypeOf( fbxReference const &pItem ) { return eREFERENCE; }
00565 inline EFbxType _FbxTypeOf( fbxBlob const &pItem ) { return eBLOB; }
00566 inline EFbxType _FbxTypeOf( KFbxColor const &pItem ) { return eDOUBLE4; }
00567 inline EFbxType _FbxTypeOf( fbxDistance const &pItem ) { return eDISTANCE; }
00568 inline EFbxType _FbxTypeOf( fbxDateTime const &pItem ) { return eDATETIME; }
00569
00570
00571 inline EFbxType FbxTypeOf( KFbxColor const &pItem ) { return eDOUBLE4; }
00572
00573
00574
00575
00576
00577
00578
00579
00580 bool KFBX_DLL fbxCopyStr( fbxDouble1& pDst, fbxString const& pSrc );
00581 bool KFBX_DLL fbxCopyStr( fbxBool1& pDst, fbxString const& pSrc );
00582 bool KFBX_DLL fbxCopyStr( fbxInteger1& pDst, fbxString const& pSrc );
00583
00584
00585 template< class T1,class T2 > inline bool fbxCopy ( T1 &pDst,T2 const &pSrc ) { K_ASSERT_MSG_NOW("Incompatible type assigment" ); return false; }
00586
00587
00588 inline bool fbxCopy( fbxBool1 &pDst,fbxBool1 const &pSrc ) { pDst=pSrc; return true; }
00589 inline bool fbxCopy( fbxInteger1 &pDst,fbxInteger1 const &pSrc ) { pDst=pSrc; return true; }
00590 inline bool fbxCopy( fbxFloat1 &pDst,fbxFloat1 const &pSrc ) { pDst=pSrc; return true; }
00591 inline bool fbxCopy( fbxDouble1 &pDst,fbxDouble1 const &pSrc ) { pDst=pSrc; return true; }
00592 inline bool fbxCopy( fbxDouble2 &pDst,fbxDouble2 const &pSrc ) { pDst=pSrc; return true; }
00593 inline bool fbxCopy( fbxDouble3 &pDst,fbxDouble3 const &pSrc ) { pDst=pSrc; return true; }
00594 inline bool fbxCopy( fbxDouble4 &pDst,fbxDouble4 const &pSrc ) { pDst=pSrc; return true; }
00595 inline bool fbxCopy( fbxDouble44 &pDst,fbxDouble44 const &pSrc ) { pDst=pSrc; return true; }
00596
00597 inline bool fbxCopy( fbxString &pDst,fbxString const &pSrc ) { pDst=pSrc; return true; }
00598 inline bool fbxCopy( fbxTime &pDst,fbxTime const &pSrc ) { pDst=pSrc; return true; }
00599 inline bool fbxCopy( fbxReference &pDst,fbxReference const &pSrc ) { pDst=pSrc; return true; }
00600 inline bool fbxCopy( fbxBlob &pDst,fbxBlob const &pSrc ) { pDst=pSrc; return true; }
00601 inline bool fbxCopy( fbxDistance &pDst, fbxDistance const &pSrc ) { pDst=pSrc; return true; }
00602 inline bool fbxCopy( fbxDateTime &pDst, fbxDateTime const &pSrc ) { pDst=pSrc; return true; }
00603
00604
00605
00606 inline bool fbxCopy( fbxBool1 &pDst,fbxInteger1 const &pSrc ) { pDst = pSrc == 0 ? false : true; return true; }
00607 inline bool fbxCopy( fbxBool1 &pDst,fbxFloat1 const &pSrc ) { pDst = pSrc == 0.f ? false : true; return true; }
00608 inline bool fbxCopy( fbxBool1 &pDst,fbxDouble1 const &pSrc ) { pDst = pSrc == 0. ? false : true; return true; }
00609 inline bool fbxCopy( fbxBool1 &pDst,fbxDouble2 const &pSrc ) { return false; }
00610 inline bool fbxCopy( fbxBool1 &pDst,fbxDouble3 const &pSrc ) { return false; }
00611 inline bool fbxCopy( fbxBool1 &pDst,fbxDouble4 const &pSrc ) { return false; }
00612 inline bool fbxCopy( fbxBool1 &pDst,fbxDouble44 const &pSrc ) { return false; }
00613
00614 inline bool fbxCopy( fbxBool1 &pDst,fbxString const &pSrc ) { return fbxCopyStr(pDst,pSrc); }
00615 inline bool fbxCopy( fbxBool1 &pDst,fbxTime const &pSrc ) { return false; }
00616 inline bool fbxCopy( fbxBool1 &pDst,fbxReference const &pSrc ) { return false; }
00617 inline bool fbxCopy( fbxBool1 &pDst,fbxBlob const &pSrc ) { return false; }
00618 inline bool fbxCopy( fbxBool1 &pDst, fbxDistance const &pSrc ) { return false; }
00619 inline bool fbxCopy( fbxBool1 &pDst, fbxDateTime const &pSrc ) { return false; }
00620
00621
00622 inline bool fbxCopy( fbxInteger1 &pDst,fbxBool1 const &pSrc ) { pDst = (fbxInteger1)pSrc; return true; }
00623
00624 inline bool fbxCopy( fbxInteger1 &pDst,fbxFloat1 const &pSrc ) { pDst = (fbxInteger1)pSrc; return true; }
00625 inline bool fbxCopy( fbxInteger1 &pDst,fbxDouble1 const &pSrc ) { pDst = (fbxInteger1)pSrc; return true; }
00626 inline bool fbxCopy( fbxInteger1 &pDst,fbxDouble2 const &pSrc ) { return false; }
00627 inline bool fbxCopy( fbxInteger1 &pDst,fbxDouble3 const &pSrc ) { return false; }
00628 inline bool fbxCopy( fbxInteger1 &pDst,fbxDouble4 const &pSrc ) { return false; }
00629 inline bool fbxCopy( fbxInteger1 &pDst,fbxDouble44 const &pSrc ) { return false; }
00630
00631 inline bool fbxCopy( fbxInteger1 &pDst,fbxString const &pSrc ) { return fbxCopyStr(pDst,pSrc); }
00632 inline bool fbxCopy( fbxInteger1 &pDst,fbxTime const &pSrc ) { return false; }
00633 inline bool fbxCopy( fbxInteger1 &pDst,fbxReference const &pSrc ) { return false; }
00634 inline bool fbxCopy( fbxInteger1 &pDst,fbxBlob const &pSrc ) { return false; }
00635 inline bool fbxCopy( fbxInteger1 &pDst,fbxDistance const &pSrc ) { return false; }
00636 inline bool fbxCopy( fbxInteger1 &pDst,fbxDateTime const &pSrc ) { return false; }
00637
00638
00639 inline bool fbxCopy( fbxFloat1 &pDst,fbxBool1 const &pSrc ) { pDst = (fbxFloat1)pSrc; return true; }
00640 inline bool fbxCopy( fbxFloat1 &pDst,fbxInteger1 const &pSrc ) { pDst = (fbxFloat1)pSrc; return true; }
00641
00642 inline bool fbxCopy( fbxFloat1 &pDst,fbxDouble1 const &pSrc ) { pDst = (fbxFloat1)pSrc; return true; }
00643 inline bool fbxCopy( fbxFloat1 &pDst,fbxDouble2 const &pSrc ) { return false; }
00644 inline bool fbxCopy( fbxFloat1 &pDst,fbxDouble3 const &pSrc ) { return false; }
00645 inline bool fbxCopy( fbxFloat1 &pDst,fbxDouble4 const &pSrc ) { return false; }
00646 inline bool fbxCopy( fbxFloat1 &pDst,fbxDouble44 const &pSrc ) { return false; }
00647
00648 inline bool fbxCopy( fbxFloat1 &pDst,fbxString const &pSrc ) { return false; }
00649 inline bool fbxCopy( fbxFloat1 &pDst,fbxTime const &pSrc ) { return false; }
00650 inline bool fbxCopy( fbxFloat1 &pDst,fbxReference const &pSrc ) { return false; }
00651 inline bool fbxCopy( fbxFloat1 &pDst,fbxBlob const &pSrc ) { return false; }
00652 inline bool fbxCopy( fbxFloat1 &pDst,fbxDistance const &pSrc ) { pDst = pSrc.internalValue(); return true; }
00653 inline bool fbxCopy( fbxFloat1 &pDst,fbxDateTime const &pSrc ) { return false; }
00654
00655
00656 inline bool fbxCopy( fbxDouble1 &pDst,fbxBool1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00657 inline bool fbxCopy( fbxDouble1 &pDst,fbxInteger1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00658 inline bool fbxCopy( fbxDouble1 &pDst,fbxFloat1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00659
00660 inline bool fbxCopy( fbxDouble1 &pDst,fbxDouble2 const &pSrc ) { pDst = (fbxDouble1)pSrc[0]; return true; }
00661 inline bool fbxCopy( fbxDouble1 &pDst,fbxDouble3 const &pSrc ) { pDst = (fbxDouble1)pSrc[0]; return true; }
00662 inline bool fbxCopy( fbxDouble1 &pDst,fbxDouble4 const &pSrc ) { pDst = (fbxDouble1)pSrc[0]; return true; }
00663 inline bool fbxCopy( fbxDouble1 &pDst,fbxDouble44 const &pSrc ) { pDst = (fbxDouble1)pSrc[0][0]; return true; }
00664
00665 inline bool fbxCopy( fbxDouble1 &pDst,fbxString const &pSrc ) { return fbxCopyStr(pDst,pSrc); }
00666 inline bool fbxCopy( fbxDouble1 &pDst,fbxTime const &pSrc ) { pDst = (fbxDouble1)pSrc.GetSecondDouble(); return true; }
00667
00668
00669 inline bool fbxCopy( fbxDouble1 &pDst,fbxDistance const &pSrc ) { pDst = pSrc.internalValue(); return true; }
00670
00671
00672
00673 inline bool fbxCopy( fbxDouble2 &pDst,fbxBool1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00674 inline bool fbxCopy( fbxDouble2 &pDst,fbxInteger1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00675 inline bool fbxCopy( fbxDouble2 &pDst,fbxFloat1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00676 inline bool fbxCopy( fbxDouble2 &pDst,fbxDouble1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00677
00678
00679 inline bool fbxCopy( fbxDouble3 &pDst,fbxBool1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00680 inline bool fbxCopy( fbxDouble3 &pDst,fbxInteger1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00681 inline bool fbxCopy( fbxDouble3 &pDst,fbxFloat1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00682 inline bool fbxCopy( fbxDouble3 &pDst,fbxDouble1 const &pSrc ) { pDst = (fbxDouble1)pSrc; return true; }
00683 inline bool fbxCopy( fbxDouble3 &pDst,fbxDouble2 const &pSrc ) { return false; }
00684
00685 inline bool fbxCopy( fbxDouble3 &pDst,fbxDouble4 const &pSrc ) { pDst = pSrc; return true; }
00686 inline bool fbxCopy( fbxDouble3 &pDst,fbxDouble44 const &pSrc ) { return false; }
00687
00688 inline bool fbxCopy( fbxDouble3 &pDst,fbxString const &pSrc ) { return false; }
00689 inline bool fbxCopy( fbxDouble3 &pDst,fbxTime const &pSrc ) { return false; }
00690 inline bool fbxCopy( fbxDouble3 &pDst,fbxReference const &pSrc ) { return false; }
00691 inline bool fbxCopy( fbxDouble3 &pDst,fbxBlob const &pSrc ) { return false; }
00692 inline bool fbxCopy( fbxDouble3 &pDst,fbxDistance const &pSrc ) { return false; }
00693 inline bool fbxCopy( fbxDouble3 &pDst,fbxDateTime const &pSrc ) { return false; }
00694
00695
00696 inline bool fbxCopy( fbxDouble4 &pDst,fbxBool1 const &pSrc ) { return false; }
00697 inline bool fbxCopy( fbxDouble4 &pDst,fbxInteger1 const &pSrc ) { return false; }
00698 inline bool fbxCopy( fbxDouble4 &pDst,fbxFloat1 const &pSrc ) { return false; }
00699 inline bool fbxCopy( fbxDouble4 &pDst,fbxDouble1 const &pSrc ) { return false; }
00700 inline bool fbxCopy( fbxDouble4 &pDst,fbxDouble2 const &pSrc ) { return false; }
00701 inline bool fbxCopy( fbxDouble4 &pDst,fbxDouble3 const &pSrc ) { pDst = pSrc; return true; }
00702 inline bool fbxCopy( fbxDouble4 &pDst,fbxDouble44 const &pSrc ) { return false; }
00703
00704 inline bool fbxCopy( fbxDouble4 &pDst,fbxString const &pSrc ) { return false; }
00705 inline bool fbxCopy( fbxDouble4 &pDst,fbxTime const &pSrc ) { return false; }
00706 inline bool fbxCopy( fbxDouble4 &pDst,fbxReference const &pSrc ) { return false; }
00707 inline bool fbxCopy( fbxDouble4 &pDst,fbxBlob const &pSrc ) { return false; }
00708 inline bool fbxCopy( fbxDouble4 &pDst,fbxDistance const &pSrc ) { return false; }
00709 inline bool fbxCopy( fbxDouble4 &pDst,fbxDateTime const &pSrc ) { return false; }
00710
00711
00712 inline bool fbxCopy( fbxString &pDst,fbxBool1 const &pSrc ) { pDst=pSrc ? "true" : "false"; return true; }
00713 inline bool fbxCopy( fbxString &pDst,fbxInteger1 const &pSrc ) { pDst=KString(pSrc); return true; }
00714 inline bool fbxCopy( fbxString &pDst,fbxFloat1 const &pSrc ) { pDst=KString(pSrc); return true; }
00715 inline bool fbxCopy( fbxString &pDst,fbxDouble1 const &pSrc ) { pDst=KString(pSrc); return true; }
00716 inline bool fbxCopy( fbxString &pDst,fbxDouble2 const &pSrc ) { pDst=KString(pSrc[0])+","+KString(pSrc[1]); return true; }
00717 inline bool fbxCopy( fbxString &pDst,fbxDouble3 const &pSrc ) { pDst=KString(pSrc[0])+","+KString(pSrc[1])+","+KString(pSrc[2]); return true; }
00718 inline bool fbxCopy( fbxString &pDst,fbxDouble4 const &pSrc ) { pDst=KString(pSrc[0])+","+KString(pSrc[1])+","+KString(pSrc[2])+","+KString(pSrc[3]); return true; }
00719 inline bool fbxCopy( fbxString &pDst,fbxDouble44 const &pSrc ) { pDst=KString(pSrc[0][0])+","+KString(pSrc[0][1])+","+KString(pSrc[0][2])+","+KString(pSrc[0][3]); return true; }
00720
00721 inline bool fbxCopy( fbxString &pDst,fbxTime const &pSrc ) { char lTimeStr[128]; pSrc.GetTimeString(lTimeStr); pDst=lTimeStr; return true; }
00722 inline bool fbxCopy( fbxString &pDst,fbxReference const &pSrc ) { pDst="<reference>"; return true; }
00723 inline bool fbxCopy( fbxString &pDst,fbxBlob const &pSrc ) { pDst="<blob>"; return true; }
00724 inline bool fbxCopy( fbxString &pDst,fbxDistance const &pSrc ) { pDst= KString(pSrc.value()) + " " +pSrc.unitName(); return true; }
00725 inline bool fbxCopy( fbxString &pDst,fbxDateTime const &pSrc ) { pDst= pSrc.toString(); return true; }
00726
00727
00728 inline bool fbxCopy( fbxBlob &pDst,fbxBool1 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00729 inline bool fbxCopy( fbxBlob &pDst,fbxInteger1 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00730 inline bool fbxCopy( fbxBlob &pDst,fbxFloat1 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00731 inline bool fbxCopy( fbxBlob &pDst,fbxDouble1 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00732 inline bool fbxCopy( fbxBlob &pDst,fbxDouble2 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00733 inline bool fbxCopy( fbxBlob &pDst,fbxDouble3 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00734 inline bool fbxCopy( fbxBlob &pDst,fbxDouble4 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00735 inline bool fbxCopy( fbxBlob &pDst,fbxDouble44 const &pSrc ) { pDst.Assign(&pSrc, sizeof(pSrc)); return true; }
00736 inline bool fbxCopy( fbxBlob &pDst,fbxString const &pSrc )
00737 {
00738 bool lCastable = pSrc.GetLen() == (int)pSrc.GetLen();
00739 K_ASSERT( lCastable );
00740 if( lCastable )
00741 pDst.Assign(pSrc.Buffer(), (int)pSrc.GetLen());
00742 return lCastable;
00743 }
00744 inline bool fbxCopy( fbxBlob &pDst,fbxTime const &pSrc ) { kLongLong t = pSrc.Get(); pDst.Assign( &t, sizeof(t)); return true; }
00745 inline bool fbxCopy( fbxBlob &pDst,fbxReference const &pSrc ) { return false; }
00746 inline bool fbxCopy( fbxBlob &pDst,fbxDistance const &pSrc ) { return false; }
00747 inline bool fbxCopy( fbxBlob &pDst,fbxDateTime const &pSrc ) { return false; }
00748
00749
00750 inline bool fbxCopy( fbxDistance &pDst,fbxBool1 const &pSrc ) { return false; }
00751 inline bool fbxCopy( fbxDistance &pDst,fbxInteger1 const &pSrc ) { return false; }
00752 inline bool fbxCopy( fbxDistance &pDst,fbxFloat1 const &pSrc ) { return false; }
00753 inline bool fbxCopy( fbxDistance &pDst,fbxDouble1 const &pSrc ) { return false; }
00754 inline bool fbxCopy( fbxDistance &pDst,fbxDouble2 const &pSrc ) { return false; }
00755 inline bool fbxCopy( fbxDistance &pDst,fbxDouble3 const &pSrc ) { return false; }
00756 inline bool fbxCopy( fbxDistance &pDst, fbxDouble4 const &pSrc ) { return false; }
00757 inline bool fbxCopy( fbxDistance &pDst,fbxDouble44 const &pSrc ) { return false; }
00758 inline bool fbxCopy( fbxDistance &pDst,fbxString const &pSrc ) { return false; }
00759 inline bool fbxCopy( fbxDistance &pDst,fbxTime const &pSrc ) { return false; }
00760 inline bool fbxCopy( fbxDistance &pDst,fbxReference const &pSrc ) { return false; }
00761 inline bool fbxCopy( fbxDistance &pDst,fbxBlob const &pSrc ) { return false; }
00762 inline bool fbxCopy( fbxDistance &pDst,fbxDateTime const &pSrc ) { return false; }
00763
00764 inline bool fbxCopy( fbxDateTime &pDst,fbxBool1 const &pSrc ) { return false; }
00765 inline bool fbxCopy( fbxDateTime &pDst,fbxInteger1 const &pSrc ) { return false; }
00766 inline bool fbxCopy( fbxDateTime &pDst,fbxFloat1 const &pSrc ) { return false; }
00767 inline bool fbxCopy( fbxDateTime &pDst,fbxDouble1 const &pSrc ) { return false; }
00768 inline bool fbxCopy( fbxDateTime &pDst,fbxDouble2 const &pSrc ) { return false; }
00769 inline bool fbxCopy( fbxDateTime &pDst,fbxDouble3 const &pSrc ) { return false; }
00770 inline bool fbxCopy( fbxDateTime &pDst,fbxDouble4 const &pSrc ) { return false; }
00771 inline bool fbxCopy( fbxDateTime &pDst,fbxDouble44 const &pSrc ) { return false; }
00772 inline bool fbxCopy( fbxDateTime &pDst,fbxString const &pSrc ) { return pDst.fromString(pSrc); }
00773 inline bool fbxCopy( fbxDateTime &pDst,fbxTime const &pSrc ) { return false; }
00774 inline bool fbxCopy( fbxDateTime &pDst,fbxReference const &pSrc ) { return false; }
00775 inline bool fbxCopy( fbxDateTime &pDst,fbxBlob const &pSrc ) { return false; }
00776 inline bool fbxCopy( fbxDateTime &pDst,fbxDistance const &pSrc ) { return false; }
00777
00778 template< class T > inline bool fbxCopy( T &pDst,void const *pSrc,EFbxType pSrcType)
00779 {
00780 switch (pSrcType) {
00781 case eBOOL1: return fbxCopy( pDst,*(fbxBool1 *)pSrc );
00782 case eINTEGER1: return fbxCopy( pDst,*(fbxInteger1 *)pSrc );
00783 case eFLOAT1: return fbxCopy( pDst,*(fbxFloat1 *)pSrc );
00784 case eDOUBLE1: return fbxCopy( pDst,*(fbxDouble1 *)pSrc );
00785 case eDOUBLE2: return fbxCopy( pDst,*(fbxDouble2 *)pSrc );
00786 case eDOUBLE3: return fbxCopy( pDst,*(fbxDouble3 *)pSrc );
00787 case eDOUBLE4: return fbxCopy( pDst,*(fbxDouble4 *)pSrc );
00788 case eDOUBLE44: return fbxCopy( pDst,*(fbxDouble44 *)pSrc );
00789 case eENUM: return fbxCopy( pDst,*(fbxEnum *)pSrc );
00790 case eSTRING: return fbxCopy( pDst,*(fbxString *)pSrc );
00791 case eTIME: return fbxCopy( pDst,*(fbxTime *)pSrc );
00792 case eREFERENCE:
00793 K_ASSERT_MSG_NOW("Trying to set value on a void Reference type" );
00794 break;
00795 case eBLOB: return fbxCopy( pDst,*(fbxBlob *)pSrc );
00796 case eDISTANCE: return fbxCopy( pDst, *(fbxDistance *)pSrc );
00797 case eDATETIME: return fbxCopy( pDst, *(fbxDateTime *)pSrc );
00798 default:
00799 K_ASSERT_MSG_NOW("Trying to assign an unknown type" );
00800 }
00801 return false;
00802 }
00803
00804 template< class T > inline bool fbxCopy( void *pDst,EFbxType pDstType,T const &pSrc)
00805 {
00806 switch (pDstType) {
00807 case eBOOL1: return fbxCopy( *(fbxBool1 *)pDst,pSrc );
00808 case eINTEGER1: return fbxCopy( *(fbxInteger1 *)pDst,pSrc );
00809 case eFLOAT1: return fbxCopy( *(fbxFloat1 *)pDst,pSrc );
00810 case eDOUBLE1: return fbxCopy( *(fbxDouble1 *)pDst,pSrc );
00811 case eDOUBLE2: return fbxCopy( *(fbxDouble2 *)pDst,pSrc );
00812 case eDOUBLE3: return fbxCopy( *(fbxDouble3 *)pDst,pSrc );
00813 case eDOUBLE4: return fbxCopy( *(fbxDouble4 *)pDst,pSrc );
00814 case eDOUBLE44: return fbxCopy( *(fbxDouble44 *)pDst,pSrc );
00815 case eENUM: return fbxCopy( *(fbxEnum *)pDst,pSrc );
00816 case eSTRING: return fbxCopy( *(fbxString *)pDst,pSrc );
00817 case eTIME: return fbxCopy( *(fbxTime *)pDst,pSrc );
00818 case eREFERENCE:
00819 K_ASSERT_MSG_NOW("Trying to set value on a void Reference type" );
00820 break;
00821 case eBLOB: return fbxCopy( *(fbxBlob *)pDst,pSrc );
00822 case eDISTANCE: return fbxCopy( *(fbxDistance *)pDst, pSrc );
00823 case eDATETIME: return fbxCopy( *(fbxDateTime *)pDst, pSrc );
00824 default:
00825 K_ASSERT_MSG_NOW("Trying to assign an unknown type" );
00826 }
00827 return false;
00828 }
00829
00830 inline bool fbxCopy( void *pDst,EFbxType pDstType,void const *pSrc,EFbxType pSrcType)
00831 {
00832 switch (pSrcType) {
00833 case eBOOL1: return fbxCopy( pDst,pDstType,*(fbxBool1 *)pSrc );
00834 case eINTEGER1: return fbxCopy( pDst,pDstType,*(fbxInteger1 *)pSrc );
00835 case eFLOAT1: return fbxCopy( pDst,pDstType,*(fbxFloat1 *)pSrc );
00836 case eDOUBLE1: return fbxCopy( pDst,pDstType,*(fbxDouble1 *)pSrc );
00837 case eDOUBLE2: return fbxCopy( pDst,pDstType,*(fbxDouble2 *)pSrc );
00838 case eDOUBLE3: return fbxCopy( pDst,pDstType,*(fbxDouble3 *)pSrc );
00839 case eDOUBLE4: return fbxCopy( pDst,pDstType,*(fbxDouble4 *)pSrc );
00840 case eDOUBLE44: return fbxCopy( pDst,pDstType,*(fbxDouble44 *)pSrc );
00841 case eENUM: return fbxCopy( pDst,pDstType,*(fbxEnum *)pSrc );
00842 case eSTRING: return fbxCopy( pDst,pDstType,*(fbxString *)pSrc);
00843 case eTIME: return fbxCopy( pDst,pDstType,*(fbxTime*)pSrc);
00844 case eREFERENCE:
00845 K_ASSERT_MSG_NOW("Trying to set value on a void Reference type" );
00846 break;
00847 case eBLOB: return fbxCopy( pDst,pDstType,*(fbxBlob*)pSrc);
00848 case eDISTANCE: return fbxCopy(pDst, pDstType, *(fbxDistance*)pSrc);
00849 case eDATETIME: return fbxCopy(pDst, pDstType, *(fbxDateTime*)pSrc);
00850 default:
00851 K_ASSERT_MSG_NOW("Trying to assign an unknown type" );
00852 }
00853 return false;
00854 }
00855
00861 KFBX_DLL void* fbxCreate( EFbxType pType );
00862
00863
00871 KFBX_DLL bool fbxDestroy( EFbxType pType, void* pData );
00872
00873
00880 inline bool fbxCompare( const void* pA, const void* pB, EFbxType pType )
00881 {
00882 switch (pType) {
00883 case eBOOL1: return (*(fbxBool1*)pA) == (*(fbxBool1*)pB);
00884 case eINTEGER1: return (*(fbxInteger1*)pA) == (*(fbxInteger1*)pB);
00885 case eFLOAT1: return (*(fbxFloat1*)pA) == (*(fbxFloat1*)pB);
00886 case eDOUBLE1: return (*(fbxDouble1*)pA) == (*(fbxDouble1*)pB);
00887 case eDOUBLE2: return (*(fbxDouble2*)pA) == (*(fbxDouble2*)pB);
00888 case eDOUBLE3: return (*(fbxDouble3*)pA) == (*(fbxDouble3*)pB);
00889 case eDOUBLE4: return (*(fbxDouble4*)pA) == (*(fbxDouble4*)pB);
00890 case eDOUBLE44: return (*(fbxDouble44*)pA) == (*(fbxDouble44*)pB);
00891 case eENUM: return (*(fbxEnum*)pA) == (*(fbxEnum*)pB);
00892 case eSTRING: return (*(fbxString*)pA) == (*(fbxString*)pB);
00893 case eTIME: return (*(fbxTime*)pA) == (*(fbxTime*)pB);
00894 case eREFERENCE:
00895 K_ASSERT_MSG_NOW("Trying to compare value on a void Reference type" );
00896 break;
00897 case eBLOB: return (*(fbxBlob*)pA) == (*(fbxBlob*)pB);
00898 case eDISTANCE: return (*(fbxDistance*)pA) == (*(fbxDistance*)pB);
00899 case eDATETIME: return (*(fbxDateTime*)pA) == (*(fbxDateTime*)pB);
00900 default:
00901 K_ASSERT_MSG_NOW("Trying to compare an unknown type" );
00902 }
00903 return false;
00904 }
00905
00906 #include <fbxfilesdk_nsend.h>
00907
00908 #endif // _KFbxTypes_h
00909
00910