00001
00003 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXPROPERTY_H
00004 #define FBXFILESDK_KFBXPLUGINS_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 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00041
00042 #include <fbxfilesdk/components/kfcurve/kfcurvenode.h>
00043 #include <fbxfilesdk/fbxcore/kfbxevaluationinfo.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxdatatypes.h>
00045 #include <fbxfilesdk/fbxcore/kfbxpropertydef.h>
00046
00047
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049
00050
00051 class KFbxObject;
00052 class KFbxColor;
00053 class KFbxCriteria;
00054
00058 class KFBX_DLL KFbxProperty : private FbxPropertyFlags
00059 {
00064 public:
00065 using FbxPropertyFlags::eFbxPropertyFlags;
00066 using FbxPropertyFlags::eNO_FLAG;
00067 using FbxPropertyFlags::eANIMATABLE;
00068 using FbxPropertyFlags::eUSER;
00069 using FbxPropertyFlags::eTEMPORARY;
00070 using FbxPropertyFlags::ePUBLISHED;
00071 using FbxPropertyFlags::ePSTATIC;
00072
00073 using FbxPropertyFlags::eNOT_SAVABLE;
00074 using FbxPropertyFlags::eHIDDEN;
00075
00076 using FbxPropertyFlags::eUI_DISABLED;
00077 using FbxPropertyFlags::eUI_GROUP;
00078 using FbxPropertyFlags::eUI_BOOLGROUP;
00079 using FbxPropertyFlags::eUI_EXPANDED;
00080 using FbxPropertyFlags::eUI_NOCAPTION;
00081 using FbxPropertyFlags::eUI_PANEL;
00082
00083 typedef FbxPropertyFlags::eFbxPropertyFlags EFlags;
00084
00093 static KFbxProperty Create(KFbxProperty const &pCompoundProperty, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="",bool pCheckForDuplicate=true, bool* pWasFound=NULL);
00094
00104 template<typename T> inline static KFbxProperty Create(KFbxProperty const &pParentProperty, char const* pName,KFbxDataType const &pDataType,T const &pValue,eFbxPropertyFlags pFlags=eNO_FLAG,bool pCheckForDuplicate=true,bool pForceSet=true)
00105 {
00106 if( !pCheckForDuplicate )
00107 {
00108 KFbxProperty lProperty = Create(pParentProperty, pName, pDataType, "", pCheckForDuplicate);
00109 lProperty.ModifyFlag(pFlags, true);
00110 lProperty.Set(pValue);
00111 return lProperty;
00112 }
00113
00114
00115 KFbxProperty lProperty = pParentProperty.Find(pName);
00116
00117
00118
00119
00120
00121 if( !lProperty.IsValid() )
00122 lProperty = Create(pParentProperty, pName, pDataType, "", false);
00123
00124 lProperty.ModifyFlag(pFlags, true);
00125
00126
00127 lProperty.Set( &pValue,FbxTypeOf(pValue),!pForceSet);
00128 return lProperty;
00129 }
00130
00139 static KFbxProperty Create(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="",bool pCheckForDuplicate=true,bool* pWasFound=NULL);
00140
00146 static KFbxProperty Create(KFbxObject* pObject, KFbxProperty& pFromProperty, bool pCheckForDuplicate=true);
00147
00153 static KFbxProperty Create(KFbxProperty const& pCompoundProperty, KFbxProperty& pFromProperty, bool pCheckForDuplicate = true);
00154
00159 void Destroy(bool pRecursive = true, bool pDependents = false);
00160
00163 KFbxProperty();
00164
00168 KFbxProperty(KFbxProperty const &pProperty);
00169
00173 KFbxProperty(KFbxPropertyHandle const &pProperty);
00174
00177 ~KFbxProperty();
00178
00179 public:
00181
00186 public:
00190 KFbxDataType GetPropertyDataType() const;
00191
00195 KString GetName() const;
00196
00200 KString GetHierarchicalName() const;
00201
00211 KString GetLabel(bool pReturnNameIfEmpty=true);
00212
00213
00217 void SetLabel(KString pLabel);
00218
00222 KFbxObject* GetFbxObject() const;
00223
00225
00230 void SetUserTag(int pTag);
00231 int GetUserTag();
00232 void SetUserDataPtr(void* pUserData);
00233 void* GetUserDataPtr();
00235
00244 void ModifyFlag(eFbxPropertyFlags pFlag, bool pValue);
00245
00250 bool GetFlag(eFbxPropertyFlags pFlag);
00251
00256 KFbxInheritType GetFlagInheritType( eFbxPropertyFlags pFlag ) const;
00257
00263 bool SetFlagInheritType( eFbxPropertyFlags pFlag, KFbxInheritType pType );
00264
00269 bool ModifiedFlag( eFbxPropertyFlags pFlag ) const;
00271
00276 KFbxProperty & operator= (KFbxProperty const &pKProperty);
00277 bool operator== (KFbxProperty const &pKProperty) const;
00278 bool operator!= (KFbxProperty const &pKProperty) const;
00279 inline bool operator== (int pValue) const { return pValue==0 ? !IsValid() : IsValid(); }
00280 inline bool operator!= (int pValue) const { return pValue!=0 ? !IsValid() : IsValid(); }
00281 bool CompareValue(KFbxProperty const& pProp) const;
00283
00288 bool CopyValue(KFbxProperty const& pProp);
00289
00294 public:
00295
00297 bool IsValid() const;
00298
00303 static bool HasDefaultValue( KFbxProperty& pProperty );
00304
00311 bool Set(void const *pValue,EFbxType pValueType, bool pCheckForValueEquality);
00312
00318 inline bool Set(void const *pValue,EFbxType pValueType) { return Set( pValue, pValueType, true ); }
00319
00325 bool Get(void *pValue,EFbxType pValueType) const;
00326
00333 bool Get(void *pValue,EFbxType pValueType,KFbxEvaluationInfo const *pEvaluateInfo);
00334
00339 template <class T> inline bool Set( T const &pValue ) { return Set( &pValue,FbxTypeOf(pValue), true ); }
00340
00345 template <class T> inline T Get( T const *pFBX_TYPE) const { T lValue; Get( &lValue,FbxTypeOf(lValue) ); return lValue; }
00346
00352 template <class T> inline T Get( T const *pFBX_TYPE,KFbxEvaluationInfo const *pEvaluateInfo) { T lValue; Get( &lValue,FbxTypeOf(lValue),pEvaluateInfo ); return lValue; }
00353
00358 template <class T> inline T Get( KFbxEvaluationInfo const *pEvaluateInfo) { T lValue; Get( &lValue,FbxTypeOf(lValue),pEvaluateInfo ); return lValue; }
00359
00366 bool Get(void *pValue,EFbxType pValueType,KFbxEvaluationInfo *pEvaluateInfo) const;
00367
00373 KFbxInheritType GetValueInheritType() const;
00374
00385 bool SetValueInheritType( KFbxInheritType pType );
00386
00390 bool Modified() const;
00391
00393
00402 public:
00406 void SetMinLimit(double pMin);
00407
00412 bool HasMinLimit() const;
00413
00417 double GetMinLimit() const;
00418
00423 bool HasMaxLimit() const;
00424
00428 void SetMaxLimit(double pMax);
00432 double GetMaxLimit() const;
00433
00438 void SetLimits(double pMin, double pMax);
00440
00445 public:
00452 int AddEnumValue(char const *pStringValue);
00453
00461 void InsertEnumValue(int pIndex, char const *pStringValue);
00462
00467 int GetEnumCount();
00468
00477 void SetEnumValue(int pIndex, char const *pStringValue);
00478
00482 void RemoveEnumValue(int pIndex);
00483
00488 char * GetEnumValue(int pIndex);
00490
00495 inline bool IsRoot() const { return mPropertyHandle.IsRoot(); }
00496 inline bool IsChildOf(KFbxProperty const & pParent) const { return mPropertyHandle.IsChildOf(pParent.mPropertyHandle); }
00497 inline bool IsDescendentOf(KFbxProperty const & pAncestor) const { return mPropertyHandle.IsDescendentOf(pAncestor.mPropertyHandle); }
00498 inline KFbxProperty GetParent() const { return KFbxProperty(mPropertyHandle.GetParent()); }
00499 bool SetParent( const KFbxProperty& pOther );
00500 inline KFbxProperty GetChild() const { return KFbxProperty(mPropertyHandle.GetChild()); }
00501 inline KFbxProperty GetSibling() const { return KFbxProperty(mPropertyHandle.GetSibling()); }
00502
00507 inline KFbxProperty GetFirstDescendent() const { return KFbxProperty(mPropertyHandle.GetFirstDescendent()); }
00513 inline KFbxProperty GetNextDescendent(KFbxProperty const &pProperty) const { return KFbxProperty(mPropertyHandle.GetNextDescendent(pProperty.mPropertyHandle)); }
00514
00521 inline KFbxProperty Find (char const *pName,bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,pCaseSensitive)); }
00522 inline KFbxProperty Find (char const *pName,KFbxDataType const &pDataType, bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,pDataType.GetTypeInfoHandle(),pCaseSensitive)); }
00529 inline KFbxProperty FindHierarchical (char const *pName,bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pCaseSensitive)); }
00530 inline KFbxProperty FindHierarchical (char const *pName,KFbxDataType const &pDataType, bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pDataType.GetTypeInfoHandle(),pCaseSensitive)); }
00531
00533
00538 inline void BeginCreateOrFindProperty() { mPropertyHandle.BeginCreateOrFindProperty(); }
00539 inline void EndCreateOrFindProperty() { mPropertyHandle.EndCreateOrFindProperty(); }
00540
00541 struct KFbxPropertyNameCache
00542 {
00543 KFbxPropertyNameCache(const KFbxProperty& prop) :
00544 mProp(const_cast<KFbxProperty&>(prop))
00545 {
00546 mProp.BeginCreateOrFindProperty();
00547 }
00548
00549 ~KFbxPropertyNameCache()
00550 {
00551 mProp.EndCreateOrFindProperty();
00552 }
00553
00554 private:
00555 KFbxProperty & mProp;
00556
00557 KFbxPropertyNameCache& operator=(const KFbxPropertyNameCache &other) { mProp = other.mProp; mProp.BeginCreateOrFindProperty(); return *this; }
00558 };
00560
00565 bool SetArraySize( int pSize, bool pVariableArray );
00566 int GetArraySize() const;
00567 KFbxProperty GetArrayItem(int pIndex) const;
00568 inline KFbxProperty operator[](int pIndex) const { return GetArrayItem(pIndex); }
00570
00578 KFCurveNode* CreateKFCurveNode(const char* pTakeName=NULL);
00579
00585 KFCurveNode* GetKFCurveNode(bool pCreateAsNeeded=false, const char* pTakeName=NULL);
00586
00594 KFCurve* GetKFCurve(const char* pChannel = NULL);
00595
00605 KFCurve* GetKFCurve(const char* pChannel, const char* pTakeName);
00607
00612 bool Evaluate(KFbxEvaluationInfo const *pEvaluationInfo);
00614
00619 public:
00620
00621 bool ConnectSrcObject (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone);
00622 bool IsConnectedSrcObject (const KFbxObject* pObject) const;
00623 bool DisconnectSrcObject (KFbxObject* pObject);
00624
00625 bool DisconnectAllSrcObject();
00626 bool DisconnectAllSrcObject(KFbxCriteria const &pCriteria);
00627 bool DisconnectAllSrcObject(const kFbxClassId& pClassId);
00628 bool DisconnectAllSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria);
00629
00630 int GetSrcObjectCount()const;
00631 int GetSrcObjectCount(KFbxCriteria const &pCriteria)const;
00632 int GetSrcObjectCount(const kFbxClassId& pClassId)const;
00633 int GetSrcObjectCount(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria)const;
00634
00635 KFbxObject* GetSrcObject(int pIndex=0) const;
00636 KFbxObject* GetSrcObject(KFbxCriteria const &pCriteria,int pIndex=0) const;
00637 KFbxObject* GetSrcObject(const kFbxClassId& pClassId,int pIndex=0) const;
00638 KFbxObject* GetSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const;
00639
00640 KFbxObject* FindSrcObject(const char *pName,int pStartIndex=0) const;
00641 KFbxObject* FindSrcObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00642 KFbxObject* FindSrcObject(const kFbxClassId& pClassId,const char *pName,int pStartIndex=0) const;
00643 KFbxObject* FindSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00644
00645 template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE){ return DisconnectAllSrcObject(T::ClassId);}
00646 template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria) { return DisconnectAllSrcObject(T::ClassId,pCriteria); }
00647 template < class T > inline int GetSrcObjectCount(T const *pFBX_TYPE) const{ return GetSrcObjectCount(T::ClassId); }
00648 template < class T > inline int GetSrcObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return GetSrcObjectCount(T::ClassId,pCriteria); }
00649 template < class T > inline T* GetSrcObject(T const *pFBX_TYPE,int pIndex=0) const { return (T*)GetSrcObject(T::ClassId,pIndex); }
00650 template < class T > inline T* GetSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return (T*)GetSrcObject(T::ClassId,pCriteria,pIndex); }
00651 template < class T > inline T* FindSrcObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return (T*)FindSrcObject(T::ClassId,pName,pStartIndex); }
00652 template < class T > inline T* FindSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return (T*)FindSrcObject(T::ClassId,pCriteria,pName,pStartIndex); }
00653
00654
00655 bool ConnectDstObject (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone);
00656 bool IsConnectedDstObject (const KFbxObject* pObject) const;
00657 bool DisconnectDstObject (KFbxObject* pObject);
00658
00659 bool DisconnectAllDstObject();
00660 bool DisconnectAllDstObject(KFbxCriteria const &pCriteria);
00661 bool DisconnectAllDstObject(const kFbxClassId& pClassId);
00662 bool DisconnectAllDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria);
00663
00664 int GetDstObjectCount() const;
00665 int GetDstObjectCount(KFbxCriteria const &pCriteria) const;
00666 int GetDstObjectCount(const kFbxClassId& pClassId) const;
00667 int GetDstObjectCount(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria) const;
00668
00669 KFbxObject* GetDstObject(int pIndex=0) const;
00670 KFbxObject* GetDstObject(KFbxCriteria const &pCriteria,int pIndex=0) const;
00671 KFbxObject* GetDstObject(const kFbxClassId& pClassId,int pIndex=0) const;
00672 KFbxObject* GetDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,int pIndex=0)const;
00673
00674 KFbxObject* FindDstObject(const char *pName,int pStartIndex=0) const;
00675 KFbxObject* FindDstObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00676 KFbxObject* FindDstObject(const kFbxClassId& pClassId,const char *pName,int pStartIndex=0) const;
00677 KFbxObject* FindDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00678
00679 template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE){ return DisconnectAllDstObject(T::ClassId); }
00680 template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria) { return DisconnectAllDstObject(T::ClassId,pCriteria); }
00681 template < class T > inline int GetDstObjectCount(T const *pFBX_TYPE) const { return GetDstObjectCount(T::ClassId); }
00682 template < class T > inline int GetDstObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return GetDstObjectCount(T::ClassId,pCriteria); }
00683 template < class T > inline T* GetDstObject(T const *pFBX_TYPE,int pIndex=0) const { return (T*)GetDstObject(T::ClassId,pIndex); }
00684 template < class T > inline T* GetDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return (T*)GetDstObject(T::ClassId,pCriteria,pIndex); }
00685 template < class T > inline T* FindDstObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return (T*)FindDstObject(T::ClassId,pName,pStartIndex); }
00686 template < class T > inline T* FindDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const { return (T*)FindDstObject(T::ClassId,pCriteria,pName,pStartIndex); }
00688
00693 public:
00694
00695 bool ConnectSrcProperty (KFbxProperty const & pProperty);
00696 bool IsConnectedSrcProperty (KFbxProperty const & pProperty);
00697 bool DisconnectSrcProperty (KFbxProperty const & pProperty);
00698 int GetSrcPropertyCount () const;
00699 KFbxProperty GetSrcProperty (int pIndex=0) const;
00700 KFbxProperty FindSrcProperty (const char *pName,int pStartIndex=0) const;
00701
00702 bool ConnectDstProperty (KFbxProperty const & pProperty);
00703 bool IsConnectedDstProperty (KFbxProperty const & pProperty);
00704 bool DisconnectDstProperty (KFbxProperty const & pProperty);
00705 int GetDstPropertyCount () const;
00706 KFbxProperty GetDstProperty (int pIndex=0) const;
00707 KFbxProperty FindDstProperty (const char *pName,int pStartIndex=0) const;
00708
00709 void ClearConnectCache();
00710
00712
00713 static const char* sHierarchicalSeparator;
00714
00715
00716 typedef enum { eUNIDENTIFIED,eBOOL,eREAL,eCOLOR,eINTEGER,eVECTOR,eLIST,eMATRIX,eSTRING1 } EUserPropertyType;
00717
00718 K_DEPRECATED static const char* GetPropertyTypeName(EUserPropertyType pType);
00719 K_DEPRECATED const char * GetPropertyTypeName();
00720 K_DEPRECATED EUserPropertyType GetPropertyType();
00721
00722 K_DEPRECATED void SetDefaultValue(bool pValue);
00723 K_DEPRECATED void SetDefaultValue(double pValue);
00724 K_DEPRECATED void SetDefaultValue(KFbxColor& pValue);
00725 K_DEPRECATED void SetDefaultValue(int pValue);
00726 K_DEPRECATED void SetDefaultValue(double pValue1, double pValue2, double pValue3);
00727 K_DEPRECATED void GetDefaultValue(bool& pValue);
00728 K_DEPRECATED void GetDefaultValue(double& pValue);
00729 K_DEPRECATED void GetDefaultValue(KFbxColor& pValue);
00730 K_DEPRECATED void GetDefaultValue(int& pValue);
00731 K_DEPRECATED void GetDefaultValue(double& pValue1, double& pValue2, double& pValue3);
00732
00734
00735
00736
00738 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00739
00740 protected:
00742 KFbxProperty(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00743 KFbxProperty(KFbxProperty const & pParent, char const* pName, KFbxDataType const &pDataType, char const* pLabel);
00744
00745
00746 private:
00747 bool ConnectSrc (KFbxProperty const &pProperty,kFbxConnectionType pType=eFbxConnectionNone);
00748 bool DisconnectSrc (KFbxProperty const &pProperty);
00749 bool DisconnectAllSrc();
00750 bool DisconnectAllSrc(KFbxCriteria const &pCriteria);
00751 bool IsConnectedSrc (KFbxProperty const &pProperty) const;
00752 int GetSrcCount () const;
00753 int GetSrcCount (KFbxCriteria const &pCriteria) const;
00754 KFbxProperty GetSrc (int pIndex=0) const;
00755 KFbxProperty GetSrc (KFbxCriteria const &pCriteria,int pIndex=0) const;
00756 KFbxProperty FindSrc (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00757
00758 bool ConnectDst (KFbxProperty const &pProperty,kFbxConnectionType pType=eFbxConnectionNone);
00759 bool DisconnectDst (KFbxProperty const &pProperty);
00760 bool DisconnectAllDst();
00761 bool DisconnectAllDst(KFbxCriteria const &pCriteria);
00762 bool IsConnectedDst (KFbxProperty const &pProperty) const;
00763 int GetDstCount () const;
00764 int GetDstCount (KFbxCriteria const &pCriteria) const;
00765 KFbxProperty GetDst (int pIndex=0) const;
00766 KFbxProperty GetDst (KFbxCriteria const &pCriteria,int pIndex=0) const;
00767 KFbxProperty FindDst (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00768 private:
00770 mutable KFbxPropertyHandle mPropertyHandle;
00771
00772 friend class KFbxObject;
00773 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00774 };
00775
00776 typedef KFbxProperty* HKFbxProperty;
00777
00778 template <class T> inline bool KFbxSet( KFbxProperty &pProperty,T const &pValue, bool pCheckValueEquality = true ) { return pProperty.Set( &pValue,FbxTypeOf(pValue),pCheckValueEquality ); }
00779 template <class T> inline bool KFbxGet( KFbxProperty const& pProperty,T &pValue ) { return pProperty.Get( &pValue,FbxTypeOf(pValue) ); }
00780 template <class T> inline bool KFbxGet( KFbxProperty& pProperty, T &pValue, KFbxEvaluationInfo const* pInfo) { return pProperty.Get( &pValue, FbxTypeOf(pValue), pInfo ); }
00781 template <class T> inline T KFbxGet( KFbxProperty const& pProperty) { T pValue; pProperty.Get( &pValue,FbxTypeOf(pValue) ); return pValue; }
00782
00783
00784 template <class T> class KFbxTypedProperty : public KFbxProperty {
00785 public:
00786 inline KFbxTypedProperty() : KFbxProperty() {}
00787 inline KFbxTypedProperty(KFbxProperty const &pProperty) : KFbxProperty(pProperty) {}
00788 inline ~KFbxTypedProperty() {}
00789
00790 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,eFbxPropertyFlags pFlags=eNO_FLAG)
00791 {
00792 *this = Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "");
00793 ModifyFlag(pFlags, true);
00794 return *this;
00795 }
00796
00797 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,T const &pValue,bool pForceSet=true,eFbxPropertyFlags pFlags=eNO_FLAG)
00798 {
00799 bool lWasFound = false;
00800 *this = Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "",true,&lWasFound);
00801
00802 if( pForceSet || !lWasFound )
00803 {
00804 ModifyFlag(pFlags, true);
00805 Set(pValue,false);
00806 }
00807
00808 return *this;
00809 }
00810 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,eFbxPropertyFlags pFlags=eNO_FLAG)
00811 {
00812 *this = Create(pObject, pName, pDataType, "");
00813 ModifyFlag(pFlags, true);
00814 return *this;
00815 }
00816 inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,T const &pValue, bool pForceSet=true, eFbxPropertyFlags pFlags=eNO_FLAG)
00817 {
00818 bool lWasFound = false;
00819 *this = Create(pObject, pName, pDataType, "",true,&lWasFound);
00820
00821 if( pForceSet || !lWasFound )
00822 {
00823 ModifyFlag(pFlags, true);
00824
00825 Set(pValue,false);
00826 }
00827
00828 return *this;
00829 }
00830
00831 inline KFbxProperty const & StaticInit(KFbxProperty pCompound, char const* pName, KFbxDataType const &pDataType,T const &pValue, bool pForceSet=true, eFbxPropertyFlags pFlags=eNO_FLAG)
00832 {
00833 bool lWasFound = false;
00834 *this = Create(pCompound, pName, pDataType, "",true,&lWasFound);
00835
00836 if( pForceSet || !lWasFound )
00837 {
00838 ModifyFlag(pFlags, true);
00839
00840 Set(pValue,false);
00841 }
00842
00843 return *this;
00844 }
00845 public:
00846 KFbxTypedProperty &operator =(T const &pValue) { KFbxSet(*this,pValue); return *this; }
00847 bool Set(T const &pValue, bool pCheckValueEquality ) { return KFbxSet(*this,pValue,pCheckValueEquality); }
00848 bool Set(T const &pValue ) { return KFbxSet(*this,pValue,true); }
00849 T Get() const { T lValue; KFbxGet(*this,lValue); return lValue; }
00850 T Get( KFbxEvaluationInfo const* pInfo ) { T lValue; KFbxGet( *this, lValue, pInfo); return lValue; }
00851
00852 friend class KFbxObject;
00853 };
00854
00855
00856 KFBX_DLL KFbxDataType EUserPropertyTypeToDataType(KFbxProperty::EUserPropertyType);
00857 KFBX_DLL KFbxProperty::EUserPropertyType DataTypeToEUserPropertyType(const KFbxDataType &pDataType);
00858
00859
00860 template <> class KFbxTypedProperty<fbxReference*> : public KFbxProperty
00861 {
00862 public:
00863 inline KFbxTypedProperty() : KFbxProperty()
00864 {}
00865 inline KFbxTypedProperty(KFbxProperty const &pProperty)
00866 : KFbxProperty(pProperty)
00867 {}
00868 inline ~KFbxTypedProperty()
00869 {}
00870
00871 inline KFbxProperty const & StaticInit(KFbxObject* pObject,char const* pName,eFbxPropertyFlags pFlags=eNO_FLAG)
00872 {
00873 *this = KFbxProperty::Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((fbxReference* *)0))), "");
00874 ModifyFlag(pFlags, true);
00875 return *this;
00876 }
00877
00878 inline KFbxProperty const & StaticInit(KFbxObject* pObject,
00879 char const* pName,
00880 fbxReference* const &pValue,
00881 bool pForceSet=true,
00882 eFbxPropertyFlags pFlags=eNO_FLAG
00883 )
00884 {
00885 bool lWasFound = false;
00886 *this = KFbxProperty::Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((fbxReference* *)0))), "",true, &lWasFound);
00887 if( pForceSet || !lWasFound )
00888 {
00889 ModifyFlag(pFlags, true);
00890 Set(pValue,false);
00891 }
00892
00893 return *this;
00894 }
00895
00896 inline KFbxProperty const & StaticInit(KFbxObject* pObject,
00897 char const* pName,
00898 KFbxDataType const &pDataType,
00899 eFbxPropertyFlags pFlags=eNO_FLAG)
00900 {
00901 *this = KFbxProperty::Create(pObject, pName, pDataType, "");
00902
00903 ModifyFlag(pFlags, true);
00904 return *this;
00905 }
00906
00907 inline KFbxProperty const & StaticInit(KFbxObject* pObject,
00908 char const* pName,
00909 KFbxDataType const &pDataType,
00910 fbxReference* const &pValue,
00911 bool pForceSet=true,
00912 eFbxPropertyFlags pFlags=eNO_FLAG
00913 )
00914 {
00915 bool lWasFound = false;
00916 *this = KFbxProperty::Create(pObject, pName, pDataType, "",true,&lWasFound);
00917
00918 if( pForceSet || !lWasFound )
00919 {
00920 ModifyFlag(pFlags, true);
00921 Set(pValue,false);
00922 }
00923
00924 return *this;
00925 }
00926
00927 public:
00928 KFbxTypedProperty &operator =(fbxReference* const &pValue)
00929 {
00930 KFbxSet(*this,pValue);
00931 return *this;
00932 }
00933
00934 inline bool Set(fbxReference* const &pValue ) { return Set(pValue, true); }
00935
00936 bool Set(fbxReference* const &pValue, bool pCheckValueEquality )
00937 {
00938 KFbxObject* lValue = reinterpret_cast<KFbxObject*>(pValue);
00939 DisconnectAllSrcObject();
00940 if (lValue) {
00941 return ConnectSrcObject(lValue);
00942 }
00943
00944 return false;
00945 }
00946
00947 fbxReference* Get() const
00948 {
00949 KFbxObject* lValue = GetSrcObjectCount() > 0 ? GetSrcObject(0) : NULL;
00950 return reinterpret_cast<fbxReference*>(lValue);
00951 }
00952
00953 friend class KFbxObject;
00954 };
00955
00956
00957 typedef KFbxTypedProperty<fbxBool1> KFbxPropertyBool1;
00958 typedef KFbxTypedProperty<fbxInteger1> KFbxPropertyInteger1;
00959 typedef KFbxTypedProperty<fbxDouble1> KFbxPropertyDouble1;
00960 typedef KFbxTypedProperty<fbxDouble3> KFbxPropertyDouble3;
00961 typedef KFbxTypedProperty<fbxDouble4> KFbxPropertyDouble4;
00962 typedef KFbxTypedProperty<fbxString> KFbxPropertyString;
00963 typedef KFbxTypedProperty<fbxReference*> KFbxPropertyReference;
00964
00965 enum eFbxConnectEventType {
00966 eFbxConnectRequest,
00967 eFbxConnect,
00968 eFbxConnected,
00969 eFbxDisconnectRequest,
00970 eFbxDisconnect,
00971 eFbxDisconnected
00972 };
00973
00974 enum eFbxConnectEventDirection {
00975 eConnectEventSrc,
00976 eConnectEventDst
00977 };
00978
00982 class KFBX_DLL KFbxConnectEvent
00983 {
00988 public:
00989 inline KFbxConnectEvent(eFbxConnectEventType pType,eFbxConnectEventDirection pDir,KFbxProperty *pSrc,KFbxProperty *pDst)
00990 : mType(pType)
00991 , mDirection(pDir)
00992 , mSrc(pSrc)
00993 , mDst(pDst)
00994 {
00995 }
00997
01002 public:
01003 inline eFbxConnectEventType GetType() const { return mType; }
01004 inline eFbxConnectEventDirection GetDirection() const { return mDirection; }
01005 inline KFbxProperty &GetSrc() const { return *mSrc; }
01006 inline KFbxProperty &GetDst() const { return *mDst; }
01007
01008 template < class T > inline T* GetSrcIfObject(T const *pFBX_TYPE) const { return mSrc->IsRoot() ? KFbxCast<T>(mSrc->GetFbxObject()) : (T*)0; }
01009 template < class T > inline T* GetDstIfObject(T const *pFBX_TYPE) const { return mDst->IsRoot() ? KFbxCast<T>(mDst->GetFbxObject()) : (T*)0; }
01011
01012 private:
01013 eFbxConnectEventType mType;
01014 eFbxConnectEventDirection mDirection;
01015 KFbxProperty* mSrc;
01016 KFbxProperty* mDst;
01017 };
01018
01019
01020
01021 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01022
01023 #endif // FBXFILESDK_KFBXPLUGINS_KFBXPROPERTY_H
01024