fbproperties.h

Go to the documentation of this file.
00001 #ifndef __FBPROPERTIES_H__
00002 #define __FBPROPERTIES_H__
00003 /**************************************************************************
00004 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005 All Rights Reserved.
00006 
00007 The coded instructions, statements, computer programs, and/or related 
00008 material (collectively the "Data") in these files contain unpublished 
00009 information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010 protected by Canada and United States of America federal copyright law 
00011 and by international treaties.
00012 
00013 The Data may not be disclosed or distributed to third parties, in whole 
00014 or in part, without the prior written consent of Autodesk, Inc. 
00015 ("Autodesk").
00016 
00017 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024 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 
00028 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036 
00037 **************************************************************************/
00038 
00045 #include <kaydaradef.h>
00046 
00047 #ifndef FBSDK_DLL
00048 
00051 #define FBSDK_DLL K_DLLIMPORT
00052 #endif
00053 
00054 #include <assert.h>
00055 #include <stdio.h>
00056 #include <stdlib.h>
00057 
00058 #include <fbsdk/fbplug.h>
00059 #include <fbsdk/fbarray.h>
00060 #include <fbsdk/fbstring.h>
00061 #include <fbsdk/fbtime.h>
00062 #include <fbsdk/fbevaluateinfo.h>
00063 
00064 K_FORWARD( KEventBase );
00065 K_FORWARD( KObject );
00066 K_FORWARD( KProperty );
00067 K_FORWARD( KEvaluationProperty );
00068 K_FORWARD( KDataType );
00069 K_FORWARD( IFBObject );
00070 K_FORWARD( IRegister );
00071 
00072 #ifdef FBSDKUseNamespace
00073 namespace FBSDKNamespace {
00074 #endif
00075 
00077 
00079     enum FBPropertyType
00080     {
00081         kFBPT_unknown,  
00082         kFBPT_int,      
00083         kFBPT_int64,    
00084         kFBPT_uint64,   
00085         kFBPT_bool,     
00086         kFBPT_float,    
00087         kFBPT_double,   
00088         kFBPT_charptr,  
00089         kFBPT_enum,     
00090         kFBPT_Time,     
00091         kFBPT_TimeCode, 
00092         kFBPT_object,   
00093         kFBPT_event,    
00094         kFBPT_stringlist,
00095         kFBPT_Vector4D, 
00096         kFBPT_Vector3D, 
00097         kFBPT_ColorRGB, 
00098         kFBPT_ColorRGBA,
00099         kFBPT_Action,   
00100         kFBPT_Reference,
00101         kFBPT_TimeSpan, 
00102         kFBPT_kReference,
00103         kFBPT_Vector2D  
00104     };
00105 
00107 
00109     enum FBDataAsStringFlag
00110     {
00111         kFBDataAsStringUI              = 0,        
00112         kFBDataAsStringPersistence     = 1,        
00113     };
00114 
00118     enum FBPropertyFlag
00119     {
00120         kFBPropertyFlagNotSet = 0,
00121         kFBPropertyFlagHideProperty = (1 << 0),       
00122         kFBPropertyFlagForceStaticProperty = (1 << 1),
00123         kFBPropertyFlagDisableProperty = (1 << 2),
00124         kFBPropertyFlagSlavedProperty = (1 << 3),     
00125         kFBPropertyFlagAnimated = (1 << 4),
00126         kFBPropertyFlagNotSavable = (1 << 5),         
00127         kFBPropertyFlagReadOnly = (1 << 6),
00128         kFBPropertyFlagNotUserDeletable = (1 << 7),
00129         kFBValueAllocated = (1 << 8),                 
00130         kFBDynamicHidden = (1 << 9),                  
00131         kFBSlaveSetByMaster = (1 << 10),              
00132         kFBLoadedUserProperty = (1 << 11)             
00133     };
00134 
00139 #define FB_DEFINE_COMPONENT( DllTag, Type )                                             \
00140     class FB##Type;                                                                     \
00141     typedef class DllTag FBPropertyBase< FB##Type*,kFBPT_object > FBPropertyBase##Type; \
00142     typedef class DllTag FBPropertyBaseComponent< FB##Type* > FBProperty##Type
00143 
00148 #define FB_DEFINE_ENUM( DllTag, Type ) \
00149     typedef class DllTag FBPropertyBaseEnum< enum FB##Type > FBProperty##Type;
00150 
00154 #define FB_DEFINE_CLASS_ENUM( EnumName ) \
00155     typedef class FBPropertyBaseEnum< enum __FBClassType::e##EnumName > Property##EnumName;
00156 
00161 #define FB_DEFINE_LIST( DllTag, Type )  \
00162     typedef class DllTag FBPropertyBaseList< FB##Type* > FBPropertyBaseList##Type;
00163 
00165     typedef void (*fbGetSetHandler)(void);
00167     typedef void (*fbExternalGetSetHandler)(HIObject pObject);
00168 
00169     FB_FORWARD( FBComponent );
00170     __FB_FORWARD( FBProperty );
00171 
00192     class FBSDK_DLL FBProperty : public FBPlug
00193     {
00194         FBClassDeclare( FBProperty, FBPlug );
00195 
00196     protected:
00198         FBString        mName;
00200         void*           mParent;
00201 
00202     public:
00204         FBProperty();    
00205 
00206 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00207 
00208         IObject_Declare(K_IMPLEMENTATION);      
00209 
00211         FBProperty* InitInternal( KProperty* pProperty );
00212 
00214         KProperty* GetInternal() const;
00215 
00217         void* GetValuePtr() const;
00218 
00220         FBProperty* CreateInternal( FBComponent* pParent, const char* pName, fbExternalGetSetHandler pGet = NULL, fbExternalGetSetHandler pSet = NULL);
00221 
00223         FBProperty* CreateTextureConnectable( FBComponent* pParent, const char* pName );
00224 
00226         void SetInternal( KProperty* pInternal );
00227 #endif
00228 
00230         void SetEnable( bool pValue );
00231 
00235         const char* GetName();
00236 
00240         void SetName(const char *pName);
00241 
00245         virtual FBPropertyType GetPropertyType( );
00246 
00250         const char* GetPropertyTypeName();
00251 
00255         virtual KDataType* GetDataType();
00256 
00258 
00261         virtual void SetData( void* pData );
00263 
00265 
00270         virtual void GetData( void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL ) const;
00272 
00276         int         AsInt();
00277 
00282         bool        SetInt(int pInt);
00283 
00288         virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI );
00289 
00294         virtual bool SetString( const char* pString );
00295 
00299         const char* OriValueAsString();
00300 
00302         bool IsAnimated() const;
00303 
00306         bool OriIsAnimated() const;
00307 
00309 
00312         virtual bool IsList();
00313         virtual bool IsAnimatable();
00314         bool IsInternal() const;
00315         bool IsUserProperty();
00316         bool IsTextureConnectableProperty();
00317         bool IsReferenceProperty();
00319 
00323         bool IsMinClamp();  
00324 
00328         bool IsMaxClamp();
00329 
00334         bool IsTemporaryProperty();
00335 
00340         bool AcceptTemporaryProperty(const char* pEnumList[] = NULL, fbExternalGetSetHandler pGet=NULL, fbExternalGetSetHandler pSet=NULL);
00341 
00345         bool IsObjectList();
00346 
00350         virtual bool IsReadOnly();
00351 
00356         virtual const char* EnumList( int pIndex );
00357 
00362         FBStringList* GetEnumStringList(bool pCreateIt = false);
00363 
00366         void NotifyEnumStringListChanged();
00367 
00373         void            ModifyPropertyFlag(FBPropertyFlag pFlag, bool pValue);
00374 
00378         FBPropertyFlag  GetPropertyFlags();
00379 
00385         bool            GetPropertyFlag(FBPropertyFlag pFlag);
00386 
00393         void    SetMinMax( double pMin, double pMax, bool pForceMinClamp = false, bool pForceMaxClamp = false );
00394 
00399         void    SetMin( double pMin, bool pForceMinClamp = false );
00400 
00405         void    SetMax( double pMax, bool pForceMaxClamp = false );
00406 
00410         double  GetMin();
00411 
00415         double  GetMax();
00416 
00420         inline void* GetParent()    { return mParent; } 
00421 
00431 
00435         int     GetSubMemberCount() const;
00436 
00440         bool    AllowsLocking() const;
00441 
00445         bool    HasSomethingLocked() const;
00446 
00450         bool    IsLocked() const;
00451 
00456         bool    IsMemberLocked( int pIndex ) const;
00457 
00461         void    SetLocked( bool pLocked );
00462 
00467         void    SetMemberLocked( int pIndex , bool pLocked );
00468 
00470 
00471     private:
00472         //  FBProperty(FBProperty&); // Make sure no copy constructor is use
00473     };
00474 
00475     __FB_FORWARD( FBPropertyAnimatable );
00476     FB_FORWARD( FBBox );
00477     FB_FORWARD( FBAnimationNode );
00478     FB_FORWARD( FBTake );
00479 
00481     // PropertyEvent
00483     __FB_FORWARD(FBPropertyEvent);
00484 
00495     class FBSDK_DLL FBPropertyEvent : public FBProperty
00496     {
00497     protected:
00498 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00499 
00500         HIRegister  mParentRegister;
00502         int         mType;              
00504         int         mSubType;
00505 #endif
00506     public:
00508         FBPropertyEvent();
00509 
00518         FBPropertyEvent *Init( FBComponent* pComponent, HIRegister pParent,const char *pName, int pType, int pSubType=K_INT_MAX );  
00519 
00525         FBPropertyEvent *InitGlobal( const char* pName, const char* pGlobalEventName ); 
00526 
00528         virtual ~FBPropertyEvent();
00529 
00531 
00535         virtual void Add        ( HICallback pOwner, kICallbackHandler pHandler );
00536         virtual void Remove     ( HICallback pOwner, kICallbackHandler pHandler );
00538 
00540         virtual void InvalidateParent();
00541 
00545         virtual FBPropertyType GetPropertyType() override { return kFBPT_event; }
00546 
00547     private:
00548 
00549         DataFBPropertyEvent* mLocalPtr; 
00550     };
00551 
00553     class FBSDK_DLL FBPropertyEventUIIdle : public FBPropertyEvent
00554     {
00555     public:
00556         virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00557         virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00558     };
00559 
00561     class FBSDK_DLL FBPropertyEventVideoFrameRendering : public FBPropertyEvent
00562     {
00563     public:
00564         virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00565         virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00566     };
00567 
00569     class FBSDK_DLL FBPropertyEventConnectionNotify : public FBPropertyEvent
00570     {
00571     public:
00572         virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00573         virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00574     };
00575 
00577     class FBSDK_DLL FBPropertyEventConnectionDataNotify : public FBPropertyEvent
00578     {
00579     public:
00580         virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00581         virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00582     };
00583 
00585     class FBSDK_DLL FBPropertyEventConnectionStateNotify : public FBPropertyEvent
00586     {
00587     public:
00588         virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00589         virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00590     };
00591 
00593     class FBSDK_DLL FBPropertyEventConnectionKeyingNotify : public FBPropertyEvent
00594     {
00595     public:
00596         virtual void Add    ( HICallback pOwner, kICallbackHandler pHandler );
00597         virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00598     };
00599 
00603     template <class tType, FBPropertyType pPT> class FBPropertyBase : public FBProperty 
00604     { 
00605     protected: 
00606 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00607         void  (* Set)(void *, tType);   
00608         tType (* Get)(void *);          
00609 #endif
00610     public: 
00611 
00613         typedef tType ValueType;
00614 
00616         inline FBPropertyBase() { Set = NULL; Get = NULL; }  
00617 
00621         inline FBPropertyBase(const FBPropertyBase<tType,pPT> &pValue)  { operator=((tType)pValue ); }
00622 
00624         ~FBPropertyBase() 
00625         {     
00626         }
00627 
00635         inline FBPropertyBase *Init( void* pParent, const char *pName,tType (* pGet)(void *)=NULL,void (* pSet)(void *,tType)=NULL  )
00636         {  
00637             mParent = pParent;  
00638             mName   = pName ;   
00639             Get     = pGet;     
00640             Set     = pSet;     
00641             return this;
00642         } 
00643 
00645 
00649         inline void operator=(tType pValue)                 { SetData( &pValue ); }
00651 
00653 
00657         inline void operator=(const FBPropertyBase<tType,pPT> &pProperty)   { operator=((tType)pProperty ); }
00659 
00664         inline operator tType() const                       { tType Value; GetData( &Value,sizeof(Value) ); return Value; } 
00665 
00669         virtual FBPropertyType GetPropertyType( ) override { return pPT; }
00670 
00674         inline virtual void SetPropertyValue( tType pValue )
00675         {
00676             if(IsInternal() && GetValuePtr())
00677             {
00678                 *(tType*)GetValuePtr() = pValue;
00679             }
00680         }
00681 
00685         inline tType GetPropertyValue( )
00686         {
00687             if(IsInternal() && GetValuePtr())
00688             {
00689                 return *(tType*)GetValuePtr();
00690             } else
00691             {
00692                 return (tType)0;
00693             }
00694         }
00695 
00700         inline virtual bool IsReadOnly()  { return IsInternal() ? (FBProperty::IsReadOnly()) : (Set == NULL); }
00701 
00705         inline virtual void GetData(void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL) const
00706         {
00707             if(Get)
00708             { 
00709                 *((tType*)pData) = (*Get)(mParent); 
00710             } 
00711             else if (IsInternal())
00712             {
00713                 FBProperty::GetData( pData, pSize, pEvalInfo );
00714             } 
00715             else
00716             {
00717                 assert(Get != NULL || IsInternal());
00718                 *((tType*)pData) = (tType)0; 
00719             }
00720         }
00724         inline virtual void SetData(void* pData)
00725         { 
00726             if(Set) 
00727             { 
00728                 (*Set)( mParent,*(tType*)pData ); 
00729             } 
00730             else if (IsInternal())
00731             {
00732                 FBProperty::SetData( pData );
00733             } 
00734             else
00735             { 
00736                 assert( Set != NULL || IsInternal() ); 
00737             } 
00738         } 
00739     };
00740 
00745     template <class tType> class FBPropertyBaseEnum : public FBPropertyBase<tType,kFBPT_enum>
00746     {
00747     public: 
00748 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00749 
00750         static const char *mStrings[];
00751 #endif
00752 
00753         inline FBPropertyBaseEnum(){}  
00754 
00756         inline ~FBPropertyBaseEnum()
00757         {
00758 
00759         }  
00760 
00764         inline FBPropertyBaseEnum(const FBPropertyBaseEnum<tType> &pValue)  { operator=((tType)pValue ); }
00765 
00767 
00771         inline void operator=(tType pValue)                 { SetData( &pValue ); }
00773 
00778         inline operator tType() const                       { tType Value; GetData( &Value,sizeof(Value) ); return Value; } 
00779 
00780         virtual const char* EnumList( int pIndex ) override 
00781         {   
00782             if( FBPropertyBaseEnum::IsInternal() )
00783             {
00784                 return FBProperty::EnumList( pIndex );
00785             }
00786             else if(mStrings)
00787             {
00788                 return mStrings[pIndex]; 
00789             }
00790             else
00791             {
00792                 assert(mStrings || FBPropertyBaseEnum::IsInternal());
00793                 return NULL;
00794             }
00795         }
00796 
00801         virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override { return EnumList( FBPropertyBaseEnum::AsInt() );}
00802 
00807         virtual bool SetString( const char *pString ) override
00808         {
00809             int         Count=0;
00810             const char *    tmpstr;
00811             while ((tmpstr=EnumList( Count ))!=NULL) {
00812                 if (strcmp(tmpstr,pString)==0) {
00813                     FBPropertyBaseEnum::SetData( &Count );
00814                     return true;
00815                 }
00816                 Count++;
00817             }
00818             return false;
00819         }
00820 
00821     };
00822 
00823 
00827     class FBSDK_DLL FBPropertyBasicList : public FBProperty
00828     {
00829     public:
00831         FBPropertyBasicList();
00832         ~FBPropertyBasicList();
00837         FBPropertyBasicList( HIObject pParent, const char *pName );
00842         FBProperty* Init( void* pParent, const char *pName );
00843 
00845         void RemoveAll();
00846 
00851         virtual int GetCount()=0;
00852 
00857         virtual void RemoveAt( int pIndex )=0;
00858 
00862         virtual bool IsList();
00863     };
00864 
00868     template <class tType> class FBPropertyBaseList : public FBPropertyBasicList
00869     {
00870     public:
00872         FBPropertyBaseList( ):FBPropertyBasicList( ) {}
00873 
00875         ~FBPropertyBaseList( )
00876         {
00877 
00878         }
00883         FBPropertyBaseList( HIObject pParent, const char *pName ):FBPropertyBasicList( pParent, pName ) {}
00884 
00885     public:  
00886         //***
00887         //--- These functions require overloads in derived classes. 
00888         //***
00889 
00895         virtual int Add( tType pItem )=0;
00896 
00902         virtual tType operator[]( int pIndex )=0;
00903 
00904     public: 
00905         //***
00906         //--- These functions can be optionally overloaded in derived classes.
00907         //***
00908 
00913         inline virtual int Find( tType pItem )      
00914         { 
00915             int Index;
00916             for(Index=0; Index<GetCount(); Index++ ) 
00917             {
00918                 if( operator[](Index)==pItem ) 
00919                 {
00920                     return Index; 
00921                 }
00922             }
00923             return -1;
00924         }
00925 
00930         inline virtual int Remove( tType pItem )        
00931         {
00932             int Index = Find( pItem ); 
00933             if (Index!=-1)
00934             {
00935                 RemoveAt( Index );
00936             }
00937             return Index;
00938         }
00939 
00944         inline virtual tType GetAt(int pIndex)  
00945         {
00946             return operator[](pIndex); 
00947         }
00948     };
00949 
00951     enum kDefaultEnum { 
00952         kDefaultItemNone    
00953     };
00954 
00955 
00956     typedef class FBSDK_DLL FBPropertyBaseEnum< enum kDefaultEnum > FBPropertyEnum;
00961     FB_FORWARD( FBPropertyStringList );
00962 
00964     class FBSDK_DLL FBPropertyStringList : public FBProperty
00965     {
00966     public:
00968         FBPropertyStringList();
00969 
00971         virtual ~FBPropertyStringList();
00972 
00978         FBPropertyStringList* Init( FBComponent* pComponent, const char *pName );
00979 
00980     public:
00985         kReference  GetReferenceAt( int pIndex );
00990         void SetReferenceAt( int pIndex,kReference pRef );
00991 
00996         int Find( kReference pRef );
00997 
01002         int Find( const char *S );
01003 
01008         virtual const char *GetAt( int pIndex );
01009 
01015         const char *operator[](int pIndex);
01016 
01018         void Sort( );
01019 
01023         int GetCount();
01024 
01029         int Remove( const char *S );
01030 
01031     public:  // Needs to be overriden for special behaviors
01037         virtual int Add( const char *S,kReference pRef = 0 );
01038 
01040         virtual void Clear();
01041 
01045         virtual void RemoveAt( int pIndex );
01046 
01051         virtual int IndexOf(const char *S);
01052 
01058         virtual void InsertAt( int pIndex, const char *S,kReference pRef = 0 );
01059 
01065         virtual bool SetAt( int pIndex,const char *pString );
01066 
01070         virtual bool IsList() override;
01071 
01076         virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override;
01077 
01082         virtual bool SetString( const char *pString ) override;
01083 
01087         virtual FBPropertyType GetPropertyType() override { return kFBPT_stringlist; }
01088     };
01089 
01091     // FBPropertyManager
01093     __FB_FORWARD( FBPropertyManager );
01094 
01100     class FBSDK_DLL FBPropertyManager 
01101     {
01102     public:
01104         FBPropertyManager();
01105 
01107         ~FBPropertyManager();
01108 
01113         int Add( FBProperty* Property );
01114 
01120         FBProperty* operator[](int pIndex);
01121 
01125         int GetCount();
01126 
01133         FBProperty* Find( const char *pPropertyName, bool pMultilangLookup=true );
01134 
01139         int Remove( FBProperty* pProperty );
01140 
01145         void AddToCache( FBProperty* pProperty );
01146 
01151         void RemoveFromCache( KProperty* pProperty );
01152 
01158         FBProperty* FindInCache( KProperty* pProperty );
01159 
01160     private:
01164         void ClearCache();
01165 
01170         void SetParent( HIObject pParent );
01171 
01172 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01173         KObject*                        mObject;        
01174         FBArrayTemplate< FBProperty* >  mPropertyCache; 
01175         FBArrayTemplate< FBProperty* >  mPropertyLocal; 
01176 #endif
01177         friend class FBComponent;
01178         friend class FBVisualComponent;
01179     };
01180 
01184     template <class tType> class FBPropertyBaseComponent : public FBPropertyBase< tType, kFBPT_object > 
01185     {
01186     public:
01188         int *TypeInfo;  
01189     public:
01191         inline FBPropertyBaseComponent() {}
01192 
01196         inline FBPropertyBaseComponent(const FBPropertyBaseComponent<tType> &pValue)    { FBPropertyBase< tType,kFBPT_object >::operator=((tType)pValue ); }
01197 
01199         ~FBPropertyBaseComponent()
01200         {
01201         }
01202 
01204 
01207         inline void operator=(tType pValue)                             { FBPropertyBase< tType,kFBPT_object >::operator=(pValue); } 
01209 
01213         inline tType operator -> ()                                 { return FBPropertyBase< tType,kFBPT_object >::operator tType(); } 
01214 
01218         inline operator tType() const                                   { return FBPropertyBase< tType,kFBPT_object >::operator tType(); } 
01219     };
01220 
01225 #if defined(KARCH_DEV_INTEL)
01226 #define FBImplementPropertyComponent( DllTag, Type ) 
01227 #else
01228 #define FBImplementPropertyComponent( DllTag, Type ) \
01229     template class DllTag FBSDKNamespaceFunc(FBPropertyBase)< FB##Type*,kFBPT_object >; \
01230     template class DllTag FBSDKNamespaceFunc(FBPropertyBaseComponent)< FB##Type* >;
01231 #endif
01232 
01237 #if defined(KARCH_DEV_INTEL)
01238 #define FBImplementPropertyEnum( DllTag, Type ) // On SGI by having mString defined for each enum already instantiates the template.
01239 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName )
01240 #else
01241 #define FBImplementPropertyEnum( DllTag, Type ) \
01242     template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum FB##Type >
01243 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName ) \
01244     template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum Class::E##EnumName >
01245 #endif
01246 
01251 #if defined(KARCH_DEV_INTEL)
01252 #define FBImplementPropertyList( DllTag, Type )
01253 #else
01254 #define FBImplementPropertyList( DllTag, Type ) \
01255     template class DllTag FBSDKNamespaceFunc(FBPropertyBaseList) < FB##Type* >
01256 #endif
01257 
01258 
01260     class FBSDK_DLL FBPropertyString : public FBPropertyBase< const char *, kFBPT_charptr > 
01261     {
01262     public:
01263 
01265 
01269         inline void operator=(const char* pValue)                   { SetData( &pValue ); }
01271 
01276         inline operator const char* () const                            { char* Value; GetData( &Value,sizeof(Value) ); return Value; } 
01277 
01278         inline bool operator==(const char* pValue) const                { char* Value; GetData( &Value,sizeof(Value) ); return (Value == pValue) || (strcmp(Value, pValue) == 0); }
01279         inline bool operator!=(const char* pValue) const                { return ! operator==(pValue); }
01280 
01284         virtual void SetPropertyValue( const char* pValue ) override;
01285     };
01286 
01288     typedef class FBSDK_DLL FBPropertyBase< bool,kFBPT_bool > FBPropertyBool;
01289 
01293     class FBSDK_DLL FBPropertyAction : public FBPropertyBase< bool, kFBPT_Action > 
01294     {
01295     public:
01297         inline FBPropertyAction() {}
01298 
01300         ~FBPropertyAction()
01301         {
01302         }
01303 
01307         bool operator ()();
01308     };
01309 
01311     typedef class FBSDK_DLL FBPropertyBase< int,kFBPT_int > FBPropertyInt;
01312 
01314     typedef class FBSDK_DLL FBPropertyBase< long long,kFBPT_int64 > FBPropertyInt64;
01315 
01317     typedef class FBSDK_DLL FBPropertyBase< unsigned long long,kFBPT_uint64 > FBPropertyUInt64;
01318 
01320     typedef class FBSDK_DLL FBPropertyBase< double,kFBPT_double > FBPropertyDouble;
01321 
01323     typedef class FBSDK_DLL FBPropertyBase< float,kFBPT_float > FBPropertyFloat;
01324 
01326     typedef class FBSDK_DLL FBPropertyBase< FBTime,kFBPT_Time > FBPropertyTime;
01327 
01329     typedef class FBSDK_DLL FBPropertyBase< FBTimeCode,kFBPT_TimeCode > FBPropertyTimeCode;
01330 
01332     typedef class FBSDK_DLL FBPropertyBase< FBTimeSpan,kFBPT_TimeSpan > FBPropertyTimeSpan;
01333 
01335     typedef class FBSDK_DLL FBPropertyBase< kReference,kFBPT_kReference >   FBPropertykReference;
01336 
01338     typedef class FBSDK_DLL FBPropertyBase< FBProperty*,kFBPT_Reference >           FBPropertyReference;
01340     typedef class FBSDK_DLL FBPropertyBase< FBComponent*,kFBPT_object >         _FBPropertyBaseComponent;
01342     typedef class FBSDK_DLL FBPropertyBaseComponent< FBComponent* > FBPropertyComponent;
01344     typedef class FBSDK_DLL FBPropertyBase< FBPlug*,kFBPT_object >           _FBPropertyBasePlug;
01346     typedef class FBPropertyBaseComponent< FBPlug* >  FBPropertyPlug;
01347 
01355 #define FBPropertyInit( Param,Type,PropName,Get,Set ) \
01356     { \
01357     PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01358     }
01359 
01364 #define FBPropertyInitList( Param,PropName ) \
01365     { \
01366     PropertyAdd(PropName.Init( Param,#PropName )); \
01367     }
01368 
01373 #define FBPropertyInitStringList( Param,PropName ) \
01374     { \
01375     PropertyAdd(PropName.Init( Param, #PropName )); \
01376     }
01377 
01384 #define FBPropertyInitEvent( Param,Type,SubType,PropName ) \
01385     { \
01386     PropertyAdd(PropName.Init( this, IQ(Param,IRegister),#PropName,Type,SubType )); \
01387     }
01388 
01393 #define FBPropertyInitEventGlobal( GlobalEventName,PropName ) \
01394     { \
01395     PropertyAdd(PropName.InitGlobal( #PropName,GlobalEventName )); \
01396     }
01397 
01399 #define FBPropertyInitInternal( Parent, PropName, MBProperty ) \
01400     {\
01401     PropertyAdd(PropName.InitInternal( MBProperty ));\
01402     }
01403 
01405 #define FBPropertyInitInternalEnum( Param,Type,PropName,MBProperty,Get,Set  ) \
01406     {\
01407     PropName.InitInternal( MBProperty ); \
01408     PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01409     }
01410 
01418 #define FBPropertyPublish( Parent,Prop,PropName,Get,Set ) \
01419     { \
01420     PropertyAdd(Prop.CreateInternal( Parent,PropName,(fbExternalGetSetHandler)Get,(fbExternalGetSetHandler)Set )); \
01421     }
01422 
01429 #define FBPropertyInitTextureConnectable( Parent,Prop,PropName ) \
01430     { \
01431     PropertyAdd(Prop.CreateTextureConnectable( Parent,PropName )); \
01432     }
01433 
01434     typedef class FBSDK_DLL FBPropertyBase< FBColor,kFBPT_ColorRGB >    FBPropertyColor;
01439     typedef class FBSDK_DLL FBPropertyBase< FBColorAndAlpha,kFBPT_ColorRGBA >   FBPropertyColorAndAlpha;
01444     typedef class FBSDK_DLL FBPropertyBase< FBVector2d,kFBPT_Vector2D > FBPropertyVector2d;
01449     typedef class FBSDK_DLL FBPropertyBase< FBVector3d,kFBPT_Vector3D > FBPropertyVector3d;
01455     typedef class FBSDK_DLL FBPropertyBase< FBVector4d,kFBPT_Vector4D > FBPropertyVector4d;
01460 
01461     class FBSDK_DLL FBPropertyAnimatable : public FBProperty
01462     {
01463     public:
01466         FBPropertyAnimatable();
01467 
01470         virtual ~FBPropertyAnimatable();
01471 
01472     public:
01473 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01474 
01475         FBPropertyAnimatable* InitInternal( KEvaluationProperty* pProperty );
01476 #endif
01477 
01484         FBPropertyAnimatable* Init( FBBox* pOwner, const char* pName, const char* pType, double* pInit );
01485 
01489         void Destroy();
01490 
01494         virtual KDataType* GetDataType() override;
01495 
01499         const char* GetDataTypeName();
01500 
01504         bool IsFocused();
01505 
01509         void SetFocus( bool pState );
01510 
01513         void Key();
01514 
01518         void KeyAt( FBTime pTime );
01519 
01523         void KeyRemoveAt( FBTime pTime );
01524 
01528         int GetDataSize() const;
01529 
01531 
01534         virtual bool IsAnimatable() override { return true; }
01535 
01540         bool IsAnimated();
01541 
01545         void SetAnimated( bool pState );
01546 
01551         FBAnimationNode* GetAnimationNode(FBTake* pTake=NULL);
01552 
01556         FBBox* GetBox();
01557 
01561         virtual void SetData( void* pData ) override;
01562 
01566         virtual void GetData( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL ) const override;
01567 
01573         void SetCandidate( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL );
01574 
01580         void SetGlobalCandidate( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL );
01581 
01582 
01591 
01595         bool    AllowsMuting() const;
01596 
01600         bool    HasSomethingMuted() const;
01601 
01605         bool    IsMuted() const;
01606 
01611         bool    IsMemberMuted( int pIndex ) const;
01612 
01616         void    SetMuted( bool pMuted );
01617 
01622         void    SetMemberMuted( int pIndex , bool pMuted );
01623 
01625 
01626     };
01627 
01631     template <class tType, FBPropertyType pPT> class FBPropertyBaseAnimatable : public FBPropertyAnimatable
01632     {
01633     public:
01634 
01636         typedef tType ValueType;
01637 
01639         FBPropertyBaseAnimatable( );
01640         FBPropertyBaseAnimatable( const FBPropertyBaseAnimatable<tType,pPT> &pValue);
01641 
01643         ~FBPropertyBaseAnimatable( );
01644 
01646 
01649         void operator=(tType pValue);
01651 
01655         operator tType() const;
01656 
01660         virtual FBPropertyType GetPropertyType( ) override { return pPT; }
01661     };
01662 
01663 
01664     typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_Action > FBPropertyAnimatableAction;
01668     typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_bool > FBPropertyAnimatableBool;
01672     typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_int > FBPropertyAnimatableInt;
01676     typedef class FBSDK_DLL FBPropertyBaseAnimatable< long long,kFBPT_int64 > FBPropertyAnimatableInt64;
01680     typedef class FBSDK_DLL FBPropertyBaseAnimatable< unsigned long long,kFBPT_uint64 > FBPropertyAnimatableUInt64;
01684     typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_enum > FBPropertyAnimatableEnum;
01688     typedef class FBSDK_DLL FBPropertyBaseAnimatable< double,kFBPT_double >  FBPropertyAnimatableDouble;
01692     typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBTime,kFBPT_Time >    FBPropertyAnimatableTime;
01696     typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBTimeCode,kFBPT_TimeCode >   FBPropertyAnimatableTimeCode;
01700     typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector2d,kFBPT_Vector2D > FBPropertyAnimatableVector2d;
01704     typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector3d,kFBPT_Vector3D > FBPropertyAnimatableVector3d;
01708     typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector4d,kFBPT_Vector4D > FBPropertyAnimatableVector4d;
01712     typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColor,kFBPT_ColorRGB >  FBPropertyAnimatableColor;
01716     typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColorAndAlpha,kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha;
01725     template <class tType> class FBPropertyBaseAnimatableEnum : public  FBPropertyBaseAnimatable<int,kFBPT_enum>
01726     {
01727     public: 
01728 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01729 
01730         static const char *mStrings[];
01731 #endif
01732 
01734         inline FBPropertyBaseAnimatableEnum(){}  
01735 
01737         inline ~FBPropertyBaseAnimatableEnum()
01738         {
01739         }  
01740 
01744         inline FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum<tType> &pValue)  { operator=((tType)pValue ); }
01745 
01747 
01751         inline void operator=(tType pValue)                 { SetData( &pValue ); }
01753 
01758         inline operator tType() const                       { tType Value; GetData( &Value,sizeof(Value) ); return Value; } 
01759 
01760         virtual const char* EnumList( int pIndex ) override
01761         {   
01762             if( IsInternal() )
01763             {
01764                 return FBProperty::EnumList( pIndex );
01765             }
01766             else if(mStrings)
01767             {
01768                 return mStrings[pIndex]; 
01769             }
01770             else
01771             {
01772                 assert(mStrings || IsInternal());
01773                 return NULL;
01774             }
01775         }
01776 
01781         virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override { return EnumList( AsInt() );}
01782 
01787         virtual bool SetString( const char *pString ) override
01788         {
01789             int         Count=0;
01790             const char *    tmpstr;
01791             while ((tmpstr=EnumList( Count ))!=NULL) {
01792                 if (strcmp(tmpstr,pString)==0) {
01793                     SetData( &Count );
01794                     return true;
01795                 }
01796                 Count++;
01797             }
01798             return false;
01799         }
01800 
01801 
01802     };
01803 
01805     // Global
01807 #ifdef FBSDKUseNamespace
01808 }
01809 #endif
01810 
01811 #endif