FBX SDK Reference Guide: kfbxpropertyhandle.h Source File
00001 #ifndef _FBXSDK_KFBXPROPERTYHANDLE_H_
00002 #define _FBXSDK_KFBXPROPERTYHANDLE_H_
00003 
00004 /**************************************************************************************
00005 
00006  Copyright ?2001 - 2008 Autodesk, Inc. and/or its licensors.
00007  All Rights Reserved.
00008 
00009  The coded instructions, statements, computer programs, and/or related material 
00010  (collectively the "Data") in these files contain unpublished information 
00011  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00012  Canada and United States of America federal copyright law and by international 
00013  treaties. 
00014  
00015  The Data may not be disclosed or distributed to third parties, in whole or in
00016  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00017 
00018  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00019  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00020  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00021  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00022  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00023  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00024  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00028  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00029  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00030  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00031  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00032  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00033  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00034  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00035  OR DAMAGE. 
00036 
00037 **************************************************************************************/
00038 
00039 #include <kaydaradef.h>
00040 #ifndef KFBX_DLL 
00041     #define KFBX_DLL K_DLLIMPORT
00042 #endif
00043 
00044 #include <kfbxplugins/kfbxtypes.h>
00045 #include <fbxcore/kfbxpropertydef.h>
00046 
00047 
00048 #include <fbxfilesdk_nsbegin.h>
00049 
00050     // Forwards
00051     class   KFbxPropertyPage;
00052     class   KFbxPropertyHandle;
00053     class   KFbxConnectionPointFilter;
00054 
00055     /***********************************************
00056       KFbxPropertyHandle
00057     ************************************************/
00058     typedef KFbxPropertyHandle  KFbxTypeInfoHandle;
00059     typedef KFbxPropertyHandle  KFbxObjectHandle;
00060     typedef int                 kFbxPropertyId;
00061 
00065     class KFBX_DLL KFbxPropertyHandle
00066     {
00071     public:
00072 
00074         static KFbxObjectHandle     Create();
00076         static KFbxObjectHandle     Create(KFbxObjectHandle const &pInstanceOf);
00078         static KFbxTypeInfoHandle   Create(char const *pName,EFbxType pType=eUNIDENTIFIED);
00080         static KFbxTypeInfoHandle   Create(char const *pName,KFbxTypeInfoHandle pTypeInfo);
00084         bool                        Destroy();
00085     public:
00087         KFbxPropertyHandle();
00089         KFbxPropertyHandle(KFbxPropertyHandle const &pAddress);
00090 
00092         ~KFbxPropertyHandle();
00093 
00094     public:
00096         KFbxPropertyHandle(KFbxPropertyPage* pPage,kFbxPropertyId pId=kFbxProperyIdRoot);
00097 
00098 
00100 
00105     public:
00106         // Assignment
00108         KFbxPropertyHandle &operator =  (KFbxPropertyHandle const &pHandle);
00110         bool                operator == (KFbxPropertyHandle const &pHandle) const;
00112         bool                operator != (KFbxPropertyHandle const &pHandle) const;
00114         bool                Is          (KFbxPropertyHandle const &pHandle) const;
00116         bool                Valid() const;
00117 
00119         const char *            GetName() const;
00121         EFbxType                GetType() const;
00123         KFbxTypeInfoHandle      GetTypeInfo() const;
00125         const char *            GetLabel() const;
00126 
00131         bool                    SetLabel(char const *pLabel);
00132 
00133         // Flag management
00135         FbxPropertyFlags::eFbxPropertyFlags     GetFlags() const;
00136 
00142         bool                                    ModifyFlags(FbxPropertyFlags::eFbxPropertyFlags pFlags, bool pValue);
00143 
00149         KFbxInheritType                         GetFlagsInheritType( FbxPropertyFlags::eFbxPropertyFlags pFlags, bool pCheckReferences ) const;
00150 
00156         bool                                    SetFlagsInheritType( FbxPropertyFlags::eFbxPropertyFlags pFlags, KFbxInheritType pType );
00157 
00159         void *                  GetUserData() const;
00160 
00165         bool                    SetUserData(void const *pUserData);
00166 
00168         int                     GetUserTag() const;
00169 
00174         bool                    SetUserTag(int pUserData);
00176 
00181     public:
00182 
00187         int     AddEnumValue(char const *pStringValue);
00188 
00193         void    InsertEnumValue(int pIndex, char const *pStringValue);
00194 
00198         int     GetEnumCount();
00199 
00204         void    SetEnumValue(int pIndex,  char const *pStringValue);
00205 
00209         void    RemoveEnumValue(int pIndex);
00210 
00215         char *  GetEnumValue(int pIndex);
00217 
00218 
00223     public:
00229         KFbxPropertyHandle      Add(char const * pName,KFbxTypeInfoHandle const &pTypeInfo);
00230 
00232         void                    BeginCreateOrFindProperty();
00234         void                    EndCreateOrFindProperty();
00235 
00239         inline bool             IsRoot() const              { return (mPage && (mId==0)) ? true : false; }
00240 
00245         bool                    IsChildOf(KFbxPropertyHandle    const & pParent) const;
00246 
00251         bool                    IsDescendentOf(KFbxPropertyHandle   const & pParent) const;
00252 
00256         KFbxPropertyHandle      GetParent() const;
00257 
00261         bool                    SetParent( KFbxPropertyHandle const& pOther );
00262 
00266         KFbxPropertyHandle      GetChild()  const;
00267 
00271         KFbxPropertyHandle      GetSibling() const;
00272 
00276         KFbxPropertyHandle      GetFirstDescendent()  const;
00277 
00283         KFbxPropertyHandle      GetNextDescendent(KFbxPropertyHandle const &pHandle) const;
00284 
00290         KFbxPropertyHandle      Find (char const *pName,bool pCaseSensitive) const;
00291 
00298         KFbxPropertyHandle      Find (char const *pName,KFbxTypeInfoHandle const &pTypeInfo,bool pCaseSensitive) const;
00299 
00308         KFbxPropertyHandle      Find (char const *pName, const char* pChildrenSeparator,bool pCaseSensitive) const;
00309 
00319         KFbxPropertyHandle      Find (char const *pName, const char* pChildrenSeparator,KFbxTypeInfoHandle const &pTypeInfo,bool pCaseSensitive) const;
00321 
00326     public:
00327 
00333         bool                ConnectSrc      (KFbxPropertyHandle const &pSrc,kFbxConnectionType const pType=eFbxConnectionDefault); 
00334 
00340         int                 GetSrcCount     (KFbxConnectionPointFilter* pFilter=0) const; 
00341 
00348         KFbxPropertyHandle  GetSrc          (KFbxConnectionPointFilter* pFilter=0,int pIndex=0) const; 
00349 
00354         bool                DisconnectSrc   (KFbxPropertyHandle const &pSrc);
00355 
00360         bool                IsConnectedSrc  (KFbxPropertyHandle const &pSrc);
00361 
00367         bool                ConnectDst      (KFbxPropertyHandle const &pDst,kFbxConnectionType const pType=eFbxConnectionDefault); 
00368 
00374         int                 GetDstCount     (KFbxConnectionPointFilter* pFilter=0) const; 
00375 
00382         KFbxPropertyHandle  GetDst          (KFbxConnectionPointFilter* pFilter=0,int pIndex=0) const; 
00383 
00388         bool                DisconnectDst   (KFbxPropertyHandle const &pDst);
00389 
00394         bool                IsConnectedDst  (KFbxPropertyHandle const &pDst);
00395 
00397         void                ClearConnectCache();
00399 
00404     public:
00405 
00409         bool                    HasMin() const;
00410 
00416         bool                            GetMin      (void *pValue,EFbxType pValueType) const;
00417 
00423         bool                            SetMin      (void const *pValue,EFbxType pValueType);
00424 
00429         template <class T> inline bool  SetMin      ( T const &pValue )         { return SetMin( &pValue,FbxTypeOf(pValue) ); }
00430 
00435         template <class T> inline T     GetMin      ( T const *pFBX_TYPE) const { T lValue; GetMin( &lValue,FbxTypeOf(lValue) ); return lValue; }
00436 
00440         bool                    HasSoftMin() const;
00441 
00447         bool                            GetSoftMin  (void *pValue,EFbxType pValueType) const;
00448 
00454         bool                            SetSoftMin  (void const *pValue,EFbxType pValueType);
00455 
00460         template <class T> inline bool  SetSoftMin  ( T const &pValue )         { return SetSoftMin( &pValue,FbxTypeOf(pValue) ); }
00461 
00466         template <class T> inline T     GetSoftMin  ( T const *pFBX_TYPE) const { T lValue; GetSoftMin( &lValue,FbxTypeOf(lValue) ); return lValue; }
00467 
00471         bool                    HasMax() const;
00472 
00478         bool                            GetMax      (void *pValue,EFbxType pValueType) const;
00479 
00485         bool                            SetMax      (void const *pValue,EFbxType pValueType);
00486 
00491         template <class T> inline bool  SetMax      ( T const &pValue )         { return SetMax( &pValue,FbxTypeOf(pValue) ); }
00492 
00497         template <class T> inline T     GetMax      ( T const *pFBX_TYPE) const { T lValue; GetMax( &lValue,FbxTypeOf(lValue) ); return lValue; }
00498 
00502         bool                    HasSoftMax() const;
00503 
00509         bool                            GetSoftMax  (void *pValue,EFbxType pValueType) const;
00510 
00516         bool                            SetSoftMax  (void const *pValue,EFbxType pValueType);
00517 
00522         template <class T> inline bool  SetSoftMax  ( T const &pValue )         { return SetSoftMax( &pValue,FbxTypeOf(pValue) ); }
00523 
00528         template <class T> inline T     GetSoftMax  ( T const *pFBX_TYPE) const { T lValue; GetSoftMax( &lValue,FbxTypeOf(lValue) ); return lValue; }
00529 
00530 
00535     public:
00536 
00541         KFbxInheritType GetValueInheritType(bool pCheckReferences) const;
00542 
00547         bool            SetValueInheritType(KFbxInheritType pType);
00548 
00554         bool            GetDefaultValue(void *pValue,EFbxType pValueType) const;
00555 
00561         bool            Get(void *pValue,EFbxType pValueType) const;
00562 
00570         bool            Set(void const *pValue,EFbxType pValueType,bool pCheckValueEquality);
00571 
00576         template <class T> inline bool  Set( T const &pValue )          { return Set( &pValue,FbxTypeOf(pValue) ); }
00577 
00582         template <class T> inline T     Get( T const *pFBX_TYPE) const  { T lValue; Get( &lValue,FbxTypeOf(lValue) ); return lValue; }
00584 
00589     public:
00590 
00594         void    SetPageDataPtr(void *pData);
00595 
00599         void*   GetPageDataPtr() const;
00600 
00602 
00607 
00611         bool PushPropertiesToParentInstance();
00612 
00613 
00615 
00620     public:
00624         bool    IsAReferenceTo(void) const;
00625 
00629         void*   GetReferenceTo(void) const;
00630 
00634         bool    IsReferencedBy(void) const;
00635 
00639         int     GetReferencedByCount(void) const;
00640 
00645         void*   GetReferencedBy(int pIndex) const; 
00647 
00648 
00649     private:
00650         KFbxPropertyPage*       mPage;
00651         kFbxPropertyId          mId;
00652 
00653     };
00654 
00655     // Internal Allocator Function
00656     KFBX_DLL KMemoryAllocator & GetConnectionPointAllocator();
00657 
00658 #include <fbxfilesdk_nsend.h>
00659 
00660 #endif // #ifndef _FBXSDK_Document_H_