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
00141 #define FB_DEFINE_CLASS_ENUM( EnumName ) \
00142 typedef class FBPropertyBaseEnum< enum __FBClassType::e##EnumName > Property##EnumName;
00143
00148 #define FB_DEFINE_LIST( DllTag, Type ) \
00149 typedef class DllTag FBPropertyBaseList< HFB##Type > FBPropertyBaseList##Type;
00150
00152 typedef void (*fbGetSetHandler)(void);
00154 typedef void (*fbExternalGetSetHandler)(HIObject pObject);
00155
00156 FB_FORWARD( FBComponent );
00157 __FB_FORWARD( FBProperty );
00158
00179 class FBSDK_DLL FBProperty : public FBPlug
00180 {
00181 FBClassDeclare( FBProperty, FBPlug );
00182
00183 protected:
00185 FBString mName;
00187 void* mParent;
00188
00189 public:
00191 FBProperty();
00192
00193 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00194
00195 IObject_Declare(Implementation);
00196
00198 FBProperty* InitInternal( KProperty* pProperty );
00199
00201 KProperty* GetInternal() const;
00202
00204 void* GetValuePtr() const;
00205
00207 FBProperty* CreateInternal( FBComponent* pParent, const char* pName, fbExternalGetSetHandler pGet = NULL, fbExternalGetSetHandler pSet = NULL);
00208
00210 FBProperty* CreateTextureConnectable( FBComponent* pParent, const char* pName );
00211
00213 void SetInternal( KProperty* pInternal );
00214 #endif
00215
00217 void SetEnable( bool pValue );
00218
00222 const char* GetName();
00223
00227 void SetName(const char *pName);
00228
00232 virtual FBPropertyType GetPropertyType( );
00233
00237 const char* GetPropertyTypeName();
00238
00242 virtual KDataType* GetDataType();
00243
00245
00248 virtual void SetData( void* pData );
00250
00252
00257 virtual void GetData( void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL ) const;
00259
00263 int AsInt();
00264
00269 bool SetInt(int pInt);
00270
00274 virtual const char* AsString();
00275
00280 virtual bool SetString( const char* pString );
00281
00284 const char* OriValueAsString();
00285
00287 bool IsAnimated() const;
00288
00291 bool OriIsAnimated() const;
00292
00294
00297 virtual bool IsList();
00298 virtual bool IsAnimatable();
00299 bool IsInternal() const;
00300 bool IsUserProperty();
00301 bool IsTextureConnectableProperty();
00302 bool IsReferenceProperty();
00304
00308 bool IsMinClamp();
00309
00313 bool IsMaxClamp();
00314
00319 bool IsTemporaryProperty();
00320
00325 bool AcceptTemporaryProperty(const char* pEnumList[] = NULL, fbExternalGetSetHandler pGet=NULL, fbExternalGetSetHandler pSet=NULL);
00326
00330 bool IsObjectList();
00331
00335 virtual bool IsReadOnly();
00336
00341 virtual const char* EnumList( int pIndex );
00342
00347 FBStringList* GetEnumStringList(bool pCreateIt = false);
00348
00351 void NotifyEnumStringListChanged();
00352
00358 void ModifyPropertyFlag(FBPropertyFlag pFlag, bool pValue);
00359
00363 FBPropertyFlag GetPropertyFlags();
00364
00370 bool GetPropertyFlag(FBPropertyFlag pFlag);
00371
00378 void SetMinMax( double pMin, double pMax, bool pForceMinClamp = false, bool pForceMaxClamp = false );
00379
00384 void SetMin( double pMin, bool pForceMinClamp = false );
00385
00390 void SetMax( double pMax, bool pForceMaxClamp = false );
00391
00395 double GetMin();
00396
00400 double GetMax();
00401
00405 inline void* GetParent() { return mParent; }
00406
00407 private:
00408
00409 };
00410
00411 __FB_FORWARD( FBPropertyAnimatable );
00412 FB_FORWARD( FBBox );
00413 FB_FORWARD( FBAnimationNode );
00414 FB_FORWARD( FBTake );
00415
00417
00419 __FB_FORWARD(FBPropertyEvent);
00420
00422 class FBSDK_DLL FBPropertyEvent : public FBProperty
00423 {
00424 protected:
00425 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00426
00427 HIRegister mParentRegister;
00429 int mType;
00431 int mSubType;
00432 #endif
00433 public:
00435 FBPropertyEvent();
00436
00445 FBPropertyEvent *Init( FBComponent* pComponent, HIRegister pParent,const char *pName, int pType, int pSubType=K_INT_MAX );
00446
00452 FBPropertyEvent *InitGlobal( const char* pName, const char* pGlobalEventName );
00453
00455 virtual ~FBPropertyEvent();
00456
00458
00462 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00463 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00465
00467 virtual void InvalidateParent();
00468
00472 virtual FBPropertyType GetPropertyType() override { return kFBPT_event; }
00473
00474 private:
00475
00476 HDataFBPropertyEvent mLocalPtr;
00477 };
00478
00480 class FBSDK_DLL FBPropertyEventUIIdle : public FBPropertyEvent
00481 {
00482 public:
00483 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00484 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00485 };
00486
00488 class FBSDK_DLL FBPropertyEventConnectionNotify : public FBPropertyEvent
00489 {
00490 public:
00491 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00492 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00493 };
00494
00496 class FBSDK_DLL FBPropertyEventConnectionDataNotify : public FBPropertyEvent
00497 {
00498 public:
00499 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00500 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00501 };
00502
00504 class FBSDK_DLL FBPropertyEventConnectionStateNotify : public FBPropertyEvent
00505 {
00506 public:
00507 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00508 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00509 };
00510
00512 class FBSDK_DLL FBPropertyEventConnectionKeyingNotify : public FBPropertyEvent
00513 {
00514 public:
00515 virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
00516 virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
00517 };
00518
00522 template <class tType, FBPropertyType pPT> class FBPropertyBase : public FBProperty
00523 {
00524 protected:
00525 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00526 void (* Set)(void *, tType);
00527 tType (* Get)(void *);
00528 #endif
00529 public:
00531 inline FBPropertyBase() { Set = NULL; Get = NULL; }
00532
00536 inline FBPropertyBase(const FBPropertyBase<tType,pPT> &pValue) { operator=((tType)pValue ); }
00537
00539 ~FBPropertyBase()
00540 {
00541 }
00542
00550 inline FBPropertyBase *Init( void* pParent, const char *pName,tType (* pGet)(void *)=NULL,void (* pSet)(void *,tType)=NULL )
00551 {
00552 mParent = pParent;
00553 mName = pName ;
00554 Get = pGet;
00555 Set = pSet;
00556 return this;
00557 }
00558
00560
00564 inline void operator=(tType pValue) { SetData( &pValue ); }
00566
00568
00572 inline void operator=(const FBPropertyBase<tType,pPT> &pProperty) { operator=((tType)pProperty ); }
00574
00579 inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
00580
00584 virtual FBPropertyType GetPropertyType( ) override { return pPT; }
00585
00589 inline void SetPropertyValue( tType pValue )
00590 {
00591 if(IsInternal() && GetValuePtr())
00592 {
00593 *(tType*)GetValuePtr() = pValue;
00594 }
00595 }
00596
00600 inline tType GetPropertyValue( )
00601 {
00602 if(IsInternal() && GetValuePtr())
00603 {
00604 return *(tType*)GetValuePtr();
00605 } else
00606 {
00607 return (tType)0;
00608 }
00609 }
00610
00615 inline virtual bool IsReadOnly() { return IsInternal() ? (FBProperty::IsReadOnly()) : (Set == NULL); }
00616
00620 inline virtual void GetData(void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL) const
00621 {
00622 if(Get)
00623 {
00624 *((tType*)pData) = (*Get)(mParent);
00625 }
00626 else if (IsInternal())
00627 {
00628 FBProperty::GetData( pData, pSize, pEvalInfo );
00629 }
00630 else
00631 {
00632 assert(Get != NULL || IsInternal());
00633 *((tType*)pData) = (tType)0;
00634 }
00635 }
00639 inline virtual void SetData(void* pData)
00640 {
00641 if(Set)
00642 {
00643 (*Set)( mParent,*(tType*)pData );
00644 }
00645 else if (IsInternal())
00646 {
00647 FBProperty::SetData( pData );
00648 }
00649 else
00650 {
00651 assert( Set != NULL || IsInternal() );
00652 }
00653 }
00654 };
00655
00660 template <class tType> class FBPropertyBaseEnum : public FBPropertyBase<tType,kFBPT_enum>
00661 {
00662 public:
00663 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00664
00665 static const char *mStrings[];
00666 #endif
00667
00668 inline FBPropertyBaseEnum(){}
00669
00671 inline ~FBPropertyBaseEnum()
00672 {
00673
00674 }
00675
00679 inline FBPropertyBaseEnum(const FBPropertyBaseEnum<tType> &pValue) { operator=((tType)pValue ); }
00680
00682
00686 inline void operator=(tType pValue) { SetData( &pValue ); }
00688
00693 inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
00694
00695 virtual const char* EnumList( int pIndex ) override
00696 {
00697 if( FBPropertyBaseEnum::IsInternal() )
00698 {
00699 return FBProperty::EnumList( pIndex );
00700 }
00701 else if(mStrings)
00702 {
00703 return mStrings[pIndex];
00704 }
00705 else
00706 {
00707 assert(mStrings || FBPropertyBaseEnum::IsInternal());
00708 return NULL;
00709 }
00710 }
00711
00715 virtual const char* AsString() override { return EnumList( FBPropertyBaseEnum::AsInt() );}
00716
00720 virtual bool SetString( const char *pString ) override
00721 {
00722 int Count=0;
00723 const char * tmpstr;
00724 while ((tmpstr=EnumList( Count ))!=NULL) {
00725 if (strcmp(tmpstr,pString)==0) {
00726 FBPropertyBaseEnum::SetData( &Count );
00727 return true;
00728 }
00729 Count++;
00730 }
00731 return false;
00732 }
00733
00734 };
00735
00736
00740 class FBSDK_DLL FBPropertyBasicList : public FBProperty
00741 {
00742 public:
00744 FBPropertyBasicList();
00745 ~FBPropertyBasicList();
00750 FBPropertyBasicList( HIObject pParent, const char *pName );
00755 FBProperty* Init( void* pParent, const char *pName );
00756
00758 void RemoveAll();
00759
00764 virtual int GetCount()=0;
00765
00770 virtual void RemoveAt( int pIndex )=0;
00771
00775 virtual bool IsList();
00776 };
00777
00781 template <class tType> class FBPropertyBaseList : public FBPropertyBasicList
00782 {
00783 public:
00785 FBPropertyBaseList( ):FBPropertyBasicList( ) {}
00786
00788 ~FBPropertyBaseList( )
00789 {
00790
00791 }
00796 FBPropertyBaseList( HIObject pParent, const char *pName ):FBPropertyBasicList( pParent, pName ) {}
00797
00798 public:
00799
00800
00801
00802
00808 virtual int Add( tType pItem )=0;
00809
00815 virtual tType operator[]( int pIndex )=0;
00816
00817 public:
00818
00819
00820
00821
00826 inline virtual int Find( tType pItem )
00827 {
00828 int Index;
00829 for(Index=0; Index<GetCount(); Index++ )
00830 {
00831 if( operator[](Index)==pItem )
00832 {
00833 return Index;
00834 }
00835 }
00836 return -1;
00837 }
00838
00843 inline virtual int Remove( tType pItem )
00844 {
00845 int Index = Find( pItem );
00846 if (Index!=-1)
00847 {
00848 RemoveAt( Index );
00849 }
00850 return Index;
00851 }
00852
00857 inline virtual tType GetAt(int pIndex)
00858 {
00859 return operator[](pIndex);
00860 }
00861 };
00862
00864 enum kDefaultEnum {
00865 kDefaultItemNone
00866 };
00867
00868
00869 typedef class FBSDK_DLL FBPropertyBaseEnum< enum kDefaultEnum > FBPropertyEnum;
00874 FB_FORWARD( FBPropertyStringList );
00875
00877 class FBSDK_DLL FBPropertyStringList : public FBProperty
00878 {
00879 public:
00881 FBPropertyStringList();
00882
00884 virtual ~FBPropertyStringList();
00885
00891 FBPropertyStringList* Init( FBComponent* pComponent, const char *pName );
00892
00893 public:
00898 kReference GetReferenceAt( int pIndex );
00903 void SetReferenceAt( int pIndex,kReference pRef );
00904
00909 int Find( kReference pRef );
00910
00915 int Find( const char *S );
00916
00921 virtual const char *GetAt( int pIndex );
00922
00928 const char *operator[](int pIndex);
00929
00931 void Sort( );
00932
00936 int GetCount();
00937
00942 int Remove( const char *S );
00943
00944 public:
00950 virtual int Add( const char *S,kReference pRef = 0 );
00951
00953 virtual void Clear();
00954
00958 virtual void RemoveAt( int pIndex );
00959
00964 virtual int IndexOf(const char *S);
00965
00971 virtual void InsertAt( int pIndex, const char *S,kReference pRef = 0 );
00972
00978 virtual bool SetAt( int pIndex,const char *pString );
00979
00983 virtual bool IsList() override;
00984
00988 virtual const char* AsString() override;
00989
00993 virtual bool SetString( const char *pString ) override;
00994
00998 virtual FBPropertyType GetPropertyType() override { return kFBPT_stringlist; }
00999 };
01000
01002
01004 __FB_FORWARD( FBPropertyManager );
01005
01011 class FBSDK_DLL FBPropertyManager
01012 {
01013 public:
01015 FBPropertyManager();
01016
01018 ~FBPropertyManager();
01019
01024 int Add( FBProperty* Property );
01025
01031 FBProperty* operator[](int pIndex);
01032
01036 int GetCount();
01037
01044 FBProperty* Find( const char *pPropertyName, bool pMultilangLookup=true );
01045
01050 int Remove( FBProperty* pProperty );
01051
01056 void AddToCache( FBProperty* pProperty );
01057
01062 void RemoveFromCache( KProperty* pProperty );
01063
01069 FBProperty* FindInCache( KProperty* pProperty );
01070
01071 private:
01075 void ClearCache();
01076
01081 void SetParent( HIObject pParent );
01082
01083 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01084 KObject* mObject;
01085 FBArrayTemplate< FBProperty* > mPropertyCache;
01086 FBArrayTemplate< FBProperty* > mPropertyLocal;
01087 #endif
01088 friend class FBComponent;
01089 friend class FBVisualComponent;
01090 };
01091
01095 template <class tType> class FBPropertyBaseComponent : public FBPropertyBase< tType, kFBPT_object >
01096 {
01097 public:
01099 int *TypeInfo;
01100 public:
01102 inline FBPropertyBaseComponent() {}
01103
01107 inline FBPropertyBaseComponent(const FBPropertyBaseComponent<tType> &pValue) { FBPropertyBase< tType,kFBPT_object >::operator=((tType)pValue ); }
01108
01110 ~FBPropertyBaseComponent()
01111 {
01112 }
01113
01115
01118 inline void operator=(tType pValue) { FBPropertyBase< tType,kFBPT_object >::operator=(pValue); }
01120
01124 inline tType operator -> () { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
01125
01129 inline operator tType() const { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
01130 };
01131
01136 #if defined(KARCH_DEV_INTEL)
01137 #define FBImplementPropertyComponent( DllTag, Type )
01138 #else
01139 #define FBImplementPropertyComponent( DllTag, Type ) \
01140 template class DllTag FBSDKNamespaceFunc(FBPropertyBase)< HFB##Type,kFBPT_object >; \
01141 template class DllTag FBSDKNamespaceFunc(FBPropertyBaseComponent)< HFB##Type >;
01142 #endif
01143
01148 #if defined(KARCH_DEV_INTEL)
01149 #define FBImplementPropertyEnum( DllTag, Type ) // On SGI by having mString defined for each enum already instantiates the template.
01150 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName )
01151 #else
01152 #define FBImplementPropertyEnum( DllTag, Type ) \
01153 template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum FB##Type >
01154 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName ) \
01155 template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum Class::E##EnumName >
01156 #endif
01157
01162 #if defined(KARCH_DEV_INTEL)
01163 #define FBImplementPropertyList( DllTag, Type )
01164 #else
01165 #define FBImplementPropertyList( DllTag, Type ) \
01166 template class DllTag FBSDKNamespaceFunc(FBPropertyBaseList) < HFB##Type >
01167 #endif
01168
01169
01171 class FBSDK_DLL FBPropertyString : public FBPropertyBase< const char *, kFBPT_charptr >
01172 {
01173 public:
01174
01176
01180 inline void operator=(const char* pValue) { SetData( &pValue ); }
01182
01187 inline operator const char* () const { char* Value; GetData( &Value,sizeof(Value) ); return Value; }
01188
01189 inline bool operator==(const char* pValue) const { char* Value; GetData( &Value,sizeof(Value) ); return (Value == pValue) || (strcmp(Value, pValue) == 0); }
01190 inline bool operator!=(const char* pValue) const { return ! operator==(pValue); }
01191
01192 };
01193
01195 typedef class FBSDK_DLL FBPropertyBase< bool,kFBPT_bool > FBPropertyBool;
01196
01200 class FBSDK_DLL FBPropertyAction : public FBPropertyBase< bool, kFBPT_Action >
01201 {
01202 public:
01204 inline FBPropertyAction() {}
01205
01207 ~FBPropertyAction()
01208 {
01209 }
01210
01214 bool operator ()();
01215 };
01216
01218 typedef class FBSDK_DLL FBPropertyBase< int,kFBPT_int > FBPropertyInt;
01219
01221 typedef class FBSDK_DLL FBPropertyBase< long long,kFBPT_int64 > FBPropertyInt64;
01222
01224 typedef class FBSDK_DLL FBPropertyBase< unsigned long long,kFBPT_uint64 > FBPropertyUInt64;
01225
01227 typedef class FBSDK_DLL FBPropertyBase< double,kFBPT_double > FBPropertyDouble;
01228
01230 typedef class FBSDK_DLL FBPropertyBase< float,kFBPT_float > FBPropertyFloat;
01231
01233 typedef class FBSDK_DLL FBPropertyBase< FBTime,kFBPT_Time > FBPropertyTime;
01234
01236 typedef class FBSDK_DLL FBPropertyBase< FBTimeCode,kFBPT_TimeCode > FBPropertyTimeCode;
01237
01239 typedef class FBSDK_DLL FBPropertyBase< FBTimeSpan,kFBPT_TimeSpan > FBPropertyTimeSpan;
01240
01242 typedef class FBSDK_DLL FBPropertyBase< kReference,kFBPT_kReference > FBPropertykReference;
01243
01245 typedef class FBSDK_DLL FBPropertyBase< FBProperty*,kFBPT_Reference > FBPropertyReference;
01247 typedef class FBSDK_DLL FBPropertyBase< FBComponent*,kFBPT_object > _FBPropertyBaseComponent;
01249 typedef class FBSDK_DLL FBPropertyBaseComponent< FBComponent* > FBPropertyComponent;
01251 typedef FBPropertyComponent *HFBPropertyComponent;
01253 typedef class FBSDK_DLL FBPropertyBase< FBPlug*,kFBPT_object > _FBPropertyBasePlug;
01255 typedef class FBPropertyBaseComponent< FBPlug* > FBPropertyPlug;
01257 typedef FBPropertyPlug *HFBPropertyPlug;
01258
01266 #define FBPropertyInit( Param,Type,PropName,Get,Set ) \
01267 { \
01268 PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01269 }
01270
01275 #define FBPropertyInitList( Param,PropName ) \
01276 { \
01277 PropertyAdd(PropName.Init( Param,#PropName )); \
01278 }
01279
01284 #define FBPropertyInitStringList( Param,PropName ) \
01285 { \
01286 PropertyAdd(PropName.Init( Param, #PropName )); \
01287 }
01288
01295 #define FBPropertyInitEvent( Param,Type,SubType,PropName ) \
01296 { \
01297 PropertyAdd(PropName.Init( this, IQ(Param,IRegister),#PropName,Type,SubType )); \
01298 }
01299
01304 #define FBPropertyInitEventGlobal( GlobalEventName,PropName ) \
01305 { \
01306 PropertyAdd(PropName.InitGlobal( #PropName,GlobalEventName )); \
01307 }
01308
01310 #define FBPropertyInitInternal( Parent, PropName, MBProperty ) \
01311 {\
01312 PropertyAdd(PropName.InitInternal( MBProperty ));\
01313 }
01314
01316 #define FBPropertyInitInternalEnum( Param,Type,PropName,MBProperty,Get,Set ) \
01317 {\
01318 PropName.InitInternal( MBProperty ); \
01319 PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
01320 }
01321
01329 #define FBPropertyPublish( Parent,Prop,PropName,Get,Set ) \
01330 { \
01331 PropertyAdd(Prop.CreateInternal( Parent,PropName,(fbExternalGetSetHandler)Get,(fbExternalGetSetHandler)Set )); \
01332 }
01333
01341 #define FBPropertyInitTextureConnectable( Parent,Prop,PropName ) \
01342 { \
01343 PropertyAdd(Prop.CreateTextureConnectable( Parent,PropName )); \
01344 }
01345
01346 typedef class FBSDK_DLL FBPropertyBase< FBColor,kFBPT_ColorRGB > FBPropertyColor;
01351 typedef class FBSDK_DLL FBPropertyBase< FBColorAndAlpha,kFBPT_ColorRGBA > FBPropertyColorAndAlpha;
01356 typedef class FBSDK_DLL FBPropertyBase< FBVector2d,kFBPT_Vector2D > FBPropertyVector2d;
01361 typedef class FBSDK_DLL FBPropertyBase< FBVector3d,kFBPT_Vector3D > FBPropertyVector3d;
01367 typedef class FBSDK_DLL FBPropertyBase< FBVector4d,kFBPT_Vector4D > FBPropertyVector4d;
01372
01373 class FBSDK_DLL FBPropertyAnimatable : public FBProperty
01374 {
01375 public:
01378 FBPropertyAnimatable();
01379
01382 virtual ~FBPropertyAnimatable();
01383
01384 public:
01385 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01386
01387 FBPropertyAnimatable* InitInternal( KEvaluationProperty* pProperty );
01388 #endif
01389
01396 FBPropertyAnimatable* Init( HFBBox pOwner, const char* pName, const char* pType, double* pInit );
01397
01401 void Destroy();
01402
01406 virtual KDataType* GetDataType() override;
01407
01411 const char* GetDataTypeName();
01412
01416 bool IsFocused();
01417
01421 void SetFocus( bool pState );
01422
01425 void Key();
01426
01430 void KeyAt( FBTime pTime );
01431
01435 void KeyRemoveAt( FBTime pTime );
01436
01440 int GetDataSize() const;
01441
01443
01446 virtual bool IsAnimatable() override { return true; }
01447
01452 bool IsAnimated();
01453
01457 void SetAnimated( bool pState );
01458
01463 FBAnimationNode* GetAnimationNode(FBTake* pTake=NULL);
01464
01468 HFBBox GetBox();
01469
01473 virtual void SetData( void* pData ) override;
01474
01478 virtual void GetData( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL ) const override;
01479 };
01480
01484 template <class tType, FBPropertyType pPT> class FBPropertyBaseAnimatable : public FBPropertyAnimatable
01485 {
01486 public:
01488 FBPropertyBaseAnimatable( );
01489 FBPropertyBaseAnimatable( const FBPropertyBaseAnimatable<tType,pPT> &pValue);
01490
01492 ~FBPropertyBaseAnimatable( );
01493
01495
01498 void operator=(tType pValue);
01500
01504 operator tType() const;
01505
01509 virtual FBPropertyType GetPropertyType( ) override { return pPT; }
01510 };
01511
01512
01513 typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_Action > FBPropertyAnimatableAction;
01517 typedef class FBSDK_DLL FBPropertyBaseAnimatable< bool,kFBPT_bool > FBPropertyAnimatableBool;
01521 typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_int > FBPropertyAnimatableInt;
01525 typedef class FBSDK_DLL FBPropertyBaseAnimatable< long long,kFBPT_int64 > FBPropertyAnimatableInt64;
01529 typedef class FBSDK_DLL FBPropertyBaseAnimatable< unsigned long long,kFBPT_uint64 > FBPropertyAnimatableUInt64;
01533 typedef class FBSDK_DLL FBPropertyBaseAnimatable< int,kFBPT_enum > FBPropertyAnimatableEnum;
01537 typedef class FBSDK_DLL FBPropertyBaseAnimatable< double,kFBPT_double > FBPropertyAnimatableDouble;
01541 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBTime,kFBPT_Time > FBPropertyAnimatableTime;
01545 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBTimeCode,kFBPT_TimeCode > FBPropertyAnimatableTimeCode;
01549 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector2d,kFBPT_Vector2D > FBPropertyAnimatableVector2d;
01553 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector3d,kFBPT_Vector3D > FBPropertyAnimatableVector3d;
01557 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBVector4d,kFBPT_Vector4D > FBPropertyAnimatableVector4d;
01561 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColor,kFBPT_ColorRGB > FBPropertyAnimatableColor;
01565 typedef class FBSDK_DLL FBPropertyBaseAnimatable< FBColorAndAlpha,kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha;
01574 template <class tType> class FBPropertyBaseAnimatableEnum : public FBPropertyBaseAnimatable<int,kFBPT_enum>
01575 {
01576 public:
01577 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01578
01579 static const char *mStrings[];
01580 #endif
01581
01583 inline FBPropertyBaseAnimatableEnum(){}
01584
01586 inline ~FBPropertyBaseAnimatableEnum()
01587 {
01588 }
01589
01593 inline FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum<tType> &pValue) { operator=((tType)pValue ); }
01594
01596
01600 inline void operator=(tType pValue) { SetData( &pValue ); }
01602
01607 inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
01608
01609 virtual const char* EnumList( int pIndex ) override
01610 {
01611 if( IsInternal() )
01612 {
01613 return FBProperty::EnumList( pIndex );
01614 }
01615 else if(mStrings)
01616 {
01617 return mStrings[pIndex];
01618 }
01619 else
01620 {
01621 assert(mStrings || IsInternal());
01622 return NULL;
01623 }
01624 }
01625
01629 virtual const char* AsString() override { return EnumList( AsInt() );}
01630
01634 virtual bool SetString( const char *pString ) override
01635 {
01636 int Count=0;
01637 const char * tmpstr;
01638 while ((tmpstr=EnumList( Count ))!=NULL) {
01639 if (strcmp(tmpstr,pString)==0) {
01640 SetData( &Count );
01641 return true;
01642 }
01643 Count++;
01644 }
01645 return false;
01646 }
01647
01648
01649 };
01650
01652
01654 #ifdef FBSDKUseNamespace
01655 }
01656 #endif
01657
01658 #endif