00001 #ifndef __FBPROPERTIES_H__
00002 #define __FBPROPERTIES_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
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
00109 enum FBPropertyFlag
00110 {
00111 kFBPropertyFlagNotSet = 0,
00112 kFBPropertyFlagHideProperty = (1 << 0),
00113 kFBPropertyFlagForceStaticProperty = (1 << 1),
00114 kFBPropertyFlagDisableProperty = (1 << 2),
00115 kFBPropertyFlagSlavedProperty = (1 << 3),
00116 kFBPropertyFlagAnimated = (1 << 4),
00117 kFBPropertyFlagNotSavable = (1 << 5),
00118 kFBPropertyFlagReadOnly = (1 << 6),
00119 kFBPropertyFlagNotUserDeletable = (1 << 7)
00120 };
00121
00126 #define FB_DEFINE_COMPONENT( DllTag, Type ) \
00127 class FB##Type; typedef FB##Type *HFB##Type; \
00128 typedef class DllTag FBPropertyBase< HFB##Type,kFBPT_object > FBPropertyBase##Type; \
00129 typedef class DllTag FBPropertyBaseComponent< HFB##Type > FBProperty##Type
00130
00135 #define FB_DEFINE_ENUM( DllTag, Type ) \
00136 typedef class DllTag FBPropertyBaseEnum< enum FB##Type > FBProperty##Type;
00137
00142 #define FB_DEFINE_LIST( DllTag, Type ) \
00143 typedef class DllTag FBPropertyBaseList< HFB##Type > FBPropertyBaseList##Type;
00144
00146 typedef void (*fbGetSetHandler)(void);
00148 typedef void (*fbExternalGetSetHandler)(HIObject pObject);
00149
00150 FB_FORWARD( FBComponent );
00151 __FB_FORWARD( FBProperty );
00152
00173 class FBSDK_DLL FBProperty : public FBPlug
00174 {
00175 FBClassDeclare( FBProperty, FBPlug );
00176
00177 protected:
00179 FBString mName;
00181 void* mParent;
00182
00183 public:
00185 FBProperty();
00186
00187 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00188
00189 IObject_Declare(Implementation);
00190
00192 FBProperty* InitInternal( KProperty* pProperty );
00193
00195 KProperty* GetInternal() const;
00196
00198 void* GetValuePtr() const;
00199
00201 FBProperty* CreateInternal( FBComponent* pParent, char* pName, fbExternalGetSetHandler pGet = NULL, fbExternalGetSetHandler pSet = NULL);
00202
00204 void SetInternal( KProperty* pInternal );
00205 #endif
00206
00208 void SetEnable( bool pValue );
00209
00213 char* GetName();
00214
00218 void SetName(char *pName);
00219
00223 virtual FBPropertyType GetPropertyType( );
00224
00228 char* GetPropertyTypeName();
00229
00233 virtual KDataType* GetDataType();
00234
00236
00239 virtual void SetData( void* pData );
00241
00243
00248 virtual void GetData( void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL ) const;
00250
00254 int AsInt();
00255
00260 bool SetInt(int pInt);
00261
00265 virtual char* AsString();
00266
00271 virtual bool SetString( char* pString );
00272
00274
00277 virtual bool IsList();
00278 virtual bool IsAnimatable();
00279 bool IsInternal() const;
00280 bool IsUserProperty();
00281 bool IsReferenceProperty();
00283
00287 bool IsMinClamp();
00288
00292 bool IsMaxClamp();
00293
00298 bool IsTemporaryProperty();
00299
00304 bool AcceptTemporaryProperty(const char* pEnumList[] = NULL, fbExternalGetSetHandler pGet=NULL, fbExternalGetSetHandler pSet=NULL);
00305
00309 bool IsObjectList();
00310
00314 virtual bool IsReadOnly();
00315
00320 virtual char* EnumList( int pIndex );
00321
00326 FBStringList* GetEnumStringList(bool pCreateIt = false);
00327
00330 void NotifyEnumStringListChanged();
00331
00337 void ModifyPropertyFlag(FBPropertyFlag pFlag, bool pValue);
00338
00342 FBPropertyFlag GetPropertyFlags();
00343
00349 bool GetPropertyFlag(FBPropertyFlag pFlag);
00350
00357 void SetMinMax( double pMin, double pMax, bool pForceMinClamp = false, bool pForceMaxClamp = false );
00358
00363 void SetMin( double pMin, bool pForceMinClamp = false );
00364
00369 void SetMax( double pMax, bool pForceMaxClamp = false );
00370
00374 double GetMin();
00375
00379 double GetMax();
00380
00384 inline void* GetParent() { return mParent; }
00385 };
00386
00387 __FB_FORWARD( FBPropertyAnimatable );
00388 FB_FORWARD( FBBox );
00389 FB_FORWARD( FBAnimationNode );
00390 FB_FORWARD( FBTake );
00391
00393
00395 __FB_FORWARD(FBPropertyEvent);
00396
00398 class FBSDK_DLL FBPropertyEvent : public FBProperty
00399 {
00400 protected:
00401 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00402
00403 HIRegister mParentRegister;
00405 int mType;
00407 int mSubType;
00408 #endif
00409 public:
00411 FBPropertyEvent();
00412
00421 FBPropertyEvent *Init( FBComponent* pComponent, HIRegister pParent,char *pName, int pType, int pSubType=K_INT_MAX );
00422
00428 FBPropertyEvent *InitGlobal( char* pName, char* pGlobalEventName );
00429
00431 virtual ~FBPropertyEvent();
00432
00434
00438 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00439 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00441
00443 virtual void InvalidateParent();
00444
00448 virtual FBPropertyType GetPropertyType() override { return kFBPT_event; }
00449
00450 private:
00451
00452 HDataFBPropertyEvent mLocalPtr;
00453 };
00454
00456 class FBSDK_DLL FBPropertyEventUIIdle : public FBPropertyEvent
00457 {
00458 public:
00459 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00460 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00461 };
00462
00464 class FBSDK_DLL FBPropertyEventConnectionNotify : public FBPropertyEvent
00465 {
00466 public:
00467 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00468 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00469 };
00470
00472 class FBSDK_DLL FBPropertyEventConnectionDataNotify : public FBPropertyEvent
00473 {
00474 public:
00475 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00476 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00477 };
00478
00480 class FBSDK_DLL FBPropertyEventConnectionStateNotify : public FBPropertyEvent
00481 {
00482 public:
00483 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00484 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00485 };
00486
00490 template <class tType, FBPropertyType pPT> class FBPropertyBase : public FBProperty
00491 {
00492 protected:
00493 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00494 void (* Set)(void *, tType);
00495 tType (* Get)(void *);
00496 #endif
00497 public:
00499 inline FBPropertyBase() { Set = NULL; Get = NULL; }
00500
00504 inline FBPropertyBase(const FBPropertyBase<tType,pPT> &pValue) { operator=((tType)pValue ); }
00505
00507 ~FBPropertyBase()
00508 {
00509 }
00510
00518 inline FBPropertyBase *Init( void* pParent,char *pName,tType (* pGet)(void *)=NULL,void (* pSet)(void *,tType)=NULL )
00519 {
00520 mParent = pParent;
00521 mName = pName ;
00522 Get = pGet;
00523 Set = pSet;
00524 return this;
00525 }
00526
00528
00532 inline void operator=(tType pValue) { SetData( &pValue ); }
00534
00539 inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
00540
00544 virtual FBPropertyType GetPropertyType( ) override { return pPT; }
00545
00549 inline void SetPropertyValue( tType pValue )
00550 {
00551 if(IsInternal() && GetValuePtr())
00552 {
00553 *(tType*)GetValuePtr() = pValue;
00554 }
00555 }
00556
00560 inline tType GetPropertyValue( )
00561 {
00562 if(IsInternal() && GetValuePtr())
00563 {
00564 return *(tType*)GetValuePtr();
00565 } else
00566 {
00567 return (tType)0;
00568 }
00569 }
00570
00575 inline virtual bool IsReadOnly() { return IsInternal() ? (FBProperty::IsReadOnly()) : (Set == NULL); }
00576
00580 inline virtual void GetData(void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL) const
00581 {
00582 if(Get)
00583 {
00584 *((tType*)pData) = (*Get)(mParent);
00585 }
00586 else if (IsInternal())
00587 {
00588 FBProperty::GetData( pData, pSize, pEvalInfo );
00589 }
00590 else
00591 {
00592 assert(Get != NULL || IsInternal());
00593 *((tType*)pData) = (tType)0;
00594 }
00595 }
00599 inline virtual void SetData(void* pData)
00600 {
00601 if(Set)
00602 {
00603 (*Set)( mParent,*(tType*)pData );
00604 }
00605 else if (IsInternal())
00606 {
00607 FBProperty::SetData( pData );
00608 }
00609 else
00610 {
00611 assert( Set != NULL || IsInternal() );
00612 }
00613 }
00614 };
00615
00619 template <class tType> class FBPropertyBaseEnum : public FBPropertyBase<tType,kFBPT_enum>
00620 {
00621 public:
00622 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00623
00624 static const char *mStrings[];
00625 #endif
00626
00627 inline FBPropertyBaseEnum(){}
00628
00630 inline ~FBPropertyBaseEnum()
00631 {
00632
00633 }
00634
00638 inline FBPropertyBaseEnum(const FBPropertyBaseEnum<tType> &pValue) { operator=((tType)pValue ); }
00639
00641
00645 inline void operator=(tType pValue) { SetData( &pValue ); }
00647
00652 inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
00653
00654 virtual char* EnumList( int pIndex ) override
00655 {
00656 if( IsInternal() )
00657 {
00658 return FBProperty::EnumList( pIndex );
00659 }
00660 else if(mStrings)
00661 {
00662 return (char *)mStrings[pIndex];
00663 }
00664 else
00665 {
00666 assert(mStrings || FBPropertyBaseEnum::IsInternal());
00667 return NULL;
00668 }
00669 }
00670
00674 virtual char* AsString() override { return EnumList( FBPropertyBaseEnum::AsInt() );}
00675
00679 virtual bool SetString( char *pString ) override
00680 {
00681 int Count=0;
00682 const char * tmpstr;
00683 while ((tmpstr=EnumList( Count ))!=NULL) {
00684 if (strcmp(tmpstr,pString)==0) {
00685 FBPropertyBaseEnum::SetData( &Count );
00686 return true;
00687 }
00688 Count++;
00689 }
00690 return false;
00691 }
00692
00693 };
00694
00695
00699 class FBSDK_DLL FBPropertyBasicList : public FBProperty
00700 {
00701 public:
00703 FBPropertyBasicList();
00704 ~FBPropertyBasicList();
00709 FBPropertyBasicList( HIObject pParent, char *pName );
00714 FBProperty* Init( void* pParent, char *pName );
00715
00717 void RemoveAll();
00718
00723 virtual int GetCount()=0;
00724
00729 virtual void RemoveAt( int pIndex )=0;
00730
00734 virtual bool IsList();
00735 };
00736
00740 template <class tType> class FBPropertyBaseList : public FBPropertyBasicList
00741 {
00742 public:
00744 FBPropertyBaseList( ):FBPropertyBasicList( ) {}
00745
00747 ~FBPropertyBaseList( )
00748 {
00749
00750 }
00755 FBPropertyBaseList( HIObject pParent, char *pName ):FBPropertyBasicList( pParent, pName ) {}
00756
00757 public:
00758
00759
00760
00761
00767 virtual int Add( tType pItem )=0;
00768
00774 virtual tType operator[]( int pIndex )=0;
00775
00776 public:
00777
00778
00779
00780
00785 inline virtual int Find( tType pItem )
00786 {
00787 int Index;
00788 for(Index=0; Index<GetCount(); Index++ )
00789 {
00790 if( operator[](Index)==pItem )
00791 {
00792 return Index;
00793 }
00794 }
00795 return -1;
00796 }
00797
00802 inline virtual int Remove( tType pItem )
00803 {
00804 int Index = Find( pItem );
00805 if (Index!=-1)
00806 {
00807 RemoveAt( Index );
00808 }
00809 return Index;
00810 }
00811
00816 inline virtual tType GetAt(int pIndex)
00817 {
00818 return operator[](pIndex);
00819 }
00820 };
00821
00823 enum kDefaultEnum {
00824 kDefaultItemNone
00825 };
00826
00827
00828 typedef class FBSDK_DLL FBPropertyBaseEnum< enum kDefaultEnum > FBPropertyEnum;
00833 FB_FORWARD( FBPropertyStringList );
00834
00836 class FBSDK_DLL FBPropertyStringList : public FBProperty
00837 {
00838 public:
00840 FBPropertyStringList();
00841
00843 virtual ~FBPropertyStringList();
00844
00850 FBPropertyStringList* Init( FBComponent* pComponent, char *pName );
00851
00852 public:
00857 kReference GetReferenceAt( int pIndex );
00862 void SetReferenceAt( int pIndex,kReference pRef );
00863
00868 int Find( kReference pRef );
00869
00874 int Find( char *S );
00875
00880 virtual char *GetAt( int pIndex );
00881
00887 char *operator[](int pIndex);
00888
00890 void Sort( );
00891
00895 int GetCount();
00896
00901 int Remove( char *S );
00902
00903 public:
00909 virtual int Add( char *S,kReference pRef = 0 );
00910
00912 virtual void Clear();
00913
00917 virtual void RemoveAt( int pIndex );
00918
00923 virtual int IndexOf(char *S);
00924
00930 virtual void InsertAt( int pIndex, char *S,kReference pRef = 0 );
00931
00937 virtual bool SetAt( int pIndex,char *pString );
00938
00942 virtual bool IsList() override;
00943
00947 virtual char* AsString() override;
00948
00952 virtual bool SetString( char *pString ) override;
00953
00957 virtual FBPropertyType GetPropertyType() override { return kFBPT_stringlist; }
00958 };
00959
00961
00963 __FB_FORWARD( FBPropertyManager );
00964
00970 class FBSDK_DLL FBPropertyManager
00971 {
00972 public:
00974 FBPropertyManager();
00975
00977 ~FBPropertyManager();
00978
00983 int Add( HFBProperty Property );
00984
00990 HFBProperty operator[](int pIndex);
00991
00995 int GetCount();
00996
01003 HFBProperty Find( const char *pPropertyName, bool pMultilangLookup=true );
01004
01009 int Remove( FBProperty* pProperty );
01010
01015 void AddToCache( FBProperty* pProperty );
01016
01021 void RemoveFromCache( KProperty* pProperty );
01022
01028 FBProperty* FindInCache( KProperty* pProperty );
01029
01030 private:
01034 void ClearCache();
01035
01040 void SetParent( HIObject pParent );
01041
01042 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01043 KObject* mObject;
01044 FBArrayTemplate< FBProperty* > mPropertyCache;
01045 FBArrayTemplate< FBProperty* > mPropertyLocal;
01046 #endif
01047 friend class FBComponent;
01048 friend class FBVisualComponent;
01049 };
01050
01054 template <class tType> class FBPropertyBaseComponent : public FBPropertyBase< tType, kFBPT_object >
01055 {
01056 public:
01058 int *TypeInfo;
01059 public:
01061 inline FBPropertyBaseComponent() {}
01062
01066 inline FBPropertyBaseComponent(const FBPropertyBaseComponent<tType> &pValue) { FBPropertyBase< tType,kFBPT_object >::operator=((tType)pValue ); }
01067
01069 ~FBPropertyBaseComponent()
01070 {
01071 }
01072
01074
01077 inline void operator=(tType pValue) { FBPropertyBase< tType,kFBPT_object >::operator=(pValue); }
01079
01083 inline tType operator -> () { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
01084
01088 inline operator tType() const { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
01089 };
01090
01095 #if defined(KARCH_DEV_INTEL)
01096 #define FBImplementPropertyComponent( DllTag, Type )
01097 #else
01098 #define FBImplementPropertyComponent( DllTag, Type ) \
01099 template class DllTag FBSDKNamespaceFunc(FBPropertyBase)< HFB##Type,kFBPT_object >; \
01100 template class DllTag FBSDKNamespaceFunc(FBPropertyBaseComponent)< HFB##Type >;
01101 #endif
01102
01107 #if defined(KARCH_DEV_INTEL)
01108 #define FBImplementPropertyEnum( DllTag, Type ) // On SGI by having mString defined for each enum already instantiates the template.
01109 #else
01110 #define FBImplementPropertyEnum( DllTag, Type ) \
01111 template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum FB##Type >
01112 #endif
01113
01118 #if defined(KARCH_DEV_INTEL)
01119 #define FBImplementPropertyList( DllTag, Type )
01120 #else
01121 #define FBImplementPropertyList( DllTag, Type ) \
01122 template class DllTag FBSDKNamespaceFunc(FBPropertyBaseList) < HFB##Type >
01123 #endif
01124
01125
01127 class FBSDK_DLL FBPropertyString : public FBPropertyBase< char *, kFBPT_charptr >
01128 {
01129 public:
01130
01132
01136 inline void operator=(const char* pValue) { SetData( &pValue ); }
01138
01143 inline operator const char* () const { char* Value; GetData( &Value,sizeof(Value) ); return Value; }
01144
01145 inline bool operator==(const char* pValue) const { char* Value; GetData( &Value,sizeof(Value) ); return (Value == pValue) || (strcmp(Value, pValue) == 0); }
01146 inline bool operator!=(const char* pValue) const { return ! operator==(pValue); }
01147
01148 };
01149
01151 typedef class FBSDK_DLL FBPropertyBase< bool,kFBPT_bool > FBPropertyBool;
01152
01156 class FBSDK_DLL FBPropertyAction : public FBPropertyBase< bool, kFBPT_Action >
01157 {
01158 public:
01160 inline FBPropertyAction() {}
01161
01163 ~FBPropertyAction()
01164 {
01165 }
01166
01170 bool operator ()();
01171 };
01172
01174 typedef class FBSDK_DLL FBPropertyBase< int,kFBPT_int > FBPropertyInt;
01175
01177 typedef class FBSDK_DLL FBPropertyBase< long long,kFBPT_int64 > FBPropertyInt64;
01178
01180 typedef class FBSDK_DLL FBPropertyBase< unsigned long long,kFBPT_uint64 > FBPropertyUInt64;
01181
01183 typedef class FBSDK_DLL FBPropertyBase< double,kFBPT_double > FBPropertyDouble;
01184
01186 typedef class FBSDK_DLL FBPropertyBase< float,kFBPT_float > FBPropertyFloat;
01187
01189 typedef class FBSDK_DLL FBPropertyBase< FBTime,kFBPT_Time > FBPropertyTime;
01190
01192 typedef class FBSDK_DLL FBPropertyBase< FBTimeCode,kFBPT_TimeCode > FBPropertyTimeCode;
01193
01195 typedef class FBSDK_DLL FBPropertyBase< FBTimeSpan,kFBPT_TimeSpan > FBPropertyTimeSpan;
01196
01198 typedef class FBSDK_DLL FBPropertyBase< kReference,kFBPT_kReference > FBPropertykReference;
01199
01201 typedef class FBSDK_DLL FBPropertyBase< HFBProperty,kFBPT_Reference > FBPropertyReference;
01203 typedef class FBSDK_DLL FBPropertyBase< HFBComponent,kFBPT_object > _FBPropertyBaseComponent;
01205 typedef class FBSDK_DLL FBPropertyBaseComponent< HFBComponent > FBPropertyComponent;
01207 typedef FBPropertyComponent *HFBPropertyComponent;
01209 typedef class FBSDK_DLL FBPropertyBase< HFBPlug,kFBPT_object > _FBPropertyBasePlug;
01211 typedef class FBPropertyBaseComponent< HFBPlug > FBPropertyPlug;
01213 typedef FBPropertyPlug *HFBPropertyPlug;
01214
01222 #define FBPropertyInit( Param,Type,PropName,Get,Set ) \
01223 { \
01224 PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01225 }
01226
01231 #define FBPropertyInitList( Param,PropName ) \
01232 { \
01233 PropertyAdd(PropName.Init( Param,#PropName )); \
01234 }
01235
01240 #define FBPropertyInitStringList( Param,PropName ) \
01241 { \
01242 PropertyAdd(PropName.Init( Param, #PropName )); \
01243 }
01244
01251 #define FBPropertyInitEvent( Param,Type,SubType,PropName ) \
01252 { \
01253 PropertyAdd(PropName.Init( this, IQ(Param,IRegister),#PropName,Type,SubType )); \
01254 }
01255
01260 #define FBPropertyInitEventGlobal( GlobalEventName,PropName ) \
01261 { \
01262 PropertyAdd(PropName.InitGlobal( #PropName,GlobalEventName )); \
01263 }
01264
01266 #define FBPropertyInitInternal( Parent, PropName, MBProperty ) \
01267 {\
01268 PropertyAdd(PropName.InitInternal( MBProperty ));\
01269 }
01270
01272 #define FBPropertyInitInternalEnum( Param,Type,PropName,MBProperty,Get,Set ) \
01273 {\
01274 PropName.InitInternal( MBProperty ); \
01275 PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01276 }
01277
01285 #define FBPropertyPublish( Parent,Prop,PropName,Get,Set ) \
01286 { \
01287 PropertyAdd(Prop.CreateInternal( Parent,PropName,(fbExternalGetSetHandler)Get,(fbExternalGetSetHandler)Set )); \
01288 }
01289
01290 typedef class FBSDK_DLL FBPropertyBase< FBColor,kFBPT_ColorRGB > FBPropertyColor;
01295 typedef class FBSDK_DLL FBPropertyBase< FBColorAndAlpha,kFBPT_ColorRGBA > FBPropertyColorAndAlpha;
01300 typedef class FBSDK_DLL FBPropertyBase< FBVector2d,kFBPT_Vector2D > FBPropertyVector2d;
01305 typedef class FBSDK_DLL FBPropertyBase< FBVector3d,kFBPT_Vector3D > FBPropertyVector3d;
01311 typedef class FBSDK_DLL FBPropertyBase< FBVector4d,kFBPT_Vector4D > FBPropertyVector4d;
01316
01317 class FBSDK_DLL FBPropertyAnimatable : public FBProperty
01318 {
01319 public:
01322 FBPropertyAnimatable();
01323
01326 virtual ~FBPropertyAnimatable();
01327
01328 public:
01329 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01330
01331 FBPropertyAnimatable* InitInternal( KEvaluationProperty* pProperty );
01332 #endif
01333
01340 FBPropertyAnimatable* Init( HFBBox pOwner, char* pName, char* pType, double* pInit );
01341
01345 void Destroy();
01346
01350 virtual KDataType* GetDataType() override;
01351
01355 char* GetDataTypeName();
01356
01360 bool IsFocused();
01361
01365 void SetFocus( bool pState );
01366
01369 void Key();
01370
01374 int GetDataSize() const;
01375
01377
01380 virtual bool IsAnimatable() override { return true; }
01381
01386 bool IsAnimated();
01387
01391 void SetAnimated( bool pState );
01392
01397 FBAnimationNode* GetAnimationNode(FBTake* pTake=NULL);
01398
01402 HFBBox GetBox();
01403
01407 virtual void SetData( void* pData ) override;
01408
01412 virtual void GetData( void* pData, int pSize, HFBEvaluateInfo pEvalInfo = NULL ) const override;
01413 };
01414
01418 template <class tType, FBPropertyType pPT> class FBPropertyBaseAnimatable : public FBPropertyAnimatable
01419 {
01420 public:
01422 FBPropertyBaseAnimatable( );
01423 FBPropertyBaseAnimatable( const FBPropertyBaseAnimatable<tType,pPT> &pValue);
01424
01426 ~FBPropertyBaseAnimatable( );
01427
01429
01432 void operator=(tType pValue);
01434
01438 operator tType() const;
01439
01443 virtual FBPropertyType GetPropertyType( ) override { return pPT; }
01444 };
01445
01446
01447 typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_Action > FBPropertyAnimatableAction;
01451 typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_bool > FBPropertyAnimatableBool;
01455 typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_int > FBPropertyAnimatableInt;
01459 typedef class FBSDK_DLL FBPropertyBaseAnimatable< long long,kFBPT_int64 > FBPropertyAnimatableInt64;
01463 typedef class FBSDK_DLL FBPropertyBaseAnimatable< unsigned long long,kFBPT_uint64 > FBPropertyAnimatableUInt64;
01467 typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_enum > FBPropertyAnimatableEnum;
01471 typedef class FBSDK_DLL FBPropertyBaseAnimatable< double,kFBPT_double > FBPropertyAnimatableDouble;
01475 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBTime,kFBPT_Time > FBPropertyAnimatableTime;
01479 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBTimeCode,kFBPT_TimeCode > FBPropertyAnimatableTimeCode;
01483 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector2d,kFBPT_Vector2D > FBPropertyAnimatableVector2d;
01487 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector3d,kFBPT_Vector3D > FBPropertyAnimatableVector3d;
01491 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector4d,kFBPT_Vector4D > FBPropertyAnimatableVector4d;
01495 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColor,kFBPT_ColorRGB > FBPropertyAnimatableColor;
01499 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColorAndAlpha,kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha;
01508 template <class tType> class FBPropertyBaseAnimatableEnum : public FBPropertyBaseAnimatable<int,kFBPT_enum>
01509 {
01510 public:
01511 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01512
01513 static const char *mStrings[];
01514 #endif
01515
01517 inline FBPropertyBaseAnimatableEnum(){}
01518
01520 inline ~FBPropertyBaseAnimatableEnum()
01521 {
01522 }
01523
01527 inline FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum<tType> &pValue) { operator=((tType)pValue ); }
01528
01530
01534 inline void operator=(tType pValue) { SetData( &pValue ); }
01536
01541 inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
01542
01543 virtual char* EnumList( int pIndex ) override
01544 {
01545 if( IsInternal() )
01546 {
01547 return FBProperty::EnumList( pIndex );
01548 }
01549 else if(mStrings)
01550 {
01551 return (char *)mStrings[pIndex];
01552 }
01553 else
01554 {
01555 assert(mStrings || IsInternal());
01556 return NULL;
01557 }
01558 }
01559
01563 virtual char* AsString() override { return EnumList( AsInt() );}
01564
01568 virtual bool SetString( char *pString ) override
01569 {
01570 int Count=0;
01571 const char * tmpstr;
01572 while ((tmpstr=EnumList( Count ))!=NULL) {
01573 if (strcmp(tmpstr,pString)==0) {
01574 SetData( &Count );
01575 return true;
01576 }
01577 Count++;
01578 }
01579 return false;
01580 }
01581
01582
01583 };
01584
01586
01588 #ifdef FBSDKUseNamespace
01589 }
01590 #endif
01591
01592 #endif