00001
00003 #ifndef _KFbxProperty_h
00004 #define _KFbxProperty_h
00005
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 #include <kaydaradef.h>
00042 #ifndef KFBX_DLL
00043 #define KFBX_DLL K_DLLIMPORT
00044 #endif
00045
00046 #ifndef MB_FBXSDK
00047 #include <kbaselib_nsuse.h>
00048 #endif
00049 #include <kbaselib_forward.h>
00050
00051 #include <klib/kstring.h>
00052 #include <kfbxplugins/kfbxplug.h>
00053 #include <kfbxplugins/kfbxtypes.h>
00054 #include <kfcurve/kfcurvenode.h>
00055 #include <fbxfilesdk_nsbegin.h>
00056
00057 class KFbxObject;
00058
00059 class KFbxColor;
00060 class KFbxObject;
00061 class KFbxObject_internal;
00062 class KFbxProperty_internal;
00063 class KFbxSdkManager;
00064
00068 class KFBX_DLL KFbxProperty : public KFbxPlug
00069 {
00070 KFBXPLUG_DECLARE(KFbxProperty);
00071
00076 public:
00083 static KFbxProperty Create(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00084
00089 static KFbxProperty Create(KFbxObject* pObject, KFbxProperty& pFromProperty);
00090
00097 static KFbxProperty Create(KFbxProperty const &pCompoundProperty, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00098
00106 KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType, char const* pLabel);
00107
00110 void Destroy(bool pRecursive = true, bool pDependents = false);
00111
00114 KFbxProperty();
00115
00118 KFbxProperty(KFbxProperty const &pProperty);
00119
00122 ~KFbxProperty();
00123
00124 public:
00126
00130 public:
00134 KFbxDataType GetPropertyDataType() const;
00135
00139 KString GetName() const;
00140
00150 KString GetLabel(bool pReturnNameIfEmpty=true);
00151
00152
00156 void SetLabel(KString pLabel);
00157
00161 KFbxObject* GetFbxObject();
00162
00163 void SetUserTag(int pTag);
00164 int GetUserTag();
00166
00171
00178 typedef enum
00179 {
00180 eNO_FLAG = 0,
00181 eANIMATABLE = 1,
00182 eUSER = 1<<1,
00183 eTEMPORARY = 1<<2,
00184 ePUBLISHED = 1<<3,
00185 eSTATIC = 1<<4,
00186 } EFlags;
00187
00192 void ModifyFlag(EFlags pFlag, bool pValue);
00193
00198 bool GetFlag(EFlags pFlag);
00200
00202 KFbxProperty & operator= (KFbxProperty const &pKProperty);
00203 bool operator==(KProperty const* pKProperty) const;
00204 bool operator== (KFbxProperty const &pKProperty) const;
00205 bool operator!= (KFbxProperty const &pKProperty) const;
00206 bool CompareValue(KFbxProperty const& pProp) const;
00207
00212 bool CopyValue(KFbxProperty const& pProp);
00213
00214
00219 bool IsValid() const;
00220
00224 bool Set(void const *pValue,EFbxType pValueType);
00225
00229 bool Get(void *pValue,EFbxType pValueType) const;
00230
00231
00232 template <class T> inline bool Set( T const &pValue ) { return Set( &pValue,FbxTypeOf(pValue) ); }
00233 template <class T> inline T Get( T const *pFBX_TYPE) const { T lValue; Get( &lValue,FbxTypeOf(lValue) ); return lValue; }
00234
00236
00248 void SetMinLimit(double pMin);
00249
00253 double GetMinLimit();
00254
00258 void SetMaxLimit(double pMax);
00262 double GetMaxLimit();
00263
00268 void SetLimits(double pMin, double pMax);
00270
00281 int AddEnumValue(char const *pStringValue);
00282
00290 void InsertEnumValue(int pIndex, char const *pStringValue);
00291
00296 int GetEnumCount();
00297
00306 void SetEnumValue(int pIndex, char const *pStringValue);
00307
00311 void RemoveEnumValue(int pIndex);
00312
00318 char * GetEnumValue(int pIndex);
00320
00325 int GetPropertyCount();
00326 KFbxProperty GetProperty(int pIndex);
00328
00333 bool SetArraySize( int pSize, bool pVariableArray );
00334 int GetArraySize();
00335 KFbxProperty GetArrayItem(int pIndex);
00336 inline KFbxProperty operator[](int pIndex) { return GetArrayItem(pIndex); }
00338
00346 KFCurveNode* CreateKFCurveNode(const char* pTakeName=NULL);
00347
00353 KFCurveNode* GetKFCurveNode(bool pCreateAsNeeded=false, const char* pTakeName=NULL);
00354
00355
00357
00362
00363 inline int GetSrcPropertyCount () { return GetFbxSrcCount(KFbxProperty::ClassId); }
00364 inline KFbxProperty GetSrcProperty (int pIndex=0) { return *((KFbxProperty *)GetFbxSrc(pIndex,KFbxProperty::ClassId)); }
00365 inline KFbxProperty FindSrcProperty (const char *pName,int pStartIndex=0) { return *((KFbxProperty *)FindFbxSrc(pName,KFbxProperty::ClassId,pStartIndex)); }
00366 inline bool ConnectSrcProperty (KFbxProperty const & pProperty) { return ConnectFbxSrc((KFbxPlug *)&pProperty); }
00367 inline bool IsConnectedSrcProperty (KFbxProperty const & pProperty) { return IsConnectedFbxSrc((KFbxPlug *)&pProperty); }
00368 inline bool DisconnectSrcProperty (KFbxProperty const & pProperty) { return DisconnectFbxSrc((KFbxPlug *)&pProperty); }
00369
00370 inline int GetDstPropertyCount () { return GetFbxDstCount(KFbxProperty::ClassId); }
00371 inline KFbxProperty GetDstProperty (int pIndex=0) { return *((KFbxProperty *)GetFbxDst(pIndex,KFbxProperty::ClassId)); }
00372 inline KFbxProperty FindDstProperty (const char *pName,int pStartIndex=0) { return *((KFbxProperty *)FindFbxDst(pName,KFbxProperty::ClassId,pStartIndex)); }
00373 inline bool ConnectDstProperty (KFbxProperty const & pProperty) { return ConnectFbxDst((KFbxPlug *)&pProperty); }
00374 inline bool IsConnectedDstProperty (KFbxProperty const & pProperty) { return IsConnectedFbxDst((KFbxPlug *)&pProperty); }
00375 inline bool DisconnectDstProperty (KFbxProperty const & pProperty) { return DisconnectFbxDst((KFbxPlug *)&pProperty); }
00377
00378 virtual void SetUserDataPtr(void* pUserData);
00379 virtual void* GetUserDataPtr();
00380
00381
00382
00383 typedef enum { eUNIDENTIFIED,eBOOL,eREAL,eCOLOR,eINTEGER,eVECTOR,eLIST, eMATRIX} EUserPropertyType;
00384
00385
00386 K_DEPRECATED static char* GetPropertyTypeName(EUserPropertyType pType);
00387 K_DEPRECATED char * GetPropertyTypeName();
00388 K_DEPRECATED EUserPropertyType GetPropertyType();
00389
00390 K_DEPRECATED void SetDefaultValue(bool pValue);
00391 K_DEPRECATED void SetDefaultValue(double pValue);
00392 K_DEPRECATED void SetDefaultValue(KFbxColor& pValue);
00393 K_DEPRECATED void SetDefaultValue(int pValue);
00394 K_DEPRECATED void SetDefaultValue(double pValue1, double pValue2, double pValue3);
00395 K_DEPRECATED void GetDefaultValue(bool& pValue);
00396 K_DEPRECATED void GetDefaultValue(double& pValue);
00397 K_DEPRECATED void GetDefaultValue(KFbxColor& pValue);
00398 K_DEPRECATED void GetDefaultValue(int& pValue);
00399 K_DEPRECATED void GetDefaultValue(double& pValue1, double& pValue2, double& pValue3);
00400
00402
00403
00404
00405
00406
00407
00409 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00410 protected:
00411
00412
00413
00414
00415
00417 static KFbxProperty* Create(KFbxSdkManager& pManager, KProperty* pProperty);
00418 KFbxProperty(KFbxSdkManager& pManager, KProperty* pProperty);
00419 KFbxProperty(KFbxSdkManager& pManager, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00420 KFbxProperty(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00421 KFbxProperty(KFbxProperty_internal *pPropertyInfo);
00422
00423 void Init(KFbxSdkManager& pManager, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00424
00425
00426 virtual KFbxSdkManager* GetFbxSdkManager();
00427 virtual KPlug* GetInternalPlug(bool pCreateOnDemand=false);
00428 virtual KPlug const* GetInternalPlug(bool pCreateOnDemand=false) const;
00429 bool CreateKProperty();
00430 bool DestroyKProperty();
00431 KProperty* GetKProperty();
00432 bool FbxPlugNotify(KFbxPlugEvent const &pEvent);
00433
00434 void SetFbxObject(KFbxObject* pKFbxObject);
00435
00436
00437
00438 private:
00440 KFbxProperty_internal* mData;
00441
00442
00443 friend class KFbxObject;
00444 friend class KFbxTakeNodeContainer;
00445 friend class KFbxObject_internal;
00446 friend class KFbxReaderFbx;
00447
00448 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00449 };
00450
00451 typedef KFbxProperty* HKFbxProperty;
00452
00453 template <class T> inline bool KFbxSet( KFbxProperty &pProperty,T const &pValue ) { return pProperty.Set( &pValue,FbxTypeOf(pValue) ); }
00454 template <class T> inline bool KFbxGet( KFbxProperty const& pProperty,T &pValue ) { return pProperty.Get( &pValue,FbxTypeOf(pValue) ); }
00455 template <class T> inline T KFbxGet( KFbxProperty const& pProperty) { T pValue; pProperty.Get( &pValue,FbxTypeOf(pValue) ); return pValue; }
00456
00457 template <class T> class KFbxTypedProperty : public KFbxProperty {
00458 public:
00459 inline KFbxTypedProperty() : KFbxProperty() {}
00460 inline KFbxTypedProperty(KFbxProperty const &pProperty) : KFbxProperty(pProperty) {}
00461 inline ~KFbxTypedProperty() {}
00462
00463 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,EFlags pFlags=eNO_FLAG)
00464 {
00465 KFbxProperty::StaticInit(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "");
00466 ModifyFlag(pFlags, true);
00467 return *this;
00468 }
00469 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,T const &pValue,EFlags pFlags=eNO_FLAG)
00470 {
00471 KFbxProperty::StaticInit(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "");
00472 Set(pValue);
00473 ModifyFlag(pFlags, true);
00474 return *this;
00475 }
00476
00477 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,EFlags pFlags=eNO_FLAG)
00478 {
00479 KFbxProperty::StaticInit(pObject, pName, pDataType, "");
00480 ModifyFlag(pFlags, true);
00481 return *this;
00482 }
00483 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,T const &pValue,EFlags pFlags=eNO_FLAG)
00484 {
00485 KFbxProperty::StaticInit(pObject, pName, pDataType, "");
00486 Set(pValue);
00487 ModifyFlag(pFlags, true);
00488 return *this;
00489 }
00490 public:
00491 KFbxTypedProperty &operator =(T const &pValue) { KFbxSet(*this,pValue); return *this; }
00492 bool Set(T const &pValue) { return KFbxSet(*this,pValue); }
00493 T Get() const { T lValue; KFbxGet(*this,lValue); return lValue; }
00494
00495 friend class KFbxObject;
00496 };
00497
00498
00499 KFbxDataType EUserPropertyTypeToDataType(KFbxProperty::EUserPropertyType);
00500 KFbxProperty::EUserPropertyType DataTypeToEUserPropertyType(const KFbxDataType &pDataType);
00501
00502
00503 typedef KFbxTypedProperty<fbxBool1> KFbxPropertyBool1;
00504 typedef KFbxTypedProperty<fbxInteger1> KFbxPropertyInteger1;
00505 typedef KFbxTypedProperty<fbxDouble1> KFbxPropertyDouble1;
00506 typedef KFbxTypedProperty<fbxDouble3> KFbxPropertyDouble3;
00507 typedef KFbxTypedProperty<fbxDouble4> KFbxPropertyDouble4;
00508 typedef KFbxTypedProperty<fbxString> KFbxPropertyString;
00509
00510
00511 #include <fbxfilesdk_nsend.h>
00512
00513 #endif // _KFbxProperty_h
00514
00515