FBX SDK Reference Guide: kfbxproperty.h Source File
Go to the documentation of this file.
00001 
00003 #ifndef _KFbxProperty_h
00004 #define _KFbxProperty_h
00005 
00006 /**************************************************************************************
00007 
00008  Copyright © 2001 - 2008 Autodesk, Inc. and/or its licensors.
00009  All Rights Reserved.
00010 
00011  The coded instructions, statements, computer programs, and/or related material 
00012  (collectively the "Data") in these files contain unpublished information 
00013  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00014  Canada and United States of America federal copyright law and by international 
00015  treaties. 
00016  
00017  The Data may not be disclosed or distributed to third parties, in whole or in
00018  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00019 
00020  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00021  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00022  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00023  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00024  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00025  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00026  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00027  
00028  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00029  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00030  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00031  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00032  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00033  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00034  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00035  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00036  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00037  OR DAMAGE. 
00038 
00039 **************************************************************************************/
00040 #include <kaydaradef.h>
00041 #ifndef KFBX_DLL
00042     #define KFBX_DLL K_DLLIMPORT
00043 #endif
00044 
00045 #ifndef MB_FBXSDK
00046 #include <kbaselib_nsuse.h>
00047 #endif
00048 
00049 // FBX includes
00050 #include <kfcurve/kfcurvenode.h>
00051 #include <fbxcore/kfbxevaluationinfo.h>
00052 #include <kfbxplugins/kfbxdatatypes.h>
00053 #include <fbxcore/kfbxpropertydef.h>
00054 
00055 // FBX namespace
00056 #include <fbxfilesdk_nsbegin.h>
00057 
00058 // Forward declarations
00059 class KFbxObject;
00060 class KFbxColor;
00061 class KFbxCriteria;
00062 
00066     class KFBX_DLL KFbxProperty : private FbxPropertyFlags
00067     {
00072         public:
00073             using FbxPropertyFlags::eFbxPropertyFlags;
00074             using FbxPropertyFlags::eNO_FLAG;
00075             using FbxPropertyFlags::eANIMATABLE;
00076             using FbxPropertyFlags::eUSER;
00077             using FbxPropertyFlags::eTEMPORARY;
00078             using FbxPropertyFlags::ePUBLISHED;
00079             using FbxPropertyFlags::ePSTATIC;
00080 
00081             using FbxPropertyFlags::eNOT_SAVABLE;
00082             using FbxPropertyFlags::eHIDDEN;
00083 
00084             using FbxPropertyFlags::eUI_DISABLED;
00085             using FbxPropertyFlags::eUI_GROUP;
00086             using FbxPropertyFlags::eUI_BOOLGROUP;
00087             using FbxPropertyFlags::eUI_EXPANDED;
00088             using FbxPropertyFlags::eUI_NOCAPTION;
00089             using FbxPropertyFlags::eUI_PANEL;
00090 
00091             typedef FbxPropertyFlags::eFbxPropertyFlags EFlags;
00092 
00101             static KFbxProperty Create(KFbxProperty const &pCompoundProperty, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="",bool pCheckForDuplicate=true, bool* pWasFound=NULL);
00102 
00112             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)
00113             {
00114                 if( !pCheckForDuplicate )
00115                 {
00116                     KFbxProperty lProperty = Create(pParentProperty, pName, pDataType, "", pCheckForDuplicate);
00117                     lProperty.ModifyFlag(pFlags, true); // modify the flags before we set the value
00118                     lProperty.Set(pValue);
00119                     return lProperty;
00120                 }
00121 
00122                 // First check for a duplicate
00123                 KFbxProperty lProperty = pParentProperty.Find(pName);
00124 
00125                 // only set if we are forcing the set, or we are actually creating the property
00126                 // (as opposed to returning an existing one)
00127                 //bool lSetValue = pForceSet ? true : !lProperty.IsValid();
00128 
00129                 if( !lProperty.IsValid() )
00130                     lProperty = Create(pParentProperty, pName, pDataType, "", false); // don't check because we already did
00131 
00132                 lProperty.ModifyFlag(pFlags, true); // modify the flags before we set the value
00133                 //if( lSetValue )
00134                 //  lProperty.Set(pValue);
00135                 lProperty.Set( &pValue,FbxTypeOf(pValue),!pForceSet);
00136                 return lProperty;
00137             }
00138 
00147             static KFbxProperty Create(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="",bool pCheckForDuplicate=true,bool* pWasFound=NULL);
00148 
00154             static KFbxProperty Create(KFbxObject* pObject, KFbxProperty& pFromProperty, bool pCheckForDuplicate=true);
00155 
00161          static KFbxProperty Create(KFbxProperty const& pCompoundProperty, KFbxProperty& pFromProperty, bool pCheckForDuplicate = true);
00162 
00165             void Destroy(bool pRecursive = true, bool pDependents = false);
00166 
00169             KFbxProperty();
00170 
00173             KFbxProperty(KFbxProperty const &pProperty);
00174 
00177             KFbxProperty(KFbxPropertyHandle const &pProperty);
00178 
00181             ~KFbxProperty();
00182 
00183         public:
00185 
00190         public:
00194             KFbxDataType        GetPropertyDataType() const;
00195 
00199             KString         GetName() const;
00200 
00204             KString             GetHierarchicalName() const;
00205 
00215             KString         GetLabel(bool pReturnNameIfEmpty=true);
00216 
00217 
00221             void                SetLabel(KString pLabel);
00222 
00226             KFbxObject*         GetFbxObject() const;
00227 
00229 
00234             void                SetUserTag(int pTag);
00235             int                 GetUserTag();
00236             void  SetUserDataPtr(void* pUserData);
00237             void* GetUserDataPtr();
00239 
00248             void ModifyFlag(eFbxPropertyFlags pFlag, bool pValue);
00249 
00254             bool GetFlag(eFbxPropertyFlags pFlag);
00255 
00260             KFbxInheritType GetFlagInheritType( eFbxPropertyFlags pFlag ) const;
00261 
00267             bool SetFlagInheritType( eFbxPropertyFlags pFlag, KFbxInheritType pType );
00268 
00273             bool ModifiedFlag( eFbxPropertyFlags pFlag ) const;
00275 
00280             KFbxProperty &      operator=  (KFbxProperty const &pKProperty);
00281             bool                operator== (KFbxProperty const &pKProperty) const;
00282             bool                operator!= (KFbxProperty const &pKProperty) const;
00283             inline bool         operator== (int pValue) const { return pValue==0 ? !IsValid() : IsValid(); }
00284             inline bool         operator!= (int pValue) const { return pValue!=0 ? !IsValid() : IsValid(); }
00285             bool CompareValue(KFbxProperty const& pProp) const;
00287 
00292         bool CopyValue(KFbxProperty const& pProp);
00293 
00298         public:
00299             bool            IsValid() const;
00300 
00307             bool Set(void const *pValue,EFbxType pValueType, bool pCheckForValueEquality);
00308             inline bool Set(void const *pValue,EFbxType pValueType) { return Set( pValue, pValueType, true ); }
00309 
00313             bool Get(void *pValue,EFbxType pValueType) const;
00314 
00318             bool Get(void *pValue,EFbxType pValueType,KFbxEvaluationInfo const *pEvaluateInfo);
00319 
00320             // usefull set and get functions
00321             template <class T> inline bool  Set( T const &pValue )  { return Set( &pValue,FbxTypeOf(pValue), true ); }
00322             template <class T> inline T     Get( T const *pFBX_TYPE) const { T lValue; Get( &lValue,FbxTypeOf(lValue) ); return lValue; }
00323             template <class T> inline T     Get( T const *pFBX_TYPE,KFbxEvaluationInfo const *pEvaluateInfo) { T lValue; Get( &lValue,FbxTypeOf(lValue),pEvaluateInfo ); return lValue; }
00324             template <class T> inline T     Get( KFbxEvaluationInfo const *pEvaluateInfo) { T lValue; Get( &lValue,FbxTypeOf(lValue),pEvaluateInfo ); return lValue; }
00328             bool Get(void *pValue,EFbxType pValueType,KFbxEvaluationInfo *pEvaluateInfo) const;
00329 
00335             KFbxInheritType GetValueInheritType() const;
00336 
00347             bool SetValueInheritType( KFbxInheritType pType );
00348 
00352             bool Modified() const;
00353 
00355 
00364         public:
00368             void                SetMinLimit(double pMin);
00369 
00374          bool           HasMinLimit() const;
00375 
00379             double          GetMinLimit() const;
00380 
00385          bool           HasMaxLimit() const;
00386 
00390             void                SetMaxLimit(double pMax);
00394             double          GetMaxLimit() const;
00395 
00400             void                SetLimits(double pMin, double pMax);
00402 
00407         public:
00414             int                 AddEnumValue(char const *pStringValue);
00415 
00423             void                InsertEnumValue(int pIndex, char const *pStringValue);
00424 
00429             int                 GetEnumCount();
00430 
00439             void                SetEnumValue(int pIndex, char const *pStringValue);
00440 
00444             void                RemoveEnumValue(int pIndex);
00445 
00450             char *              GetEnumValue(int pIndex);
00452 
00457             inline bool                 IsRoot() const                                          { return mPropertyHandle.IsRoot(); }
00458             inline bool                 IsChildOf(KFbxProperty  const & pParent) const          { return mPropertyHandle.IsChildOf(pParent.mPropertyHandle); }
00459             inline bool                 IsDescendentOf(KFbxProperty const & pAncestor) const    { return mPropertyHandle.IsDescendentOf(pAncestor.mPropertyHandle); }
00460             inline KFbxProperty         GetParent() const                                       { return KFbxProperty(mPropertyHandle.GetParent());  }
00461             bool                        SetParent( const KFbxProperty& pOther );
00462             inline KFbxProperty         GetChild() const                                        { return KFbxProperty(mPropertyHandle.GetChild());   }
00463             inline KFbxProperty         GetSibling() const                                      { return KFbxProperty(mPropertyHandle.GetSibling()); }
00464 
00469             inline KFbxProperty         GetFirstDescendent() const                              { return KFbxProperty(mPropertyHandle.GetFirstDescendent());   }
00475             inline KFbxProperty         GetNextDescendent(KFbxProperty const &pProperty) const  { return KFbxProperty(mPropertyHandle.GetNextDescendent(pProperty.mPropertyHandle)); }
00476 
00483             inline KFbxProperty         Find (char const *pName,bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,pCaseSensitive));  }
00484             inline KFbxProperty         Find (char const *pName,KFbxDataType const &pDataType, bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,pDataType.GetTypeInfoHandle(),pCaseSensitive));  }
00491             inline KFbxProperty         FindHierarchical (char const *pName,bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pCaseSensitive));  }
00492             inline KFbxProperty         FindHierarchical (char const *pName,KFbxDataType const &pDataType, bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pDataType.GetTypeInfoHandle(),pCaseSensitive));  }
00493 
00495 
00500             inline void     BeginCreateOrFindProperty() { mPropertyHandle.BeginCreateOrFindProperty();  }
00501             inline void     EndCreateOrFindProperty()   { mPropertyHandle.EndCreateOrFindProperty();    }
00502 
00503          struct KFbxPropertyNameCache
00504          {
00505             KFbxPropertyNameCache(const KFbxProperty& prop) :
00506                mProp(const_cast<KFbxProperty&>(prop))
00507             {
00508                mProp.BeginCreateOrFindProperty();
00509             }
00510 
00511             ~KFbxPropertyNameCache()
00512             {
00513                mProp.EndCreateOrFindProperty();
00514             }
00515 
00516          private:
00517             KFbxProperty & mProp;
00518 
00519             KFbxPropertyNameCache& operator=(const KFbxPropertyNameCache &other) { mProp = other.mProp; mProp.BeginCreateOrFindProperty(); return *this; }
00520          };
00522 
00527             bool            SetArraySize( int pSize, bool pVariableArray );
00528             int             GetArraySize() const;
00529             KFbxProperty    GetArrayItem(int pIndex) const;
00530             inline KFbxProperty operator[](int pIndex) const { return GetArrayItem(pIndex); }
00532 
00540             KFCurveNode* CreateKFCurveNode(const char* pTakeName=NULL);
00541 
00547             KFCurveNode* GetKFCurveNode(bool pCreateAsNeeded=false, const char* pTakeName=NULL);
00548 
00556             KFCurve* GetKFCurve(const char* pChannel = NULL);
00557 
00567             KFCurve* GetKFCurve(const char* pChannel, const char* pTakeName);
00569 
00574             bool    Evaluate(KFbxEvaluationInfo const *pEvaluationInfo);
00576 
00581         public:
00582             // SrcObjects
00583             bool ConnectSrcObject       (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone);
00584             bool IsConnectedSrcObject   (const KFbxObject* pObject) const;
00585             bool DisconnectSrcObject    (KFbxObject* pObject);
00586 
00587             bool DisconnectAllSrcObject();
00588             bool DisconnectAllSrcObject(KFbxCriteria const &pCriteria);
00589             bool DisconnectAllSrcObject(const kFbxClassId& pClassId);
00590             bool DisconnectAllSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria);
00591 
00592             int GetSrcObjectCount()const;
00593             int GetSrcObjectCount(KFbxCriteria const &pCriteria)const;
00594             int GetSrcObjectCount(const kFbxClassId& pClassId)const;
00595             int GetSrcObjectCount(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria)const;
00596 
00597             KFbxObject* GetSrcObject(int pIndex=0) const;
00598             KFbxObject* GetSrcObject(KFbxCriteria const &pCriteria,int pIndex=0) const;
00599             KFbxObject* GetSrcObject(const kFbxClassId& pClassId,int pIndex=0) const;
00600             KFbxObject* GetSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const;
00601 
00602             KFbxObject* FindSrcObject(const char *pName,int pStartIndex=0) const;
00603             KFbxObject* FindSrcObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00604             KFbxObject* FindSrcObject(const kFbxClassId& pClassId,const char *pName,int pStartIndex=0) const;
00605             KFbxObject* FindSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00606 
00607             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE){ return DisconnectAllSrcObject(T::ClassId);}
00608             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return DisconnectAllSrcObject(T::ClassId,pCriteria);  }
00609             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE) const{ return GetSrcObjectCount(T::ClassId); }
00610             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return GetSrcObjectCount(T::ClassId,pCriteria); }
00611             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,int pIndex=0) const { return (T*)GetSrcObject(T::ClassId,pIndex); }
00612             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return (T*)GetSrcObject(T::ClassId,pCriteria,pIndex); }
00613             template < class T > inline T*   FindSrcObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return (T*)FindSrcObject(T::ClassId,pName,pStartIndex); }
00614             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); }
00615 
00616             // DstObjects
00617             bool ConnectDstObject       (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone);
00618             bool IsConnectedDstObject   (const KFbxObject* pObject) const;
00619             bool DisconnectDstObject    (KFbxObject* pObject);
00620 
00621             bool DisconnectAllDstObject();
00622             bool DisconnectAllDstObject(KFbxCriteria const &pCriteria);
00623             bool DisconnectAllDstObject(const kFbxClassId& pClassId);
00624             bool DisconnectAllDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria);
00625 
00626             int GetDstObjectCount() const;
00627             int GetDstObjectCount(KFbxCriteria const &pCriteria) const;
00628             int GetDstObjectCount(const kFbxClassId& pClassId) const;
00629             int GetDstObjectCount(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria) const;
00630 
00631             KFbxObject* GetDstObject(int pIndex=0) const;
00632             KFbxObject* GetDstObject(KFbxCriteria const &pCriteria,int pIndex=0) const;
00633             KFbxObject* GetDstObject(const kFbxClassId& pClassId,int pIndex=0) const;
00634             KFbxObject* GetDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,int pIndex=0)const;
00635 
00636             KFbxObject* FindDstObject(const char *pName,int pStartIndex=0) const;
00637             KFbxObject* FindDstObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00638             KFbxObject* FindDstObject(const kFbxClassId& pClassId,const char *pName,int pStartIndex=0) const;
00639             KFbxObject* FindDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00640 
00641             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE){ return DisconnectAllDstObject(T::ClassId);    }
00642             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return DisconnectAllDstObject(T::ClassId,pCriteria);  }
00643             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE) const { return GetDstObjectCount(T::ClassId); }
00644             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return GetDstObjectCount(T::ClassId,pCriteria); }
00645             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,int pIndex=0) const { return (T*)GetDstObject(T::ClassId,pIndex); }
00646             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return (T*)GetDstObject(T::ClassId,pCriteria,pIndex); }
00647             template < class T > inline T*   FindDstObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return (T*)FindDstObject(T::ClassId,pName,pStartIndex); }
00648             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); }
00650 
00655         public:
00656             // Properties
00657             bool            ConnectSrcProperty      (KFbxProperty const & pProperty);
00658             bool            IsConnectedSrcProperty  (KFbxProperty const & pProperty);
00659             bool            DisconnectSrcProperty   (KFbxProperty const & pProperty);
00660             int             GetSrcPropertyCount     () const;
00661             KFbxProperty    GetSrcProperty          (int pIndex=0) const;
00662             KFbxProperty    FindSrcProperty         (const char *pName,int pStartIndex=0) const;
00663 
00664             bool            ConnectDstProperty      (KFbxProperty const & pProperty);
00665             bool            IsConnectedDstProperty  (KFbxProperty const & pProperty);
00666             bool            DisconnectDstProperty   (KFbxProperty const & pProperty);
00667             int             GetDstPropertyCount     () const;
00668             KFbxProperty    GetDstProperty          (int pIndex=0) const;
00669             KFbxProperty    FindDstProperty         (const char *pName,int pStartIndex=0) const;
00670 
00671             void            ClearConnectCache();
00672 
00674 
00675         static const char* sHierarchicalSeparator;
00676 
00677         // Deprecated function calls
00678         typedef enum {   eUNIDENTIFIED,eBOOL,eREAL,eCOLOR,eINTEGER,eVECTOR,eLIST, eMATRIX} EUserPropertyType;
00679 
00680         K_DEPRECATED static const char* GetPropertyTypeName(EUserPropertyType pType);
00681         K_DEPRECATED const char *       GetPropertyTypeName();
00682         K_DEPRECATED EUserPropertyType  GetPropertyType();
00683 
00684         K_DEPRECATED void SetDefaultValue(bool pValue);
00685         K_DEPRECATED void SetDefaultValue(double pValue);
00686         K_DEPRECATED void SetDefaultValue(KFbxColor& pValue);
00687         K_DEPRECATED void SetDefaultValue(int pValue);
00688         K_DEPRECATED void SetDefaultValue(double pValue1, double pValue2, double pValue3);
00689         K_DEPRECATED void GetDefaultValue(bool& pValue);
00690         K_DEPRECATED void GetDefaultValue(double& pValue);
00691         K_DEPRECATED void GetDefaultValue(KFbxColor& pValue);
00692         K_DEPRECATED void GetDefaultValue(int& pValue);
00693         K_DEPRECATED void GetDefaultValue(double& pValue1, double& pValue2, double& pValue3);
00694 
00696         //  WARNING!
00697         //  Anything beyond these lines may not be documented accurately and is
00698         //  subject to change without notice.
00700         #ifndef DOXYGEN_SHOULD_SKIP_THIS
00701 
00702         protected:
00704             KFbxProperty(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
00705             KFbxProperty(KFbxProperty const & pParent, char const* pName, KFbxDataType const &pDataType, char const* pLabel);
00706 
00707         // General Property Connection and Relationship Management
00708         private:
00709             bool            ConnectSrc      (KFbxProperty const &pProperty,kFbxConnectionType pType=eFbxConnectionNone);
00710             bool            DisconnectSrc   (KFbxProperty const &pProperty);
00711             bool            DisconnectAllSrc();
00712             bool            DisconnectAllSrc(KFbxCriteria const &pCriteria);
00713             bool            IsConnectedSrc  (KFbxProperty const &pProperty) const;
00714             int             GetSrcCount     () const;
00715             int             GetSrcCount     (KFbxCriteria const &pCriteria) const;
00716             KFbxProperty    GetSrc          (int pIndex=0) const;
00717             KFbxProperty    GetSrc          (KFbxCriteria const &pCriteria,int pIndex=0) const;
00718             KFbxProperty    FindSrc         (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00719 
00720             bool            ConnectDst      (KFbxProperty const &pProperty,kFbxConnectionType pType=eFbxConnectionNone);
00721             bool            DisconnectDst   (KFbxProperty const &pProperty);
00722             bool            DisconnectAllDst();
00723             bool            DisconnectAllDst(KFbxCriteria const &pCriteria);
00724             bool            IsConnectedDst  (KFbxProperty const &pProperty) const;
00725             int             GetDstCount     () const;
00726             int             GetDstCount     (KFbxCriteria const &pCriteria) const;
00727             KFbxProperty    GetDst          (int pIndex=0) const;
00728             KFbxProperty    GetDst          (KFbxCriteria const &pCriteria,int pIndex=0) const;
00729             KFbxProperty    FindDst         (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00730         private:
00732             mutable KFbxPropertyHandle  mPropertyHandle;
00733 
00734             friend class KFbxObject;
00735         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00736     };
00737 
00738     typedef KFbxProperty* HKFbxProperty;
00739 
00740     template <class T> inline bool  KFbxSet( KFbxProperty &pProperty,T const &pValue, bool pCheckValueEquality = true ) { return pProperty.Set( &pValue,FbxTypeOf(pValue),pCheckValueEquality ); }
00741     template <class T> inline bool  KFbxGet( KFbxProperty const& pProperty,T &pValue ) { return pProperty.Get( &pValue,FbxTypeOf(pValue) ); }
00742     template <class T> inline bool  KFbxGet( KFbxProperty& pProperty, T &pValue, KFbxEvaluationInfo const* pInfo)  { return pProperty.Get( &pValue, FbxTypeOf(pValue), pInfo ); }
00743     template <class T> inline T     KFbxGet( KFbxProperty const& pProperty)            { T pValue; pProperty.Get( &pValue,FbxTypeOf(pValue) ); return pValue; }
00744 
00745 
00746     template <class T> class KFbxTypedProperty : public KFbxProperty {
00747         public:
00748             inline KFbxTypedProperty() : KFbxProperty()                                         {}
00749             inline KFbxTypedProperty(KFbxProperty const &pProperty) : KFbxProperty(pProperty)   {}
00750             inline ~KFbxTypedProperty() {}
00751 
00752             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,eFbxPropertyFlags pFlags=eNO_FLAG)
00753             {
00754                 *this = Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "");
00755                 ModifyFlag(pFlags, true);
00756                 return *this;
00757             }
00758 
00759             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,T const &pValue,bool pForceSet=true,eFbxPropertyFlags pFlags=eNO_FLAG)
00760             {
00761                 bool lWasFound = false;
00762                 *this = Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "",true,&lWasFound);
00763 
00764                 if( pForceSet || !lWasFound )
00765                 {
00766                     ModifyFlag(pFlags, true); // modify the flags before we set the value
00767                     Set(pValue,false);
00768                 }
00769 
00770                 return *this;
00771             }
00772             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,eFbxPropertyFlags pFlags=eNO_FLAG)
00773             {
00774                 *this = Create(pObject, pName, pDataType, "");
00775                 ModifyFlag(pFlags, true);
00776                 return *this;
00777             }
00778             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,T const &pValue, bool pForceSet=true, eFbxPropertyFlags pFlags=eNO_FLAG)
00779             {
00780                 bool lWasFound = false;
00781                 *this = Create(pObject, pName, pDataType, "",true,&lWasFound);
00782 
00783                 if( pForceSet || !lWasFound )
00784                 {
00785                     ModifyFlag(pFlags, true); // modify the flags before we set the value
00786                     // since we will trigger callbacks in there!
00787                     Set(pValue,false);
00788                 }
00789 
00790                 return *this;
00791             }
00792 
00793             inline KFbxProperty const & StaticInit(KFbxProperty pCompound, char const* pName, KFbxDataType const &pDataType,T const &pValue, bool pForceSet=true, eFbxPropertyFlags pFlags=eNO_FLAG)
00794             {
00795                 bool lWasFound = false;
00796                 *this = Create(pCompound, pName, pDataType, "",true,&lWasFound);
00797 
00798                 if( pForceSet || !lWasFound )
00799                 {
00800                     ModifyFlag(pFlags, true); // modify the flags before we set the value
00801                     // since we will trigger callbacks in there!
00802                     Set(pValue,false);
00803                 }
00804 
00805                 return *this;
00806             }
00807         public:
00808             KFbxTypedProperty &operator =(T const &pValue)      { KFbxSet(*this,pValue); return *this; }
00809             bool     Set(T const &pValue, bool pCheckValueEquality )    { return KFbxSet(*this,pValue,pCheckValueEquality); }
00810             bool     Set(T const &pValue )  { return KFbxSet(*this,pValue,true); }
00811             T        Get() const            { T lValue; KFbxGet(*this,lValue); return lValue; }
00812             T        Get( KFbxEvaluationInfo const* pInfo ) { T lValue; KFbxGet( *this, lValue, pInfo); return lValue; }
00813 
00814         friend class KFbxObject;
00815     };
00816 
00817     // For use with deprecated type functions
00818     KFBX_DLL KFbxDataType                       EUserPropertyTypeToDataType(KFbxProperty::EUserPropertyType);
00819     KFBX_DLL KFbxProperty::EUserPropertyType        DataTypeToEUserPropertyType(const KFbxDataType &pDataType);
00820 
00821 
00822     template <> class KFbxTypedProperty<fbxReference*> : public KFbxProperty
00823     {
00824     public:
00825         inline KFbxTypedProperty() : KFbxProperty()
00826         {}
00827         inline KFbxTypedProperty(KFbxProperty const &pProperty)
00828             : KFbxProperty(pProperty)
00829         {}
00830         inline ~KFbxTypedProperty()
00831         {}
00832 
00833         inline KFbxProperty const & StaticInit(KFbxObject* pObject,char const* pName,eFbxPropertyFlags pFlags=eNO_FLAG)
00834         {
00835             *this = KFbxProperty::Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((fbxReference* *)0))), "");
00836             ModifyFlag(pFlags, true);
00837             return *this;
00838         }
00839 
00840         inline KFbxProperty const & StaticInit(KFbxObject* pObject,
00841                                                char const* pName,
00842                                                fbxReference* const &pValue,
00843                                                bool pForceSet=true,
00844                                                eFbxPropertyFlags pFlags=eNO_FLAG
00845                                                )
00846         {
00847             bool lWasFound = false;
00848             *this = KFbxProperty::Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((fbxReference* *)0))), "",true, &lWasFound);
00849             if( pForceSet || !lWasFound )
00850             {
00851                 ModifyFlag(pFlags, true);
00852                 Set(pValue,false);
00853             }
00854 
00855             return *this;
00856         }
00857 
00858         inline KFbxProperty const & StaticInit(KFbxObject* pObject,
00859                                                char const* pName,
00860                                                KFbxDataType const &pDataType,
00861                                                eFbxPropertyFlags pFlags=eNO_FLAG)
00862         {
00863             *this = KFbxProperty::Create(pObject, pName, pDataType, "");
00864 //          KFbxProperty::StaticInit(pObject, pName, pDataType, "");
00865             ModifyFlag(pFlags, true);
00866             return *this;
00867         }
00868 
00869         inline KFbxProperty const & StaticInit(KFbxObject* pObject,
00870                                                char const* pName,
00871                                                KFbxDataType const &pDataType,
00872                                                fbxReference* const &pValue,
00873                                                bool pForceSet=true,
00874                                                eFbxPropertyFlags pFlags=eNO_FLAG
00875                                                )
00876         {
00877             bool lWasFound = false;
00878             *this = KFbxProperty::Create(pObject, pName, pDataType, "",true,&lWasFound);
00879 
00880             if( pForceSet || !lWasFound )
00881             {
00882                 ModifyFlag(pFlags, true);
00883                 Set(pValue,false);
00884             }
00885 
00886             return *this;
00887         }
00888 
00889     public:
00890         KFbxTypedProperty &operator =(fbxReference* const &pValue)
00891         {
00892             KFbxSet(*this,pValue);
00893             return *this;
00894         }
00895 
00896         inline bool Set(fbxReference* const &pValue ) { return Set(pValue, true); }
00897 
00898         bool Set(fbxReference* const &pValue, bool pCheckValueEquality )
00899         {
00900             KFbxObject* lValue = reinterpret_cast<KFbxObject*>(pValue);
00901             DisconnectAllSrcObject();
00902             if (lValue) {
00903                 return ConnectSrcObject(lValue);
00904             }
00905 
00906             return false;
00907         }
00908 
00909         fbxReference* Get() const
00910         {
00911             KFbxObject* lValue = GetSrcObjectCount() > 0 ? GetSrcObject(0) : NULL;
00912             return reinterpret_cast<fbxReference*>(lValue);
00913         }
00914 
00915         friend class KFbxObject;
00916     };
00917 
00918 
00919     typedef KFbxTypedProperty<fbxBool1>         KFbxPropertyBool1;
00920     typedef KFbxTypedProperty<fbxInteger1>      KFbxPropertyInteger1;
00921     typedef KFbxTypedProperty<fbxDouble1>       KFbxPropertyDouble1;
00922     typedef KFbxTypedProperty<fbxDouble3>       KFbxPropertyDouble3;
00923     typedef KFbxTypedProperty<fbxDouble4>       KFbxPropertyDouble4;
00924     typedef KFbxTypedProperty<fbxString>        KFbxPropertyString;
00925     typedef KFbxTypedProperty<fbxReference*>    KFbxPropertyReference;
00926 
00927     enum eFbxConnectEventType {
00928         eFbxConnectRequest,
00929         eFbxConnect,
00930         eFbxConnected,
00931         eFbxDisconnectRequest,
00932         eFbxDisconnect,
00933         eFbxDisconnected
00934     };
00935 
00936     enum eFbxConnectEventDirection {
00937         eConnectEventSrc,
00938         eConnectEventDst
00939     };
00940 
00944     class KFBX_DLL KFbxConnectEvent
00945     {
00950         public:
00951             inline KFbxConnectEvent(eFbxConnectEventType pType,eFbxConnectEventDirection pDir,KFbxProperty *pSrc,KFbxProperty *pDst)
00952                 : mType(pType)
00953                 , mDirection(pDir)
00954                 , mSrc(pSrc)
00955                 , mDst(pDst)
00956             {
00957             }
00959 
00964         public:
00965             inline eFbxConnectEventType GetType() const { return mType; }
00966             inline eFbxConnectEventDirection GetDirection() const { return mDirection; }
00967             inline KFbxProperty &GetSrc()  const    { return *mSrc;  }
00968             inline KFbxProperty &GetDst()  const    { return *mDst;  }
00969 
00970             template < class T > inline T*  GetSrcIfObject(T const *pFBX_TYPE) const    { return mSrc->IsRoot() ? KFbxCast<T>(mSrc->GetFbxObject()) : (T*)0; }
00971             template < class T > inline T*  GetDstIfObject(T const *pFBX_TYPE) const    { return mDst->IsRoot() ? KFbxCast<T>(mDst->GetFbxObject()) : (T*)0; }
00973 
00974         private:
00975             eFbxConnectEventType        mType;
00976             eFbxConnectEventDirection   mDirection;
00977             KFbxProperty*               mSrc;
00978             KFbxProperty*               mDst;
00979     };
00980 
00981 
00982 
00983 #include <fbxfilesdk_nsend.h>
00984 
00985 #endif // _KFbxProperty_h
00986 
00987