fbsdk/fbproperties.h Source File

fbproperties.h
Go to the documentation of this file.
1 #ifndef __FBPROPERTIES_H__
2 #define __FBPROPERTIES_H__
3 /**************************************************************************
4 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5 All Rights Reserved.
6 
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain unpublished
9 information proprietary to Autodesk, Inc. and/or its licensors, which is
10 protected by Canada and United States of America federal copyright law
11 and by international treaties.
12 
13 The Data may not be disclosed or distributed to third parties, in whole
14 or in part, without the prior written consent of Autodesk, Inc.
15 ("Autodesk").
16 
17 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24 FREE.
25 
26 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
45 #include <kaydaradef.h>
46 
47 #ifndef FBSDK_DLL
48 
51 #define FBSDK_DLL K_DLLIMPORT
52 #endif
53 
54 #include <assert.h>
55 #include <stdio.h>
56 #include <stdlib.h>
57 
58 #include <fbsdk/fbplug.h>
59 #include <fbsdk/fbarray.h>
60 #include <fbsdk/fbstring.h>
61 #include <fbsdk/fbtime.h>
62 #include <fbsdk/fbevaluateinfo.h>
63 
64 K_FORWARD( KEventBase );
65 K_FORWARD( KObject );
66 K_FORWARD( KProperty );
67 K_FORWARD( KEvaluationProperty );
68 K_FORWARD( KDataType );
69 K_FORWARD( IFBObject );
70 K_FORWARD( IRegister );
71 
72 #ifdef FBSDKUseNamespace
73 namespace FBSDKNamespace {
74 #endif
75 
77 
80  {
104  };
105 
107 
110  {
113  };
114 
119  {
129  kFBValueAllocated = (1 << 8),
130  kFBDynamicHidden = (1 << 9),
131  kFBSlaveSetByMaster = (1 << 10),
133  };
134 
139 #define FB_DEFINE_COMPONENT( DllTag, Type ) \
140  class FB##Type; \
141  typedef class DllTag FBPropertyBase< FB##Type*,kFBPT_object > FBPropertyBase##Type; \
142  typedef class DllTag FBPropertyBaseComponent< FB##Type* > FBProperty##Type
143 
148 #define FB_DEFINE_ENUM( DllTag, Type ) \
149  typedef class DllTag FBPropertyBaseEnum< enum FB##Type > FBProperty##Type;
150 
154 #define FB_DEFINE_CLASS_ENUM( EnumName ) \
155  typedef class FBPropertyBaseEnum< enum __FBClassType::e##EnumName > Property##EnumName;
156 
161 #define FB_DEFINE_LIST( DllTag, Type ) \
162  typedef class DllTag FBPropertyBaseList< FB##Type* > FBPropertyBaseList##Type;
163 
165  typedef void (*fbGetSetHandler)(void);
167  typedef void (*fbExternalGetSetHandler)(HIObject pObject);
168 
171 
192  class FBSDK_DLL FBProperty : public FBPlug
193  {
195 
196  protected:
198  FBString mName;
200  void* mParent;
201 
202  public:
204  FBProperty();
205 
206 #ifndef DOXYGEN_SHOULD_SKIP_THIS
209 
211  FBProperty* InitInternal( KProperty* pProperty );
212 
214  KProperty* GetInternal() const;
215 
217  void* GetValuePtr() const;
218 
220  FBProperty* CreateInternal( FBComponent* pParent, const char* pName, fbExternalGetSetHandler pGet = NULL, fbExternalGetSetHandler pSet = NULL);
221 
223  FBProperty* CreateTextureConnectable( FBComponent* pParent, const char* pName );
224 
226  void SetInternal( KProperty* pInternal );
227 #endif
228 
230  void SetEnable( bool pValue );
231 
235  const char* GetName();
236 
240  void SetName(const char *pName);
241 
245  virtual FBPropertyType GetPropertyType( );
246 
250  const char* GetPropertyTypeName();
251 
255  virtual KDataType* GetDataType();
256 
258 
261  virtual void SetData( void* pData );
263 
265 
270  virtual void GetData( void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL ) const;
272 
276  int AsInt();
277 
282  bool SetInt(int pInt);
283 
288  virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI );
289 
294  virtual bool SetString( const char* pString );
295 
299  const char* OriValueAsString();
300 
302  bool IsAnimated() const;
303 
306  bool OriIsAnimated() const;
307 
309 
312  virtual bool IsList();
313  virtual bool IsAnimatable();
314  bool IsInternal() const;
315  bool IsUserProperty();
316  bool IsTextureConnectableProperty();
317  bool IsReferenceProperty();
319 
323  bool IsMinClamp();
324 
328  bool IsMaxClamp();
329 
334  bool IsTemporaryProperty();
335 
340  bool AcceptTemporaryProperty(const char* pEnumList[] = NULL, fbExternalGetSetHandler pGet=NULL, fbExternalGetSetHandler pSet=NULL);
341 
345  bool IsObjectList();
346 
350  virtual bool IsReadOnly();
351 
356  virtual const char* EnumList( int pIndex );
357 
362  FBStringList* GetEnumStringList(bool pCreateIt = false);
363 
366  void NotifyEnumStringListChanged();
367 
373  void ModifyPropertyFlag(FBPropertyFlag pFlag, bool pValue);
374 
378  FBPropertyFlag GetPropertyFlags();
379 
385  bool GetPropertyFlag(FBPropertyFlag pFlag);
386 
393  void SetMinMax( double pMin, double pMax, bool pForceMinClamp = false, bool pForceMaxClamp = false );
394 
399  void SetMin( double pMin, bool pForceMinClamp = false );
400 
405  void SetMax( double pMax, bool pForceMaxClamp = false );
406 
410  double GetMin();
411 
415  double GetMax();
416 
420  inline void* GetParent() { return mParent; }
421 
431 
435  int GetSubMemberCount() const;
436 
440  bool AllowsLocking() const;
441 
445  bool HasSomethingLocked() const;
446 
450  bool IsLocked() const;
451 
456  bool IsMemberLocked( int pIndex ) const;
457 
461  void SetLocked( bool pLocked );
462 
467  void SetMemberLocked( int pIndex , bool pLocked );
468 
470 
471  private:
472  // FBProperty(FBProperty&); // Make sure no copy constructor is use
473  };
474 
480  template<class T> inline T* FBCast(FBProperty* pProperty, bool pAutoCreate = false)
481  {
482  HIObject lProperty = pProperty ? FBGetFBObject(pProperty->GetHIObject(), pAutoCreate) : NULL;
483  // Should also validate type but not available for now
484  return (T*)lProperty;
485  }
486 
487  __FB_FORWARD( FBPropertyAnimatable );
488  FB_FORWARD( FBBox );
489  FB_FORWARD( FBAnimationNode );
490  FB_FORWARD( FBTake );
491 
493  // PropertyEvent
495  __FB_FORWARD(FBPropertyEvent);
496 
508  {
509  protected:
510 #ifndef DOXYGEN_SHOULD_SKIP_THIS
511 
512  HIRegister mParentRegister;
514  int mType;
516  int mSubType;
517 #endif
518  public:
520  FBPropertyEvent();
521 
530  FBPropertyEvent *Init( FBComponent* pComponent, HIRegister pParent,const char *pName, int pType, int pSubType=K_INT_MAX );
531 
537  FBPropertyEvent *InitGlobal( const char* pName, const char* pGlobalEventName );
538 
540  virtual ~FBPropertyEvent();
541 
543 
547  virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
548  virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
550 
552  virtual void InvalidateParent();
553 
557  virtual FBPropertyType GetPropertyType() override { return kFBPT_event; }
558 
559  private:
560 
561  DataFBPropertyEvent* mLocalPtr;
562  };
563 
566  {
567  public:
568  virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
569  virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
570  };
571 
574  {
575  public:
576  virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
577  virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
578  };
579 
582  {
583  public:
584  virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
585  virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
586  };
587 
590  {
591  public:
592  virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
593  virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
594  };
595 
598  {
599  public:
600  virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
601  virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
602  };
603 
606  {
607  public:
608  virtual void Add ( HICallback pOwner, kICallbackHandler pHandler );
609  virtual void Remove ( HICallback pOwner, kICallbackHandler pHandler );
610  };
611 
615  template <class tType, FBPropertyType pPT> class FBPropertyBase : public FBProperty
616  {
617  protected:
618 #ifndef DOXYGEN_SHOULD_SKIP_THIS
619  void (* Set)(void *, tType);
620  tType (* Get)(void *);
621 #endif
622  public:
623 
625  typedef tType ValueType;
626 
628  inline FBPropertyBase() { Set = NULL; Get = NULL; }
629 
633  inline FBPropertyBase(const FBPropertyBase<tType,pPT> &pValue) { operator=((tType)pValue ); }
634 
637  {
638  }
639 
647  inline FBPropertyBase *Init( void* pParent, const char *pName,tType (* pGet)(void *)=NULL,void (* pSet)(void *,tType)=NULL )
648  {
649  mParent = pParent;
650  mName = pName ;
651  Get = pGet;
652  Set = pSet;
653  return this;
654  }
655 
657 
661  inline void operator=(tType pValue) { SetData( &pValue ); }
663 
665 
669  inline void operator=(const FBPropertyBase<tType,pPT> &pProperty) { operator=((tType)pProperty ); }
671 
676  inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
677 
681  virtual FBPropertyType GetPropertyType( ) override { return pPT; }
682 
686  inline virtual void SetPropertyValue( tType pValue )
687  {
688  if(IsInternal() && GetValuePtr())
689  {
690  *(tType*)GetValuePtr() = pValue;
691  }
692  }
693 
697  inline tType GetPropertyValue( )
698  {
699  if(IsInternal() && GetValuePtr())
700  {
701  return *(tType*)GetValuePtr();
702  } else
703  {
704  return (tType)0;
705  }
706  }
707 
712  inline virtual bool IsReadOnly() { return IsInternal() ? (FBProperty::IsReadOnly()) : (Set == NULL); }
713 
717  inline virtual void GetData(void* pData, int pSize, FBEvaluateInfo *pEvalInfo = NULL) const
718  {
719  if(Get)
720  {
721  *((tType*)pData) = (*Get)(mParent);
722  }
723  else if (IsInternal())
724  {
725  FBProperty::GetData( pData, pSize, pEvalInfo );
726  }
727  else
728  {
729  assert(Get != NULL || IsInternal());
730  *((tType*)pData) = (tType)0;
731  }
732  }
736  inline virtual void SetData(void* pData)
737  {
738  if(Set)
739  {
740  (*Set)( mParent,*(tType*)pData );
741  }
742  else if (IsInternal())
743  {
744  FBProperty::SetData( pData );
745  }
746  else
747  {
748  assert( Set != NULL || IsInternal() );
749  }
750  }
751  };
752 
757  template <class tType> class FBPropertyBaseEnum : public FBPropertyBase<tType,kFBPT_enum>
758  {
759  public:
760 #ifndef DOXYGEN_SHOULD_SKIP_THIS
761 
762  static const char *mStrings[];
763 #endif
764  inline FBPropertyBaseEnum(){}
766 
769  {
770 
771  }
772 
776  inline FBPropertyBaseEnum(const FBPropertyBaseEnum<tType> &pValue) { operator=((tType)pValue ); }
777 
779 
783  inline void operator=(tType pValue) { SetData( &pValue ); }
785 
790  inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
791 
792  virtual const char* EnumList( int pIndex ) override
793  {
794  if( FBPropertyBaseEnum::IsInternal() )
795  {
796  return FBProperty::EnumList( pIndex );
797  }
798  // NOTE:
799  // --> replacing test for if(mStrings) by if(mStrings[0])
800  // This is safe to do as we should always have at least 1 item
801  // in the list based on our base class implementation. And
802  // the compiler should throw a linker error if mStrings is not found.
803  // mStrings[0] == NULL for enum kDefaultEnum but mStrings can never be NULL
804  else if(mStrings[0])
805  {
806  return mStrings[pIndex];
807  }
808  else
809  {
810  assert(mStrings[0] || FBPropertyBaseEnum::IsInternal());
811  return NULL;
812  }
813  }
814 
819  virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override { return EnumList( FBPropertyBaseEnum::AsInt() );}
820 
825  virtual bool SetString( const char *pString ) override
826  {
827  int Count=0;
828  const char * tmpstr;
829  while ((tmpstr=EnumList( Count ))!=NULL) {
830  if (strcmp(tmpstr,pString)==0) {
831  FBPropertyBaseEnum::SetData( &Count );
832  return true;
833  }
834  Count++;
835  }
836  return false;
837  }
838 
839  };
840 
841 
846  {
847  public:
855  FBPropertyBasicList( HIObject pParent, const char *pName );
860  FBProperty* Init( void* pParent, const char *pName );
861 
863  void RemoveAll();
864 
869  virtual int GetCount()=0;
870 
875  virtual void RemoveAt( int pIndex )=0;
876 
880  virtual bool IsList();
881  };
882 
886  template <class tType> class FBPropertyBaseList : public FBPropertyBasicList
887  {
888  public:
891 
894  {
895 
896  }
901  FBPropertyBaseList( HIObject pParent, const char *pName ):FBPropertyBasicList( pParent, pName ) {}
902 
903  public:
904  //***
905  //--- These functions require overloads in derived classes.
906  //***
907 
913  virtual int Add( tType pItem )=0;
914 
920  virtual tType operator[]( int pIndex )=0;
921 
922  public:
923  //***
924  //--- These functions can be optionally overloaded in derived classes.
925  //***
926 
931  inline virtual int Find( tType pItem )
932  {
933  int Index;
934  for(Index=0; Index<GetCount(); Index++ )
935  {
936  if( operator[](Index)==pItem )
937  {
938  return Index;
939  }
940  }
941  return -1;
942  }
943 
948  inline virtual int Remove( tType pItem )
949  {
950  int Index = Find( pItem );
951  if (Index!=-1)
952  {
953  RemoveAt( Index );
954  }
955  return Index;
956  }
957 
962  inline virtual tType GetAt(int pIndex)
963  {
964  return operator[](pIndex);
965  }
966  };
967 
969  enum kDefaultEnum {
971  };
972 
973 
980 
983  {
984  public:
987 
989  virtual ~FBPropertyStringList();
990 
996  FBPropertyStringList* Init( FBComponent* pComponent, const char *pName );
997 
998  public:
1003  kReference GetReferenceAt( int pIndex );
1008  void SetReferenceAt( int pIndex,kReference pRef );
1009 
1014  int Find( kReference pRef );
1015 
1020  int Find( const char *S );
1021 
1026  virtual const char *GetAt( int pIndex );
1027 
1033  const char *operator[](int pIndex);
1034 
1036  void Sort( );
1037 
1041  int GetCount();
1042 
1047  int Remove( const char *S );
1048 
1049  public: // Needs to be overriden for special behaviors
1055  virtual int Add( const char *S,kReference pRef = 0 );
1056 
1058  virtual void Clear();
1059 
1063  virtual void RemoveAt( int pIndex );
1064 
1069  virtual int IndexOf(const char *S);
1070 
1076  virtual void InsertAt( int pIndex, const char *S,kReference pRef = 0 );
1077 
1083  virtual bool SetAt( int pIndex,const char *pString );
1084 
1088  virtual bool IsList() override;
1089 
1094  virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override;
1095 
1100  virtual bool SetString( const char *pString ) override;
1101 
1105  virtual FBPropertyType GetPropertyType() override { return kFBPT_stringlist; }
1106  };
1107 
1109  // FBPropertyManager
1111  __FB_FORWARD( FBPropertyManager );
1112 
1119  {
1120  public:
1123 
1125  ~FBPropertyManager();
1126 
1131  int Add( FBProperty* Property );
1132 
1138  FBProperty* operator[](int pIndex);
1139 
1143  int GetCount();
1144 
1151  FBProperty* Find( const char *pPropertyName, bool pMultilangLookup=true );
1152 
1159  void FindPropertiesByName( const char* pPropertyNamePattern, FBArrayTemplate<FBProperty*>& pPropList, bool pMultilangLookup=true );
1160 
1165  int Remove( FBProperty* pProperty );
1166 
1171  void AddToCache( FBProperty* pProperty );
1172 
1177  void RemoveFromCache( KProperty* pProperty );
1178 
1184  FBProperty* FindInCache( KProperty* pProperty );
1185 
1186  private:
1190  void ClearCache();
1191 
1196  void SetParent( HIObject pParent );
1197 
1198 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1199  KObject* mObject;
1200  FBArrayTemplate< FBProperty* > mPropertyCache;
1201  FBArrayTemplate< FBProperty* > mPropertyLocal;
1202 #endif
1203  friend class FBComponent;
1204  friend class FBVisualComponent;
1205  };
1206 
1210  template <class tType> class FBPropertyBaseComponent : public FBPropertyBase< tType, kFBPT_object >
1211  {
1212  public:
1214  int *TypeInfo;
1215  public:
1218 
1223 
1226  {
1227  }
1228 
1230 
1233  inline void operator=(tType pValue) { FBPropertyBase< tType,kFBPT_object >::operator=(pValue); }
1235 
1239  inline tType operator -> () { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
1240 
1244  inline operator tType() const { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
1245  };
1246 
1251 #if defined(KARCH_DEV_INTEL)
1252 #define FBImplementPropertyComponent( DllTag, Type )
1253 #else
1254 #define FBImplementPropertyComponent( DllTag, Type ) \
1255  template class DllTag FBSDKNamespaceFunc(FBPropertyBase)< FB##Type*,kFBPT_object >; \
1256  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseComponent)< FB##Type* >;
1257 #endif
1258 
1263 #if defined(KARCH_DEV_INTEL)
1264 #define FBImplementPropertyEnum( DllTag, Type ) // On SGI by having mString defined for each enum already instantiates the template.
1265 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName )
1266 #else
1267 #define FBImplementPropertyEnum( DllTag, Type ) \
1268  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum FB##Type >
1269 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName ) \
1270  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum Class::E##EnumName >
1271 #endif
1272 
1277 #if defined(KARCH_DEV_INTEL)
1278 #define FBImplementPropertyList( DllTag, Type )
1279 #else
1280 #define FBImplementPropertyList( DllTag, Type ) \
1281  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseList) < FB##Type* >
1282 #endif
1283 
1284 
1286  class FBSDK_DLL FBPropertyString : public FBPropertyBase< const char *, kFBPT_charptr >
1287  {
1288  public:
1289 
1291 
1295  inline void operator=(const char* pValue) { SetData( &pValue ); }
1297 
1302  inline operator const char* () const { char* Value; GetData( &Value,sizeof(Value) ); return Value; }
1303 
1304  inline bool operator==(const char* pValue) const { char* Value; GetData( &Value,sizeof(Value) ); return (Value == pValue) || (strcmp(Value, pValue) == 0); }
1305  inline bool operator!=(const char* pValue) const { return ! operator==(pValue); }
1306 
1310  virtual void SetPropertyValue( const char* pValue ) override;
1311  };
1312 
1315 
1319  class FBSDK_DLL FBPropertyAction : public FBPropertyBase< bool, kFBPT_Action >
1320  {
1321  public:
1323  inline FBPropertyAction() {}
1324 
1327  {
1328  }
1329 
1333  bool operator ()();
1334  };
1335 
1338 
1341 
1344 
1347 
1350 
1353 
1356 
1359 
1362 
1373 
1381 #define FBPropertyInit( Param,Type,PropName,Get,Set ) \
1382  { \
1383  PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
1384  }
1385 
1390 #define FBPropertyInitList( Param,PropName ) \
1391  { \
1392  PropertyAdd(PropName.Init( Param,#PropName )); \
1393  }
1394 
1399 #define FBPropertyInitStringList( Param,PropName ) \
1400  { \
1401  PropertyAdd(PropName.Init( Param, #PropName )); \
1402  }
1403 
1410 #define FBPropertyInitEvent( Param,Type,SubType,PropName ) \
1411  { \
1412  PropertyAdd(PropName.Init( this, IQ(Param,IRegister),#PropName,Type,SubType )); \
1413  }
1414 
1419 #define FBPropertyInitEventGlobal( GlobalEventName,PropName ) \
1420  { \
1421  PropertyAdd(PropName.InitGlobal( #PropName,GlobalEventName )); \
1422  }
1423 
1425 #define FBPropertyInitInternal( Parent, PropName, MBProperty ) \
1426  {\
1427  PropertyAdd(PropName.InitInternal( MBProperty ));\
1428  }
1429 
1431 #define FBPropertyInitInternalEnum( Param,Type,PropName,MBProperty,Get,Set ) \
1432  {\
1433  PropName.InitInternal( MBProperty ); \
1434  PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
1435  }
1436 
1444 #define FBPropertyPublish( Parent,Prop,PropName,Get,Set ) \
1445  { \
1446  PropertyAdd(Prop.CreateInternal( Parent,PropName,(fbExternalGetSetHandler)Get,(fbExternalGetSetHandler)Set )); \
1447  }
1448 
1455 #define FBPropertyInitTextureConnectable( Parent,Prop,PropName ) \
1456  { \
1457  PropertyAdd(Prop.CreateTextureConnectable( Parent,PropName )); \
1458  }
1459 
1488  {
1489  public:
1493 
1496  virtual ~FBPropertyAnimatable();
1497 
1498  public:
1499 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1500  FBPropertyAnimatable* InitInternal( KEvaluationProperty* pProperty );
1502 #endif
1503 
1510  FBPropertyAnimatable* Init( FBBox* pOwner, const char* pName, const char* pType, double* pInit );
1511 
1515  void Destroy();
1516 
1520  virtual KDataType* GetDataType() override;
1521 
1525  const char* GetDataTypeName();
1526 
1530  bool IsFocused();
1531 
1535  void SetFocus( bool pState );
1536 
1539  void Key();
1540 
1544  void KeyAt( FBTime pTime );
1545 
1549  void KeyRemoveAt( FBTime pTime );
1550 
1554  int GetDataSize() const;
1555 
1557 
1560  virtual bool IsAnimatable() override { return true; }
1561 
1566  bool IsAnimated();
1567 
1572  void SetAnimated( bool pState, bool pCheckLocked = false );
1573 
1578  FBAnimationNode* GetAnimationNode(FBTake* pTake=NULL);
1579 
1583  FBBox* GetBox();
1584 
1588  virtual void SetData( void* pData ) override;
1589 
1593  virtual void GetData( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL ) const override;
1594 
1600  void SetCandidate( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL );
1601 
1607  void SetGlobalCandidate( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL );
1608 
1609 
1618 
1622  bool AllowsMuting() const;
1623 
1627  bool HasSomethingMuted() const;
1628 
1632  bool IsMuted() const;
1633 
1638  bool IsMemberMuted( int pIndex ) const;
1639 
1643  void SetMuted( bool pMuted );
1644 
1649  void SetMemberMuted( int pIndex , bool pMuted );
1650 
1652 
1653  };
1654 
1658  template <class tType, FBPropertyType pPT> class FBPropertyBaseAnimatable : public FBPropertyAnimatable
1659  {
1660  public:
1661 
1663  typedef tType ValueType;
1664 
1668 
1671 
1673 
1676  void operator=(tType pValue);
1678 
1682  operator tType() const;
1683 
1687  virtual FBPropertyType GetPropertyType( ) override { return pPT; }
1688  };
1689 
1690 
1752  template <class tType> class FBPropertyBaseAnimatableEnum : public FBPropertyBaseAnimatable<int,kFBPT_enum>
1753  {
1754  public:
1755 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1756 
1757  static const char *mStrings[];
1758 #endif
1759 
1762 
1765  {
1766  }
1767 
1771  inline FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum<tType> &pValue) { operator=((tType)pValue ); }
1772 
1774 
1778  inline void operator=(tType pValue) { SetData( &pValue ); }
1780 
1785  inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
1786 
1787  virtual const char* EnumList( int pIndex ) override
1788  {
1789  if( IsInternal() )
1790  {
1791  return FBProperty::EnumList( pIndex );
1792  }
1793  // NOTE:
1794  // --> replacing test for if(mStrings) by if(mStrings[0])
1795  // This is safe to do as we should always have at least 1 item
1796  // in the list based on our base class implementation. And
1797  // the compiler should throw a linker error if mStrings is not found.
1798  // mStrings[0] == NULL for enum kDefaultEnum but mStrings can never be NULL
1799  else if(mStrings[0])
1800  {
1801  return mStrings[pIndex];
1802  }
1803  else
1804  {
1805  assert(mStrings[0] || IsInternal());
1806  return NULL;
1807  }
1808  }
1809 
1814  virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override { return EnumList( AsInt() );}
1815 
1820  virtual bool SetString( const char *pString ) override
1821  {
1822  int Count=0;
1823  const char * tmpstr;
1824  while ((tmpstr=EnumList( Count ))!=NULL) {
1825  if (strcmp(tmpstr,pString)==0) {
1826  SetData( &Count );
1827  return true;
1828  }
1829  Count++;
1830  }
1831  return false;
1832  }
1833 
1834 
1835  };
1836 
1838  // Global
1840 #ifdef FBSDKUseNamespace
1841 }
1842 #endif
1843 
1844 #endif
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbproperties.h:51
class FBPropertyBase< FBPlug *, kFBPT_object > _FBPropertyBasePlug
Property: FBPropertyBase(FBPlug*)
#define Set(a0, a1, a2, a3)
Definition: Python-ast.h:467
A template class for arrays.
This property is loaded from file.
Definition: fbproperties.h:132
class FBPropertyBase< FBVector2d, kFBPT_Vector2D > FBPropertyVector2d
FBPropertyVector2d type definition.
TimeCode data structure.
Definition: fbtime.h:280
int
Definition: code.h:72
K_FORWARD(KStringList)
class FBPropertyBase< FBTimeSpan, kFBPT_TimeSpan > FBPropertyTimeSpan
Property: FBTimeSpan
FBDataAsStringFlag
FBDataAsStringFlag.
Definition: fbproperties.h:109
class FBPropertyBaseAnimatable< int, kFBPT_int > FBPropertyAnimatableInt
FBPropertyAnimatableInt type definition.
Property: StringList
Definition: fbproperties.h:982
virtual FBPropertyType GetPropertyType()
Get the property's type.
class FBPropertyBaseAnimatable< FBVector2d, kFBPT_Vector2D > FBPropertyAnimatableVector2d
FBPropertyAnimatableVector2D type definition.
class FBVector4< double > FBVector4d
4D vector
Definition: fbtypes.h:441
class FBPropertyBase< double, kFBPT_double > FBPropertyDouble
Property: double
void * GetParent()
Get the parent of the object.
Definition: fbproperties.h:420
void operator=(tType pValue)
Overloaded = operator.
class FBVector2< double > FBVector2d
2D vector.
Definition: fbtypes.h:435
class FBPropertyBaseEnum< enum kDefaultEnum > FBPropertyEnum
A typedef Definition.
Definition: fbproperties.h:974
bool
Definition: asdl.h:9
class FBPropertyBaseAnimatable< double, kFBPT_double > FBPropertyAnimatableDouble
FBPropertyBaseAnimatableDouble type definition.
class FBPropertyBaseAnimatable< bool, kFBPT_Action > FBPropertyAnimatableAction
FBPropertyAnimatableAction type definition.
class FBPropertyBase< FBTime, kFBPT_Time > FBPropertyTime
Property: FBTime
PropertyEvent: Global KeyingNotify event.
Definition: fbproperties.h:605
virtual bool IsReadOnly()
Is this class read-only? If there is an existing set function, this class is read/write, otherwise it is read-only.
Definition: fbproperties.h:712
virtual const char * AsString(FBDataAsStringFlag pFlag=kFBDataAsStringUI)
Get as string.
FBPropertyBaseComponent(const FBPropertyBaseComponent< tType > &pValue)
Constructor.
virtual FBPropertyType GetPropertyType()
Get the property's type.
Definition: fbproperties.h:557
void operator=(tType pValue)
Overloaded = operator.
Basic string class.
Definition: fbstring.h:66
class FBPropertyBaseAnimatable< FBColorAndAlpha, kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha
FBPropertyAnimatableColorAndAlpha type definition.
#define NULL
Definition: kaydara.h:169
Time classes.
class FBPropertyBaseAnimatable< long long, kFBPT_int64 > FBPropertyAnimatableInt64
FBPropertyAnimatableInt64 type definition.
class FBPropertyBase< FBProperty *, kFBPT_Reference > FBPropertyReference
Property: FBProperty *
class FBPropertyBase< FBVector3d, kFBPT_Vector3D > FBPropertyVector3d
FBPropertyVector3d type definition.
#define K_IMPLEMENTATION
Definition: iobject.h:53
This flag is used to show/hide the property in the propertiview.
Definition: fbproperties.h:130
FBPropertyFlag
Available flags for FBProperty objects.
Definition: fbproperties.h:118
AnimationNodeNotify evaluation information.
class FBPropertyBase< FBVector4d, kFBPT_Vector4D > FBPropertyVector4d
FBPropertyVector4d type definition.
Color and alpha vector.
Definition: fbtypes.h:489
virtual void GetData(void *pData, int pSize, FBEvaluateInfo *pEvalInfo=((void *) 0)) const
Get value.
Definition: fbproperties.h:717
virtual int Remove(tType pItem)
Remove pItem from the list.
Definition: fbproperties.h:948
class FBPropertyBase< long long, kFBPT_int64 > FBPropertyInt64
Property: int
class FBPropertyBase< float, kFBPT_float > FBPropertyFloat
Property: float
int * TypeInfo
< type="" information.="" />
#define IObject_Declare(IsPure)
Definition: iobject.h:75
Property class: const char * (String).
Color vector.
Definition: fbtypes.h:447
tType GetPropertyValue()
Get the value of the internal property.
Definition: fbproperties.h:697
T * FBCast(FBProperty *pProperty, bool pAutoCreate=false)
Cast property using it's IObject interface into the proper type.
Definition: fbproperties.h:480
This flag is used to show/hide the property in the propertiview.
Definition: fbproperties.h:121
virtual const char * AsString(FBDataAsStringFlag pFlag=kFBDataAsStringUI)
Get as string.
Definition: fbproperties.h:819
PropertyEvent: Global ConnectionDataNotify event.
Definition: fbproperties.h:589
tType ValueType
Property Value Type.
Definition: fbproperties.h:625
Connections Basic Open Reality SDK Element.
Definition: fbplug.h:220
MotionBuilder SDK base class.
Definition: fbcomponent.h:668
Convert data to string type for storage.
Definition: fbproperties.h:112
virtual FBPropertyType GetPropertyType()
Get the property's type.
Definition: fbproperties.h:681
unsigned int 64 bits.
Definition: fbproperties.h:84
kDefaultEnum
Patch to use the base enum for casting values .
Definition: fbproperties.h:969
PropertyEvent: Global ConnectionStateNotify event.
Definition: fbproperties.h:597
class FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
class FBPropertyBase< kReference, kFBPT_kReference > FBPropertykReference
Property: kReference
class FBPropertyBase< FBColorAndAlpha, kFBPT_ColorRGBA > FBPropertyColorAndAlpha
FBPropertyColorAndAlpha type definition.
This is property is connected and slaved by other same type of master property, and it always ask val...
Definition: fbproperties.h:124
class FBPropertyBaseComponent< FBPlug * > FBPropertyPlug
Property: FBPropertyBaseComponent(FBPlug*)
class FBPropertyBase< FBTimeCode, kFBPT_TimeCode > FBPropertyTimeCode
Property: FBTimeCode
virtual const char * EnumList(int pIndex)
Return the string of an enum value.
Definition: fbproperties.h:792
class FBPropertyBaseAnimatable< FBTimeCode, kFBPT_TimeCode > FBPropertyAnimatableTimeCode
FBPropertyBaseAnimatableTimeCode type definition.
void operator=(const char *pValue)
Overloaded = operator.
class FBPropertyBaseAnimatable< bool, kFBPT_bool > FBPropertyAnimatableBool
FBPropertyAnimatableBool type definition.
class FBPropertyBaseAnimatable< FBVector4d, kFBPT_Vector4D > FBPropertyAnimatableVector4d
FBPropertyAnimatableVector4D type definition.
Definition of the class FBPlug and related enums and utility functions.
FBPropertyType
Property types.
Definition: fbproperties.h:79
Property: Action Action property to trigger function.
Definition: Python-ast.h:18
#define Index(a0, a1)
Definition: Python-ast.h:517
A take is a container for animation in a scene.
Definition: fbdata.h:935
void operator=(tType pValue)
Overloaded = operator.
Definition: fbproperties.h:783
class FBPropertyBaseAnimatable< FBTime, kFBPT_Time > FBPropertyAnimatableTime
FBPropertyBaseAnimatableTime type definition.
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
void operator=(tType pValue)
Overloaded = operator.
Definition: fbproperties.h:661
virtual void SetData(void *pData)
Set value.
Definition: fbproperties.h:736
Property: Base property class.
Definition: fbproperties.h:192
virtual const char * EnumList(int pIndex)
Return the string of an enum value.
Template class to contain an array of items.
Definition: fbarray.h:77
Animatable property base class.
FBPropertyBase()
Constructor.
Definition: fbproperties.h:628
Slave property can be modified, valid only when the master property is modified.
Definition: fbproperties.h:131
class FBVector3< double > FBVector3d
3D vector.
Definition: fbtypes.h:438
PropertyEvent: UI idle event.
Definition: fbproperties.h:565
bool operator==(const char *pValue) const
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
class FBPropertyBase< unsigned long long, kFBPT_uint64 > FBPropertyUInt64
Property: int
FBPropertyBase * Init(void *pParent, const char *pName, tType(*pGet)(void *)=((void *) 0), void(*pSet)(void *, tType)=((void *) 0))
Initialization function.
Definition: fbproperties.h:647
virtual FBPropertyType GetPropertyType()
Get the property's type.
FBPropertyBaseList()
Constructor.
Definition: fbproperties.h:890
Time data structure.
Definition: fbtime.h:86
const char PyObject const char long
Definition: modsupport.h:41
PropertyEvent: Base event class.
Definition: fbproperties.h:507
PropertyEvent: Global ConnectionNotify event.
Definition: fbproperties.h:581
class FBPropertyBase< FBComponent *, kFBPT_object > _FBPropertyBaseComponent
Property: FBPropertyBase(FBComponent*)
class FBPropertyBaseAnimatable< int, kFBPT_enum > FBPropertyAnimatableEnum
FBPropertyBaseAnimatableEnum type definition.
FBPropertyBaseEnum(const FBPropertyBaseEnum< tType > &pValue)
FBPropertyBaseEnum.
Definition: fbproperties.h:776
~FBPropertyBase()
Destructor.
Definition: fbproperties.h:636
virtual tType GetAt(int pIndex)
Get a property at pIndex.
Definition: fbproperties.h:962
FBPropertyBase(const FBPropertyBase< tType, pPT > &pValue)
Constructor.
Definition: fbproperties.h:633
A box is a fundamental building block in the application architecture.
Definition: fbcore.h:218
HIObject FBGetFBObject(HIObject pObject, bool pAutoCreate=false)
Get the SDK object from an Internal Object.
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
String list.
Definition: fbstring.h:201
virtual void SetPropertyValue(tType pValue)
Set the value of the internal property.
Definition: fbproperties.h:686
tType ValueType
Property Value Type.
PropertyEvent: Video Frame Rendering Event
Definition: fbproperties.h:573
class FBPropertyBaseAnimatable< FBColor, kFBPT_ColorRGB > FBPropertyAnimatableColor
FBPropertyAnimatableColor type definition.
bool operator==(const FBPickInfos &pLhs, const FBPickInfos &pRhs)
FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum< tType > &pValue)
FBPropertyBaseAnimatableEnum.
class FBPropertyBaseAnimatable< unsigned long long, kFBPT_uint64 > FBPropertyAnimatableUInt64
FBPropertyAnimatableUInt64 type definition.
class FBPropertyBaseComponent< FBComponent * > FBPropertyComponent
Property: FBPropertyBaseComponent(FBComponent*)
Convert data to string type for UI display.
Definition: fbproperties.h:111
TimeSpan class.
Definition: fbtime.h:381
virtual bool SetString(const char *pString)
Set enum value by equivalent string.
Definition: fbproperties.h:825
virtual bool SetString(const char *pString)
Set string as enum value.
FBPropertyAction()
Constructor.
bool operator!=(const char *pValue) const
virtual bool IsAnimatable()
Certify that the property is animatable.
virtual int Find(tType pItem)
Locate a property in the list.
Definition: fbproperties.h:931
class FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
Visual Component base class.
Definition: fbcontrols.h:306
void * mParent
mParent Parent of the property.
Definition: fbproperties.h:200
class FBPropertyBase< FBColor, kFBPT_ColorRGB > FBPropertyColor
FBPropertyColor type definition.
String class.
#define FBClassDeclare(Name, Parent)
Class declaration.
Definition: fbdefines.h:85
The value has been allocated and must be delete in destructor.
Definition: fbproperties.h:129
void operator=(const FBPropertyBase< tType, pPT > &pProperty)
Overloaded = operator.
Definition: fbproperties.h:669
class FBPropertyBaseAnimatable< FBVector3d, kFBPT_Vector3D > FBPropertyAnimatableVector3d
FBPropertyAnimatableVector3D type definition.
IRegister * HIRegister
Definition: fbcomponent.h:71
void(* fbExternalGetSetHandler)(HIObject pObject)
function pointer
Definition: fbproperties.h:167
FBPropertyBaseList(HIObject pParent, const char *pName)
Constructor.
Definition: fbproperties.h:901
void(ICallback::* kICallbackHandler)(HIRegister pCaller, HKEventBase pEvent)
Definition: icallback.h:50
void(* fbGetSetHandler)(void)
function pointer
Definition: fbproperties.h:165
Should not be saved to or loaded from an FBX file.
Definition: fbproperties.h:126