kfbxproperty.h

Go to the documentation of this file.
00001 
00003 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXPROPERTY_H
00004 #define FBXFILESDK_KFBXPLUGINS_KFBXPROPERTY_H
00005 
00006 /**************************************************************************************
00007 
00008  Copyright (C) 2001 - 2009 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 <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00041 // FBX includes
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 // FBX namespace
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049 
00050 // Forward declarations
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); // modify the flags before we set the value
00110                     lProperty.Set(pValue);
00111                     return lProperty;
00112                 }
00113 
00114                 // First check for a duplicate
00115                 KFbxProperty lProperty = pParentProperty.Find(pName);
00116 
00117                 // only set if we are forcing the set, or we are actually creating the property
00118                 // (as opposed to returning an existing one)
00119                 //bool lSetValue = pForceSet ? true : !lProperty.IsValid();
00120 
00121                 if( !lProperty.IsValid() )
00122                     lProperty = Create(pParentProperty, pName, pDataType, "", false); // don't check because we already did
00123 
00124                 lProperty.ModifyFlag(pFlags, true); // modify the flags before we set the value
00125                 //if( lSetValue )
00126                 //  lProperty.Set(pValue);
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 
00161             void Destroy(bool pRecursive = true, bool pDependents = false);
00162 
00166             void DestroyRecursively();
00167 
00171             void DestroyChildren();
00172 
00175             KFbxProperty();
00176 
00180             KFbxProperty(KFbxProperty const &pProperty);
00181 
00185             KFbxProperty(KFbxPropertyHandle const &pPropertyHandle);
00186 
00189             ~KFbxProperty();
00190 
00191         public:
00193 
00198         public:
00202             KFbxDataType        GetPropertyDataType() const;
00203 
00207             KString         GetName() const;
00208 
00212             KString             GetHierarchicalName() const;
00213 
00223             KString         GetLabel(bool pReturnNameIfEmpty=true);
00224 
00225 
00229             void                SetLabel(KString pLabel);
00230 
00234             KFbxObject*         GetFbxObject() const;
00235 
00237 
00245             void                SetUserTag(int pTag);
00246                 
00248             int                 GetUserTag();
00249 
00253             void  SetUserDataPtr(void* pUserData);
00254 
00258             void* GetUserDataPtr();
00260 
00269             void ModifyFlag(eFbxPropertyFlags pFlag, bool pValue);
00270 
00275             bool GetFlag(eFbxPropertyFlags pFlag);
00276 
00281             KFbxInheritType GetFlagInheritType( eFbxPropertyFlags pFlag ) const;
00282 
00288             bool SetFlagInheritType( eFbxPropertyFlags pFlag, KFbxInheritType pType );
00289 
00294             bool ModifiedFlag( eFbxPropertyFlags pFlag ) const;
00296 
00301 
00306             KFbxProperty &      operator=  (KFbxProperty const &pKProperty);
00307 
00312             bool                operator== (KFbxProperty const &pKProperty) const;
00313 
00318             bool                operator!= (KFbxProperty const &pKProperty) const;
00319 
00324             inline bool         operator== (int pValue) const { return pValue==0 ? !IsValid() : IsValid(); }
00325 
00330             inline bool         operator!= (int pValue) const { return pValue!=0 ? !IsValid() : IsValid(); }
00331 
00336             bool CompareValue(KFbxProperty const& pProp) const;
00338 
00343         bool CopyValue(KFbxProperty const& pProp);
00344 
00349         public:
00350 
00354             bool            IsValid() const;
00355 
00364             static bool HasDefaultValue( KFbxProperty& pProperty );
00365 
00372             bool Set(void const *pValue,EFbxType pValueType, bool pCheckForValueEquality);
00373 
00379             inline bool Set(void const *pValue,EFbxType pValueType) { return Set( pValue, pValueType, true ); }
00380 
00386             bool Get(void *pValue,EFbxType pValueType) const;
00387 
00395             bool Get(void *pValue,EFbxType pValueType,KFbxEvaluationInfo const *pEvaluateInfo);
00396 
00401             template <class T> inline bool  Set( T const &pValue )  { return Set( &pValue,FbxTypeOf(pValue), true ); }
00402 
00407             template <class T> inline T     Get( T const *pFBX_TYPE) const { T lValue; Get( &lValue,FbxTypeOf(lValue) ); return lValue; }
00408 
00415             template <class T> inline T     Get( T const *pFBX_TYPE,KFbxEvaluationInfo const *pEvaluateInfo) { T lValue; Get( &lValue,FbxTypeOf(lValue),pEvaluateInfo ); return lValue; }
00416 
00422             template <class T> inline T     Get( KFbxEvaluationInfo const *pEvaluateInfo) { T lValue; Get( &lValue,FbxTypeOf(lValue),pEvaluateInfo ); return lValue; }
00423            
00431             bool Get(void *pValue,EFbxType pValueType,KFbxEvaluationInfo *pEvaluateInfo) const;
00432 
00438             KFbxInheritType GetValueInheritType() const;
00439 
00450             bool SetValueInheritType( KFbxInheritType pType );
00451 
00459             bool Modified() const;
00460 
00462 
00471         public:
00475             void                SetMinLimit(double pMin);
00476 
00481          bool           HasMinLimit() const;
00482 
00486             double          GetMinLimit() const;
00487 
00492          bool           HasMaxLimit() const;
00493 
00497             void                SetMaxLimit(double pMax);
00498 
00502             double          GetMaxLimit() const;
00503 
00508             void                SetLimits(double pMin, double pMax);
00510 
00515         public:
00522             int                 AddEnumValue(char const *pStringValue);
00523 
00531             void                InsertEnumValue(int pIndex, char const *pStringValue);
00532 
00537             int                 GetEnumCount();
00538 
00547             void                SetEnumValue(int pIndex, char const *pStringValue);
00548 
00553             void                RemoveEnumValue(int pIndex);
00554 
00559             char *              GetEnumValue(int pIndex);
00561 
00569             inline bool                 IsRoot() const                                          { return mPropertyHandle.IsRoot(); }
00570 
00575             inline bool                 IsChildOf(KFbxProperty  const & pParent) const          { return mPropertyHandle.IsChildOf(pParent.mPropertyHandle); }
00576 
00581             inline bool                 IsDescendentOf(KFbxProperty const & pAncestor) const    { return mPropertyHandle.IsDescendentOf(pAncestor.mPropertyHandle); }
00582 
00586             inline KFbxProperty         GetParent() const                                       { return KFbxProperty(mPropertyHandle.GetParent());  }
00587 
00592             bool                        SetParent( const KFbxProperty& pOther );
00593 
00597             inline KFbxProperty         GetChild() const                                        { return KFbxProperty(mPropertyHandle.GetChild());   }
00598 
00602             inline KFbxProperty         GetSibling() const                                      { return KFbxProperty(mPropertyHandle.GetSibling()); }
00603 
00607             inline KFbxProperty         GetFirstDescendent() const                              { return KFbxProperty(mPropertyHandle.GetFirstDescendent());   }
00608 
00613             inline KFbxProperty         GetNextDescendent(KFbxProperty const &pProperty) const  { return KFbxProperty(mPropertyHandle.GetNextDescendent(pProperty.mPropertyHandle)); }
00614 
00621             inline KFbxProperty         Find (char const *pName,bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,pCaseSensitive));  }
00622 
00630             inline KFbxProperty         Find (char const *pName,KFbxDataType const &pDataType, bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,pDataType.GetTypeInfoHandle(),pCaseSensitive));  }
00631 
00638             inline KFbxProperty         FindHierarchical (char const *pName,bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pCaseSensitive));  }
00639 
00647             inline KFbxProperty         FindHierarchical (char const *pName,KFbxDataType const &pDataType, bool pCaseSensitive = true) const { return KFbxProperty(mPropertyHandle.Find(pName,sHierarchicalSeparator,pDataType.GetTypeInfoHandle(),pCaseSensitive));  }
00648 
00650 
00655 
00656             inline void     BeginCreateOrFindProperty() { mPropertyHandle.BeginCreateOrFindProperty();  }
00657 
00659             inline void     EndCreateOrFindProperty()   { mPropertyHandle.EndCreateOrFindProperty();    }
00660 
00662          struct KFbxPropertyNameCache
00663          {
00667             KFbxPropertyNameCache(const KFbxProperty& prop) :
00668                mProp(const_cast<KFbxProperty&>(prop))
00669             {
00670                mProp.BeginCreateOrFindProperty();
00671             }
00672 
00674             ~KFbxPropertyNameCache()
00675             {
00676                mProp.EndCreateOrFindProperty();
00677             }
00678 
00679          private:
00680             KFbxProperty & mProp;
00681 
00682             KFbxPropertyNameCache& operator=(const KFbxPropertyNameCache &other) { mProp = other.mProp; mProp.BeginCreateOrFindProperty(); return *this; }
00683          };
00685 
00694             bool            SetArraySize( int pSize, bool pVariableArray );
00695 
00697             int             GetArraySize() const;
00698 
00703             KFbxProperty    GetArrayItem(int pIndex) const;
00704 
00709             inline KFbxProperty operator[](int pIndex) const { return GetArrayItem(pIndex); }
00711 
00719             KFCurveNode* CreateKFCurveNode(const char* pTakeName=NULL);
00720 
00728             KFCurveNode* GetKFCurveNode(bool pCreateAsNeeded=false, const char* pTakeName=NULL);
00729 
00737             KFCurve* GetKFCurve(const char* pChannel = NULL);
00738 
00748             KFCurve* GetKFCurve(const char* pChannel, const char* pTakeName);
00750 
00760             bool    Evaluate(KFbxEvaluationInfo const *pEvaluationInfo);
00762 
00767         public:
00768             // SrcObjects
00774             bool ConnectSrcObject       (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone);
00775 
00780             bool IsConnectedSrcObject   (const KFbxObject* pObject) const;
00781 
00786             bool DisconnectSrcObject    (KFbxObject* pObject);
00787 
00791             bool DisconnectAllSrcObject();
00792 
00797             bool DisconnectAllSrcObject(KFbxCriteria const &pCriteria);
00798 
00803             bool DisconnectAllSrcObject(const kFbxClassId& pClassId);
00804 
00810             bool DisconnectAllSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria);
00811 
00815             int GetSrcObjectCount()const;
00816 
00821             int GetSrcObjectCount(KFbxCriteria const &pCriteria)const;
00822 
00827             int GetSrcObjectCount(const kFbxClassId& pClassId)const;
00828 
00834             int GetSrcObjectCount(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria)const;
00835 
00840             KFbxObject* GetSrcObject(int pIndex=0) const;
00841 
00847             KFbxObject* GetSrcObject(KFbxCriteria const &pCriteria,int pIndex=0) const;
00848 
00854             KFbxObject* GetSrcObject(const kFbxClassId& pClassId,int pIndex=0) const;
00855 
00862             KFbxObject* GetSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,int pIndex=0) const;
00863 
00869             KFbxObject* FindSrcObject(const char *pName,int pStartIndex=0) const;
00870 
00877             KFbxObject* FindSrcObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00878 
00885             KFbxObject* FindSrcObject(const kFbxClassId& pClassId,const char *pName,int pStartIndex=0) const;
00886 
00894             KFbxObject* FindSrcObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
00895 
00900             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE){ return DisconnectAllSrcObject(T::ClassId);}
00901 
00907             template < class T > inline bool DisconnectAllSrcObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return DisconnectAllSrcObject(T::ClassId,pCriteria);  }
00908 
00913             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE) const{ return GetSrcObjectCount(T::ClassId); }
00914 
00920             template < class T > inline int  GetSrcObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return GetSrcObjectCount(T::ClassId,pCriteria); }
00921 
00927             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,int pIndex=0) const { return (T*)GetSrcObject(T::ClassId,pIndex); }
00928 
00935             template < class T > inline T*   GetSrcObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return (T*)GetSrcObject(T::ClassId,pCriteria,pIndex); }
00936 
00943             template < class T > inline T*   FindSrcObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return (T*)FindSrcObject(T::ClassId,pName,pStartIndex); }
00944 
00952             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); }
00953 
00954             // DstObjects
00960             bool ConnectDstObject       (KFbxObject* pObject,kFbxConnectionType pType=eFbxConnectionNone);
00961 
00966             bool IsConnectedDstObject   (const KFbxObject* pObject) const;
00967 
00972             bool DisconnectDstObject    (KFbxObject* pObject);
00973 
00977             bool DisconnectAllDstObject();
00978 
00983             bool DisconnectAllDstObject(KFbxCriteria const &pCriteria);
00984 
00989             bool DisconnectAllDstObject(const kFbxClassId& pClassId);
00990 
00996             bool DisconnectAllDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria);
00997 
01001             int GetDstObjectCount() const;
01002 
01007             int GetDstObjectCount(KFbxCriteria const &pCriteria) const;
01008 
01013             int GetDstObjectCount(const kFbxClassId& pClassId) const;
01014 
01020             int GetDstObjectCount(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria) const;
01021 
01026             KFbxObject* GetDstObject(int pIndex=0) const;
01027 
01033             KFbxObject* GetDstObject(KFbxCriteria const &pCriteria,int pIndex=0) const;
01034 
01040             KFbxObject* GetDstObject(const kFbxClassId& pClassId,int pIndex=0) const;
01041 
01048             KFbxObject* GetDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,int pIndex=0)const;
01049 
01055             KFbxObject* FindDstObject(const char *pName,int pStartIndex=0) const;
01056 
01063             KFbxObject* FindDstObject(KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
01064 
01071             KFbxObject* FindDstObject(const kFbxClassId& pClassId,const char *pName,int pStartIndex=0) const;
01072 
01080             KFbxObject* FindDstObject(const kFbxClassId& pClassId,KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
01081 
01086             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE){ return DisconnectAllDstObject(T::ClassId);    }
01087 
01093             template < class T > inline bool DisconnectAllDstObject (T const *pFBX_TYPE,KFbxCriteria const &pCriteria)  { return DisconnectAllDstObject(T::ClassId,pCriteria);  }
01094 
01099             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE) const { return GetDstObjectCount(T::ClassId); }
01100 
01106             template < class T > inline int  GetDstObjectCount(T const *pFBX_TYPE,KFbxCriteria const &pCriteria) const { return GetDstObjectCount(T::ClassId,pCriteria); }
01107 
01113             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,int pIndex=0) const { return (T*)GetDstObject(T::ClassId,pIndex); }
01114 
01121             template < class T > inline T*   GetDstObject(T const *pFBX_TYPE,KFbxCriteria const &pCriteria,int pIndex=0) const { return (T*)GetDstObject(T::ClassId,pCriteria,pIndex); }
01122 
01129             template < class T > inline T*   FindDstObject(T const *pFBX_TYPE,const char *pName,int pStartIndex=0) const { return (T*)FindDstObject(T::ClassId,pName,pStartIndex); }
01130 
01138             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); }
01140 
01145         public:
01146             // Properties
01151             bool            ConnectSrcProperty      (KFbxProperty const & pProperty);
01152 
01157             bool            IsConnectedSrcProperty  (KFbxProperty const & pProperty);
01158 
01163             bool            DisconnectSrcProperty   (KFbxProperty const & pProperty);
01164 
01168             int             GetSrcPropertyCount     () const;
01169 
01174             KFbxProperty    GetSrcProperty          (int pIndex=0) const;
01175 
01181             KFbxProperty    FindSrcProperty         (const char *pName,int pStartIndex=0) const;
01182 
01187             bool            ConnectDstProperty      (KFbxProperty const & pProperty);
01188 
01193             bool            IsConnectedDstProperty  (KFbxProperty const & pProperty);
01194 
01199             bool            DisconnectDstProperty   (KFbxProperty const & pProperty);
01200 
01204             int             GetDstPropertyCount     () const;
01205 
01210             KFbxProperty    GetDstProperty          (int pIndex=0) const;
01211 
01217             KFbxProperty    FindDstProperty         (const char *pName,int pStartIndex=0) const;
01218 
01220             void            ClearConnectCache();
01221 
01223 
01225         static const char* sHierarchicalSeparator;
01226 
01228         //  WARNING!
01229         //  Anything beyond these lines may not be documented accurately and is
01230         //  subject to change without notice.
01232         #ifndef DOXYGEN_SHOULD_SKIP_THIS
01233 
01234         protected:
01236             KFbxProperty(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType=KFbxDataType(), char const* pLabel="");
01237             KFbxProperty(KFbxProperty const & pParent, char const* pName, KFbxDataType const &pDataType, char const* pLabel);
01238 
01239         // General Property Connection and Relationship Management
01240         private:
01241             bool            ConnectSrc      (KFbxProperty const &pProperty,kFbxConnectionType pType=eFbxConnectionNone);
01242             bool            DisconnectSrc   (KFbxProperty const &pProperty);
01243             bool            DisconnectAllSrc();
01244             bool            DisconnectAllSrc(KFbxCriteria const &pCriteria);
01245             bool            IsConnectedSrc  (KFbxProperty const &pProperty) const;
01246             int             GetSrcCount     () const;
01247             int             GetSrcCount     (KFbxCriteria const &pCriteria) const;
01248             KFbxProperty    GetSrc          (int pIndex=0) const;
01249             KFbxProperty    GetSrc          (KFbxCriteria const &pCriteria,int pIndex=0) const;
01250             KFbxProperty    FindSrc         (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
01251 
01252             bool            ConnectDst      (KFbxProperty const &pProperty,kFbxConnectionType pType=eFbxConnectionNone);
01253             bool            DisconnectDst   (KFbxProperty const &pProperty);
01254             bool            DisconnectAllDst();
01255             bool            DisconnectAllDst(KFbxCriteria const &pCriteria);
01256             bool            IsConnectedDst  (KFbxProperty const &pProperty) const;
01257             int             GetDstCount     () const;
01258             int             GetDstCount     (KFbxCriteria const &pCriteria) const;
01259             KFbxProperty    GetDst          (int pIndex=0) const;
01260             KFbxProperty    GetDst          (KFbxCriteria const &pCriteria,int pIndex=0) const;
01261             KFbxProperty    FindDst         (KFbxCriteria const &pCriteria,const char *pName,int pStartIndex=0) const;
01262         private:
01264             mutable KFbxPropertyHandle  mPropertyHandle;
01265 
01266             friend class KFbxObject;
01267         #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01268     };
01269 
01270     typedef KFbxProperty* HKFbxProperty;
01271 
01272     template <class T> inline bool  KFbxSet( KFbxProperty &pProperty,T const &pValue, bool pCheckValueEquality = true ) { return pProperty.Set( &pValue,FbxTypeOf(pValue),pCheckValueEquality ); }
01273     template <class T> inline bool  KFbxGet( KFbxProperty const& pProperty,T &pValue ) { return pProperty.Get( &pValue,FbxTypeOf(pValue) ); }
01274     template <class T> inline bool  KFbxGet( KFbxProperty& pProperty, T &pValue, KFbxEvaluationInfo const* pInfo)  { return pProperty.Get( &pValue, FbxTypeOf(pValue), pInfo ); }
01275     template <class T> inline T     KFbxGet( KFbxProperty const& pProperty)            { T pValue; pProperty.Get( &pValue,FbxTypeOf(pValue) ); return pValue; }
01276 
01277 
01281     template <class T> class KFbxTypedProperty : public KFbxProperty {
01282         public:
01283 
01288 
01289             inline KFbxTypedProperty() : KFbxProperty()                                         {}
01290 
01294             inline KFbxTypedProperty(KFbxProperty const &pProperty) : KFbxProperty(pProperty)   {}
01295 
01297             inline ~KFbxTypedProperty() {}
01298 
01300 
01301 
01311             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,eFbxPropertyFlags pFlags=eNO_FLAG)
01312             {
01313                 *this = Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "");
01314                 ModifyFlag(pFlags, true);
01315                 return *this;
01316             }
01317 
01325             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName,T const &pValue,bool pForceSet=true,eFbxPropertyFlags pFlags=eNO_FLAG)
01326             {
01327                 bool lWasFound = false;
01328                 *this = Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((T *)0))), "",true,&lWasFound);
01329 
01330                 if( pForceSet || !lWasFound )
01331                 {
01332                     ModifyFlag(pFlags, true); // modify the flags before we set the value
01333                     Set(pValue,false);
01334                 }
01335 
01336                 return *this;
01337             }
01338 
01345             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,eFbxPropertyFlags pFlags=eNO_FLAG)
01346             {
01347                 *this = Create(pObject, pName, pDataType, "");
01348                 ModifyFlag(pFlags, true);
01349                 return *this;
01350             }
01351 
01360             inline KFbxProperty const & StaticInit(KFbxObject* pObject, char const* pName, KFbxDataType const &pDataType,T const &pValue, bool pForceSet=true, eFbxPropertyFlags pFlags=eNO_FLAG)
01361             {
01362                 bool lWasFound = false;
01363                 *this = Create(pObject, pName, pDataType, "",true,&lWasFound);
01364 
01365                 if( pForceSet || !lWasFound )
01366                 {
01367                     ModifyFlag(pFlags, true); // modify the flags before we set the value
01368                     // since we will trigger callbacks in there!
01369                     Set(pValue,false);
01370                 }
01371 
01372                 return *this;
01373             }
01374 
01383             inline KFbxProperty const & StaticInit(KFbxProperty pCompound, char const* pName, KFbxDataType const &pDataType,T const &pValue, bool pForceSet=true, eFbxPropertyFlags pFlags=eNO_FLAG)
01384             {
01385                 bool lWasFound = false;
01386                 *this = Create(pCompound, pName, pDataType, "",true,&lWasFound);
01387 
01388                 if( pForceSet || !lWasFound )
01389                 {
01390                     ModifyFlag(pFlags, true); // modify the flags before we set the value
01391                     // since we will trigger callbacks in there!
01392                     Set(pValue,false);
01393                 }
01394 
01395                 return *this;
01396             }
01397 
01399         public:
01400 
01405             KFbxTypedProperty &operator=(T const &pValue)      { KFbxSet(*this,pValue); return *this; }
01406 
01412             bool     Set(T const &pValue, bool pCheckValueEquality )    { return KFbxSet(*this,pValue,pCheckValueEquality); }
01413 
01418             bool     Set(T const &pValue )  { return KFbxSet(*this,pValue,true); }
01419 
01423             T        Get() const            { T lValue; KFbxGet(*this,lValue); return lValue; }
01424 
01430             T        Get( KFbxEvaluationInfo const* pInfo ) { T lValue; KFbxGet( *this, lValue, pInfo); return lValue; }
01431 
01432         friend class KFbxObject;
01433     };
01434 
01435     // For use with deprecated type functions
01436     //KFBX_DLL KFbxDataType                       EUserPropertyTypeToDataType(KFbxProperty::EUserPropertyType);
01437     //KFBX_DLL KFbxProperty::EUserPropertyType        DataTypeToEUserPropertyType(const KFbxDataType &pDataType);
01438 
01442     template <> class KFbxTypedProperty<fbxReference*> : public KFbxProperty
01443     {
01444     public:
01449 
01451         inline KFbxTypedProperty() : KFbxProperty()
01452         {}
01453 
01457         inline KFbxTypedProperty(KFbxProperty const &pProperty)
01458             : KFbxProperty(pProperty)
01459         {}
01460 
01462         inline ~KFbxTypedProperty()
01463         {}
01465 
01475         inline KFbxProperty const & StaticInit(KFbxObject* pObject,char const* pName,eFbxPropertyFlags pFlags=eNO_FLAG)
01476         {
01477             *this = KFbxProperty::Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((fbxReference* *)0))), "");
01478             ModifyFlag(pFlags, true);
01479             return *this;
01480         }
01481 
01489         inline KFbxProperty const & StaticInit(KFbxObject* pObject,
01490                                                char const* pName,
01491                                                fbxReference* const &pValue,
01492                                                bool pForceSet=true,
01493                                                eFbxPropertyFlags pFlags=eNO_FLAG
01494                                                )
01495         {
01496             bool lWasFound = false;
01497             *this = KFbxProperty::Create(pObject, pName, GetFbxDataType(FbxTypeOf(*((fbxReference* *)0))), "",true, &lWasFound);
01498             if( pForceSet || !lWasFound )
01499             {
01500                 ModifyFlag(pFlags, true);
01501                 Set(pValue,false);
01502             }
01503 
01504             return *this;
01505         }
01506 
01507 
01514         inline KFbxProperty const & StaticInit(KFbxObject* pObject,
01515                                                char const* pName,
01516                                                KFbxDataType const &pDataType,
01517                                                eFbxPropertyFlags pFlags=eNO_FLAG)
01518         {
01519             *this = KFbxProperty::Create(pObject, pName, pDataType, "");
01520 //          KFbxProperty::StaticInit(pObject, pName, pDataType, "");
01521             ModifyFlag(pFlags, true);
01522             return *this;
01523         }
01524 
01533         inline KFbxProperty const & StaticInit(KFbxObject* pObject,
01534                                                char const* pName,
01535                                                KFbxDataType const &pDataType,
01536                                                fbxReference* const &pValue,
01537                                                bool pForceSet=true,
01538                                                eFbxPropertyFlags pFlags=eNO_FLAG
01539                                                )
01540         {
01541             bool lWasFound = false;
01542             *this = KFbxProperty::Create(pObject, pName, pDataType, "",true,&lWasFound);
01543 
01544             if( pForceSet || !lWasFound )
01545             {
01546                 ModifyFlag(pFlags, true);
01547                 Set(pValue,false);
01548             }
01549 
01550             return *this;
01551         }
01553 
01554     public:
01555 
01560         KFbxTypedProperty &operator=(fbxReference* const &pValue)
01561         {
01562             KFbxSet(*this,pValue);
01563             return *this;
01564         }
01565 
01573         inline bool Set(fbxReference* const &pValue ) { return Set(pValue, true); }
01574 
01583         bool Set(fbxReference* const &pValue, bool pCheckValueEquality )
01584         {
01585             KFbxObject* lValue = reinterpret_cast<KFbxObject*>(pValue);
01586             DisconnectAllSrcObject();
01587             if (lValue) {
01588                 return ConnectSrcObject(lValue);
01589             }
01590 
01591             return false;
01592         }
01593 
01597         fbxReference* Get() const
01598         {
01599             KFbxObject* lValue = GetSrcObjectCount() > 0 ? GetSrcObject(0) : NULL;
01600             return reinterpret_cast<fbxReference*>(lValue);
01601         }
01602 
01603         friend class KFbxObject;
01604     };
01605 
01606 
01607     typedef KFbxTypedProperty<fbxBool1>         KFbxPropertyBool1;
01608     typedef KFbxTypedProperty<fbxInteger1>      KFbxPropertyInteger1;
01609     typedef KFbxTypedProperty<fbxDouble1>       KFbxPropertyDouble1;
01610     typedef KFbxTypedProperty<fbxDouble3>       KFbxPropertyDouble3;
01611     typedef KFbxTypedProperty<fbxDouble4>       KFbxPropertyDouble4;
01612     typedef KFbxTypedProperty<fbxString>        KFbxPropertyString;
01613     typedef KFbxTypedProperty<fbxReference*>    KFbxPropertyReference;
01614 
01623     enum eFbxConnectEventType {
01624         eFbxConnectRequest,
01625         eFbxConnect,
01626         eFbxConnected,
01627         eFbxDisconnectRequest,
01628         eFbxDisconnect,
01629         eFbxDisconnected
01630     };
01631 
01636     enum eFbxConnectEventDirection {
01637         eConnectEventSrc,
01638         eConnectEventDst
01639     };
01640 
01644     class KFBX_DLL KFbxConnectEvent
01645     {
01650         public:
01651 
01658             inline KFbxConnectEvent(eFbxConnectEventType pType,eFbxConnectEventDirection pDir,KFbxProperty *pSrc,KFbxProperty *pDst)
01659                 : mType(pType)
01660                 , mDirection(pDir)
01661                 , mSrc(pSrc)
01662                 , mDst(pDst)
01663             {
01664             }
01666 
01671         public:
01672 
01674             inline eFbxConnectEventType GetType() const { return mType; }
01675 
01677             inline eFbxConnectEventDirection GetDirection() const { return mDirection; }
01678 
01680             inline KFbxProperty &GetSrc()  const    { return *mSrc;  }
01681 
01683             inline KFbxProperty &GetDst()  const    { return *mDst;  }
01684 
01689             template < class T > inline T*  GetSrcIfObject(T const *pFBX_TYPE) const    { return mSrc->IsRoot() ? KFbxCast<T>(mSrc->GetFbxObject()) : (T*)0; }
01690 
01695             template < class T > inline T*  GetDstIfObject(T const *pFBX_TYPE) const    { return mDst->IsRoot() ? KFbxCast<T>(mDst->GetFbxObject()) : (T*)0; }
01697 
01698         private:
01699             eFbxConnectEventType        mType;
01700             eFbxConnectEventDirection   mDirection;
01701             KFbxProperty*               mSrc;
01702             KFbxProperty*               mDst;
01703     };
01704 
01705 
01706 
01707 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01708 
01709 #endif // FBXFILESDK_KFBXPLUGINS_KFBXPROPERTY_H
01710