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 
777  FBPropertyBase<tType,kFBPT_enum>(pValue)
778  { operator=((tType)pValue ); }
779 
781 
785  inline void operator=(tType pValue) { this->SetData( &pValue ); }
787 
792  inline operator tType() const { tType Value; this->GetData( &Value,sizeof(Value) ); return Value; }
793 
794  virtual const char* EnumList( int pIndex ) override
795  {
796  if( FBPropertyBaseEnum::IsInternal() )
797  {
798  return FBProperty::EnumList( pIndex );
799  }
800  // NOTE:
801  // --> replacing test for if(mStrings) by if(mStrings[0])
802  // This is safe to do as we should always have at least 1 item
803  // in the list based on our base class implementation. And
804  // the compiler should throw a linker error if mStrings is not found.
805  // mStrings[0] == NULL for enum kDefaultEnum but mStrings can never be NULL
806  else if(mStrings[0])
807  {
808  return mStrings[pIndex];
809  }
810  else
811  {
812  assert(mStrings[0] || FBPropertyBaseEnum::IsInternal());
813  return NULL;
814  }
815  }
816 
821  virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override { return EnumList( FBPropertyBaseEnum::AsInt() );}
822 
827  virtual bool SetString( const char *pString ) override
828  {
829  int count=0;
830  const char * tmpstr;
831  while ((tmpstr=EnumList( count ))!=NULL) {
832  if (strcmp(tmpstr,pString)==0) {
833  FBPropertyBaseEnum::SetData( &count );
834  return true;
835  }
836  count++;
837  }
838  return false;
839  }
840 
841  };
842 
843 
848  {
849  public:
857  FBPropertyBasicList( HIObject pParent, const char *pName );
862  FBProperty* Init( void* pParent, const char *pName );
863 
865  void RemoveAll();
866 
871  virtual int GetCount()=0;
872 
877  virtual void RemoveAt( int pIndex )=0;
878 
882  virtual bool IsList();
883  };
884 
888  template <class tType> class FBPropertyBaseList : public FBPropertyBasicList
889  {
890  public:
893 
896  {
897 
898  }
903  FBPropertyBaseList( HIObject pParent, const char *pName ):FBPropertyBasicList( pParent, pName ) {}
904 
905  public:
906  //***
907  //--- These functions require overloads in derived classes.
908  //***
909 
915  virtual int Add( tType pItem )=0;
916 
922  virtual tType operator[]( int pIndex )=0;
923 
924  public:
925  //***
926  //--- These functions can be optionally overloaded in derived classes.
927  //***
928 
933  inline virtual int Find( tType pItem )
934  {
935  int Index;
936  for(Index=0; Index<GetCount(); Index++ )
937  {
938  if( operator[](Index)==pItem )
939  {
940  return Index;
941  }
942  }
943  return -1;
944  }
945 
950  inline virtual int Remove( tType pItem )
951  {
952  int Index = Find( pItem );
953  if (Index!=-1)
954  {
955  RemoveAt( Index );
956  }
957  return Index;
958  }
959 
964  inline virtual tType GetAt(int pIndex)
965  {
966  return operator[](pIndex);
967  }
968  };
969 
971  enum kDefaultEnum {
973  };
974 
975 
982 
985  {
986  public:
989 
991  virtual ~FBPropertyStringList();
992 
998  FBPropertyStringList* Init( FBComponent* pComponent, const char *pName );
999 
1000  public:
1005  kReference GetReferenceAt( int pIndex );
1010  void SetReferenceAt( int pIndex,kReference pRef );
1011 
1016  int Find( kReference pRef );
1017 
1022  int Find( const char *S );
1023 
1028  virtual const char *GetAt( int pIndex );
1029 
1035  const char *operator[](int pIndex);
1036 
1038  void Sort( );
1039 
1043  int GetCount();
1044 
1049  int Remove( const char *S );
1050 
1051  public: // Needs to be overriden for special behaviors
1057  virtual int Add( const char *S,kReference pRef = 0 );
1058 
1060  virtual void Clear();
1061 
1065  virtual void RemoveAt( int pIndex );
1066 
1071  virtual int IndexOf(const char *S);
1072 
1078  virtual void InsertAt( int pIndex, const char *S,kReference pRef = 0 );
1079 
1085  virtual bool SetAt( int pIndex,const char *pString );
1086 
1090  virtual bool IsList() override;
1091 
1096  virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override;
1097 
1102  virtual bool SetString( const char *pString ) override;
1103 
1107  virtual FBPropertyType GetPropertyType() override { return kFBPT_stringlist; }
1108  };
1109 
1111  // FBPropertyManager
1113  __FB_FORWARD( FBPropertyManager );
1114 
1121  {
1122  public:
1125 
1127  ~FBPropertyManager();
1128 
1133  int Add( FBProperty* Property );
1134 
1140  FBProperty* operator[](int pIndex);
1141 
1145  int GetCount();
1146 
1153  FBProperty* Find( const char *pPropertyName, bool pMultilangLookup=true );
1154 
1161  void FindPropertiesByName( const char* pPropertyNamePattern, FBArrayTemplate<FBProperty*>& pPropList, bool pMultilangLookup=true );
1162 
1167  int Remove( FBProperty* pProperty );
1168 
1173  void AddToCache( FBProperty* pProperty );
1174 
1179  void RemoveFromCache( KProperty* pProperty );
1180 
1186  FBProperty* FindInCache( KProperty* pProperty );
1187 
1188  private:
1192  void ClearCache();
1193 
1198  void SetParent( HIObject pParent );
1199 
1200 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1201  KObject* mObject;
1202  FBArrayTemplate< FBProperty* > mPropertyCache;
1203  FBArrayTemplate< FBProperty* > mPropertyLocal;
1204 #endif
1205  friend class FBComponent;
1206  friend class FBVisualComponent;
1207  };
1208 
1212  template <class tType> class FBPropertyBaseComponent : public FBPropertyBase< tType, kFBPT_object >
1213  {
1214  public:
1216  int *TypeInfo;
1217  public:
1220 
1225  FBPropertyBase< tType, kFBPT_object >(pValue)
1227 
1230  {
1231  }
1232 
1234 
1239 
1243  inline tType operator -> () { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
1244 
1248  inline operator tType() const { return FBPropertyBase< tType,kFBPT_object >::operator tType(); }
1249  };
1250 
1255 #if defined(KARCH_DEV_INTEL)
1256 #define FBImplementPropertyComponent( DllTag, Type )
1257 #else
1258 #define FBImplementPropertyComponent( DllTag, Type ) \
1259  template class DllTag FBSDKNamespaceFunc(FBPropertyBase)< FB##Type*,kFBPT_object >; \
1260  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseComponent)< FB##Type* >;
1261 #endif
1262 
1267 #if defined(KARCH_DEV_INTEL)
1268 #define FBImplementPropertyEnum( DllTag, Type ) // On SGI by having mString defined for each enum already instantiates the template.
1269 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName )
1270 #else
1271 #define FBImplementPropertyEnum( DllTag, Type ) \
1272  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum FB##Type >
1273 #define FBImplementClassPropertyEnum( DllTag, Class, EnumName ) \
1274  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseEnum)< enum Class::E##EnumName >
1275 #endif
1276 
1281 #if defined(KARCH_DEV_INTEL)
1282 #define FBImplementPropertyList( DllTag, Type )
1283 #else
1284 #define FBImplementPropertyList( DllTag, Type ) \
1285  template class DllTag FBSDKNamespaceFunc(FBPropertyBaseList) < FB##Type* >
1286 #endif
1287 
1288 
1290  class FBSDK_DLL FBPropertyString : public FBPropertyBase< const char *, kFBPT_charptr >
1291  {
1292  public:
1293 
1295 
1299  inline void operator=(const char* pValue) { SetData( &pValue ); }
1301 
1306  inline operator const char* () const { char* Value; GetData( &Value,sizeof(Value) ); return Value; }
1307 
1308  inline bool operator==(const char* pValue) const { char* Value; GetData( &Value,sizeof(Value) ); return (Value == pValue) || (strcmp(Value, pValue) == 0); }
1309  inline bool operator!=(const char* pValue) const { return ! operator==(pValue); }
1310 
1314  virtual void SetPropertyValue( const char* pValue ) override;
1315  };
1316 
1319 
1323  class FBSDK_DLL FBPropertyAction : public FBPropertyBase< bool, kFBPT_Action >
1324  {
1325  public:
1327  inline FBPropertyAction() {}
1328 
1331  {
1332  }
1333 
1337  bool operator ()();
1338  };
1339 
1342 
1345 
1348 
1351 
1354 
1357 
1360 
1363 
1366 
1377 
1385 #define FBPropertyInit( Param,Type,PropName,Get,Set ) \
1386  { \
1387  PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
1388  }
1389 
1394 #define FBPropertyInitList( Param,PropName ) \
1395  { \
1396  PropertyAdd(PropName.Init( Param,#PropName )); \
1397  }
1398 
1403 #define FBPropertyInitStringList( Param,PropName ) \
1404  { \
1405  PropertyAdd(PropName.Init( Param, #PropName )); \
1406  }
1407 
1414 #define FBPropertyInitEvent( Param,Type,SubType,PropName ) \
1415  { \
1416  PropertyAdd(PropName.Init( this, IQ(Param,IRegister),#PropName,Type,SubType )); \
1417  }
1418 
1423 #define FBPropertyInitEventGlobal( GlobalEventName,PropName ) \
1424  { \
1425  PropertyAdd(PropName.InitGlobal( #PropName,GlobalEventName )); \
1426  }
1427 
1429 #define FBPropertyInitInternal( Parent, PropName, MBProperty ) \
1430  {\
1431  PropertyAdd(PropName.InitInternal( MBProperty ));\
1432  }
1433 
1435 #define FBPropertyInitInternalEnum( Param,Type,PropName,MBProperty,Get,Set ) \
1436  {\
1437  PropName.InitInternal( MBProperty ); \
1438  PropertyAdd(PropName.Init( (void*)Param,#PropName,(Type (*)(void *))Get,(void (*)(void *,Type))Set )); \
1439  }
1440 
1448 #define FBPropertyPublish( Parent,Prop,PropName,Get,Set ) \
1449  { \
1450  PropertyAdd(Prop.CreateInternal( Parent,PropName,(fbExternalGetSetHandler)Get,(fbExternalGetSetHandler)Set )); \
1451  }
1452 
1459 #define FBPropertyInitTextureConnectable( Parent,Prop,PropName ) \
1460  { \
1461  PropertyAdd(Prop.CreateTextureConnectable( Parent,PropName )); \
1462  }
1463 
1492  {
1493  public:
1497 
1500  virtual ~FBPropertyAnimatable();
1501 
1502  public:
1503 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1504  FBPropertyAnimatable* InitInternal( KEvaluationProperty* pProperty );
1506 #endif
1507 
1514  FBPropertyAnimatable* Init( FBBox* pOwner, const char* pName, const char* pType, double* pInit );
1515 
1519  void Destroy();
1520 
1524  virtual KDataType* GetDataType() override;
1525 
1529  const char* GetDataTypeName();
1530 
1534  bool IsFocused();
1535 
1539  void SetFocus( bool pState );
1540 
1543  void Key();
1544 
1548  void KeyAt( FBTime pTime );
1549 
1553  void KeyRemoveAt( FBTime pTime );
1554 
1558  int GetDataSize() const;
1559 
1561 
1564  virtual bool IsAnimatable() override { return true; }
1565 
1570  bool IsAnimated();
1571 
1576  void SetAnimated( bool pState, bool pCheckLocked = false );
1577 
1582  FBAnimationNode* GetAnimationNode(FBTake* pTake=NULL);
1583 
1587  FBBox* GetBox();
1588 
1592  virtual void SetData( void* pData ) override;
1593 
1597  virtual void GetData( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL ) const override;
1598 
1604  void SetCandidate( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL );
1605 
1611  void SetGlobalCandidate( void* pData, int pSize, FBEvaluateInfo* pEvalInfo = NULL );
1612 
1613 
1622 
1626  bool AllowsMuting() const;
1627 
1631  bool HasSomethingMuted() const;
1632 
1636  bool IsMuted() const;
1637 
1642  bool IsMemberMuted( int pIndex ) const;
1643 
1647  void SetMuted( bool pMuted );
1648 
1653  void SetMemberMuted( int pIndex , bool pMuted );
1654 
1660  bool SetColor(const FBColor& pColor, int pIndex);
1661 
1666  FBColor GetColor(int pIndex);
1667 
1672  bool ResetColor(int pIndex);
1673 
1678  bool IsFocusedChild(int pIndex);
1679 
1685  bool SetFocusChild(int pIndex, bool pState);
1686 
1688 
1689  };
1690 
1694  template <class tType, FBPropertyType pPT> class FBSDK_DLL FBPropertyBaseAnimatable : public FBPropertyAnimatable
1695  {
1696  public:
1697 
1699  typedef tType ValueType;
1700 
1704  {
1706  }
1707 
1710 
1712 
1715  void operator=(tType pValue)
1716  {
1717  FBPropertyAnimatable::SetData(&pValue);
1718  }
1720 
1724  operator tType() const
1725  {
1726  tType val;
1727  FBPropertyAnimatable::GetData(&val,sizeof(val));
1728  return val;
1729  }
1730 
1734  virtual FBPropertyType GetPropertyType( ) override { return pPT; }
1735  };
1736 
1737 
1799  template <class tType> class FBPropertyBaseAnimatableEnum : public FBPropertyBaseAnimatable<int,kFBPT_enum>
1800  {
1801  public:
1802 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1803 
1804  static const char *mStrings[];
1805 #endif
1806 
1809 
1812  {
1813  }
1814 
1818  inline FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum<tType> &pValue) { operator=((tType)pValue ); }
1819 
1821 
1825  inline void operator=(tType pValue) { SetData( &pValue ); }
1827 
1832  inline operator tType() const { tType Value; GetData( &Value,sizeof(Value) ); return Value; }
1833 
1834  virtual const char* EnumList( int pIndex ) override
1835  {
1836  if( IsInternal() )
1837  {
1838  return FBProperty::EnumList( pIndex );
1839  }
1840  // NOTE:
1841  // --> replacing test for if(mStrings) by if(mStrings[0])
1842  // This is safe to do as we should always have at least 1 item
1843  // in the list based on our base class implementation. And
1844  // the compiler should throw a linker error if mStrings is not found.
1845  // mStrings[0] == NULL for enum kDefaultEnum but mStrings can never be NULL
1846  else if(mStrings[0])
1847  {
1848  return mStrings[pIndex];
1849  }
1850  else
1851  {
1852  assert(mStrings[0] || IsInternal());
1853  return NULL;
1854  }
1855  }
1856 
1861  virtual const char* AsString( FBDataAsStringFlag pFlag = kFBDataAsStringUI ) override { return EnumList( AsInt() );}
1862 
1867  virtual bool SetString( const char *pString ) override
1868  {
1869  int Count=0;
1870  const char * tmpstr;
1871  while ((tmpstr=EnumList( Count ))!=NULL) {
1872  if (strcmp(tmpstr,pString)==0) {
1873  SetData( &Count );
1874  return true;
1875  }
1876  Count++;
1877  }
1878  return false;
1879  }
1880 
1881 
1882  };
1883 
1885  // Global
1887 #ifdef FBSDKUseNamespace
1888 }
1889 #endif
1890 
1891 #endif
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbproperties.h:51
class FBPropertyBase< kReference, kFBPT_kReference > FBPropertykReference
Property: kReference
class FBPropertyBase< FBColorAndAlpha, kFBPT_ColorRGBA > FBPropertyColorAndAlpha
FBPropertyColorAndAlpha type definition.
PropertyEvent: Base event class.
Definition: fbproperties.h:507
virtual bool IsAnimatable() override
Certify that the property is animatable.
Property: Base property class.
Definition: fbproperties.h:192
#define Set(a0, a1, a2, a3)
Definition: Python-ast.h:467
A template class for arrays.
class FBPropertyBase< FBTimeCode, kFBPT_TimeCode > FBPropertyTimeCode
Property: FBTimeCode
virtual const char * EnumList(int pIndex) override
Return the string of an enum value.
class FBPropertyBaseAnimatable< bool, kFBPT_bool > FBPropertyAnimatableBool
FBPropertyAnimatableBool type definition.
PropertyEvent: Global ConnectionStateNotify event.
Definition: fbproperties.h:597
virtual tType GetAt(int pIndex)
Get a property at pIndex.
Definition: fbproperties.h:964
int
Definition: code.h:72
A box is a fundamental building block in the application architecture.
Definition: fbcore.h:218
K_FORWARD(KStringList)
void * GetParent()
Get the parent of the object.
Definition: fbproperties.h:420
Property class: const char * (String).
Time data structure.
Definition: fbtime.h:86
PropertyEvent: Global ConnectionNotify event.
Definition: fbproperties.h:581
void operator=(tType pValue)
Overloaded = operator.
Basic string class.
Definition: fbstring.h:66
Slave property can be modified, valid only when the master property is modified.
Definition: fbproperties.h:131
bool
Definition: asdl.h:9
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
class FBPropertyBaseAnimatable< unsigned long long, kFBPT_uint64 > FBPropertyAnimatableUInt64
FBPropertyAnimatableUInt64 type definition.
A take is a container for animation in a scene.
Definition: fbdata.h:1692
class FBVector3< double > FBVector3d
3D vector.
Definition: fbtypes.h:438
FBPropertyBaseList()
Constructor.
Definition: fbproperties.h:892
bool operator==(const char *pValue) const
class FBPropertyBase< unsigned long long, kFBPT_uint64 > FBPropertyUInt64
Property: int
#define NULL
Definition: kaydara.h:179
Time classes.
Template class to contain an array of items.
Definition: fbarray.h:77
FBPropertyBaseEnum(const FBPropertyBaseEnum< tType > &pValue)
FBPropertyBaseEnum.
Definition: fbproperties.h:776
#define K_IMPLEMENTATION
Definition: iobject.h:53
virtual const char * AsString(FBDataAsStringFlag pFlag=kFBDataAsStringUI) override
Get as string.
Definition: fbproperties.h:821
class FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
class FBPropertyBase< FBComponent *, kFBPT_object > _FBPropertyBaseComponent
Property: FBPropertyBase(FBComponent*)
Convert data to string type for UI display.
Definition: fbproperties.h:111
class FBPropertyBaseAnimatable< int, kFBPT_enum > FBPropertyAnimatableEnum
FBPropertyBaseAnimatableEnum type definition.
Property: Action Action property to trigger function.
class FBPropertyBase< FBColor, kFBPT_ColorRGB > FBPropertyColor
FBPropertyColor type definition.
virtual FBPropertyType GetPropertyType() override
Get the property's type.
Definition: fbproperties.h:557
virtual void GetData(void *pData, int pSize, FBEvaluateInfo *pEvalInfo=((void *) 0)) const
Get value.
Definition: fbproperties.h:717
Color vector.
Definition: fbtypes.h:447
#define IObject_Declare(IsPure)
Definition: iobject.h:75
tType GetPropertyValue()
Get the value of the internal property.
Definition: fbproperties.h:697
Animatable property base class.
tType ValueType
Property Value Type.
Definition: fbproperties.h:625
class FBPropertyBaseAnimatable< FBColor, kFBPT_ColorRGB > FBPropertyAnimatableColor
FBPropertyAnimatableColor type definition.
void operator=(tType pValue)
Overloaded = operator.
class FBPropertyBaseComponent< FBComponent * > FBPropertyComponent
Property: FBPropertyBaseComponent(FBComponent*)
void(* fbGetSetHandler)(void)
function pointer
Definition: fbproperties.h:165
TimeCode data structure.
Definition: fbtime.h:280
virtual FBPropertyType GetPropertyType() override
Get the property's type.
Definition: fbproperties.h:681
FBPropertyAction()
Constructor.
class FBPropertyBase< FBPlug *, kFBPT_object > _FBPropertyBasePlug
Property: FBPropertyBase(FBPlug*)
bool operator!=(const char *pValue) const
Should not be saved to or loaded from an FBX file.
Definition: fbproperties.h:126
class FBPropertyBase< FBVector2d, kFBPT_Vector2D > FBPropertyVector2d
FBPropertyVector2d type definition.
Definition of the class FBPlug and related enums and utility functions.
This property is loaded from file.
Definition: fbproperties.h:132
The value has been allocated and must be delete in destructor.
Definition: fbproperties.h:129
virtual int Find(tType pItem)
Locate a property in the list.
Definition: fbproperties.h:933
void operator=(tType pValue)
Overloaded = operator.
Definition: Python-ast.h:18
#define Index(a0, a1)
Definition: Python-ast.h:517
class FBPropertyBaseAnimatable< FBVector3d, kFBPT_Vector3D > FBPropertyAnimatableVector3d
FBPropertyAnimatableVector3D type definition.
void(* fbExternalGetSetHandler)(HIObject pObject)
function pointer
Definition: fbproperties.h:167
FBPropertyBaseAnimatableEnum(const FBPropertyBaseAnimatableEnum< tType > &pValue)
FBPropertyBaseAnimatableEnum.
FBPropertyBaseComponent(const FBPropertyBaseComponent< tType > &pValue)
Constructor.
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
class FBVector4< double > FBVector4d
4D vector
Definition: fbtypes.h:441
void operator=(tType pValue)
Overloaded = operator.
Definition: fbproperties.h:661
Property: StringList
Definition: fbproperties.h:984
virtual void SetData(void *pData)
Set value.
Definition: fbproperties.h:736
class FBPropertyBaseEnum< enum kDefaultEnum > FBPropertyEnum
A typedef Definition.
Definition: fbproperties.h:976
FBPropertyBase()
Constructor.
Definition: fbproperties.h:628
virtual bool SetString(const char *pString) override
Set string as enum value.
class FBPropertyBaseAnimatable< bool, kFBPT_Action > FBPropertyAnimatableAction
FBPropertyAnimatableAction type definition.
virtual bool SetString(const char *pString) override
Set enum value by equivalent string.
Definition: fbproperties.h:827
TimeSpan class.
Definition: fbtime.h:381
FBPropertyBaseList(HIObject pParent, const char *pName)
Constructor.
Definition: fbproperties.h:903
PropertyEvent: UI idle event.
Definition: fbproperties.h:565
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
virtual const char * AsString(FBDataAsStringFlag pFlag=kFBDataAsStringUI) override
Get as string.
FBPropertyBase * Init(void *pParent, const char *pName, tType(*pGet)(void *)=((void *) 0), void(*pSet)(void *, tType)=((void *) 0))
Initialization function.
Definition: fbproperties.h:647
const char PyObject const char long
Definition: modsupport.h:41
class FBPropertyBase< FBVector3d, kFBPT_Vector3D > FBPropertyVector3d
FBPropertyVector3d type definition.
class FBPropertyBase< FBTimeSpan, kFBPT_TimeSpan > FBPropertyTimeSpan
Property: FBTimeSpan
class FBPropertyBase< FBVector4d, kFBPT_Vector4D > FBPropertyVector4d
FBPropertyVector4d type definition.
T * FBCast(FBProperty *pProperty, bool pAutoCreate=false)
Cast property using it's IObject interface into the proper type.
Definition: fbproperties.h:480
int * TypeInfo
< type="" information.="">
FBDataAsStringFlag
FBDataAsStringFlag.
Definition: fbproperties.h:109
class FBPropertyBaseAnimatable< int, kFBPT_int > FBPropertyAnimatableInt
FBPropertyAnimatableInt type definition.
~FBPropertyBase()
Destructor.
Definition: fbproperties.h:636
FBPropertyBase(const FBPropertyBase< tType, pPT > &pValue)
Constructor.
Definition: fbproperties.h:633
This flag is used to show/hide the property in the propertiview.
Definition: fbproperties.h:130
class FBPropertyBase< float, kFBPT_float > FBPropertyFloat
Property: float
MotionBuilder SDK base class.
Definition: fbcomponent.h:664
bool operator==(const FBPickInfos &pLhs, const FBPickInfos &pRhs)
class FBPropertyBaseAnimatable< FBVector2d, kFBPT_Vector2D > FBPropertyAnimatableVector2d
FBPropertyAnimatableVector2D type definition.
class FBPropertyBase< double, kFBPT_double > FBPropertyDouble
Property: double
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
class FBVector2< double > FBVector2d
2D vector.
Definition: fbtypes.h:435
FBPropertyBaseAnimatable(const FBPropertyBaseAnimatable< tType, pPT > &pValue)
String list.
Definition: fbstring.h:201
virtual void SetPropertyValue(tType pValue)
Set the value of the internal property.
Definition: fbproperties.h:686
Color and alpha vector.
Definition: fbtypes.h:489
class FBPropertyBaseAnimatable< double, kFBPT_double > FBPropertyAnimatableDouble
FBPropertyBaseAnimatableDouble type definition.
class FBPropertyBase< FBTime, kFBPT_Time > FBPropertyTime
Property: FBTime
PropertyEvent: Video Frame Rendering Event
Definition: fbproperties.h:573
class FBPropertyBaseAnimatable< FBColorAndAlpha, kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha
FBPropertyAnimatableColorAndAlpha type definition.
class FBPropertyBaseAnimatable< long long, kFBPT_int64 > FBPropertyAnimatableInt64
FBPropertyAnimatableInt64 type definition.
kDefaultEnum
Patch to use the base enum for casting values .
Definition: fbproperties.h:971
virtual const char * EnumList(int pIndex) override
Return the string of an enum value.
Definition: fbproperties.h:794
Connections Basic Open Reality SDK Element.
Definition: fbplug.h:220
Convert data to string type for storage.
Definition: fbproperties.h:112
class FBPropertyBase< FBProperty *, kFBPT_Reference > FBPropertyReference
Property: FBProperty *
class FBPropertyBaseComponent< FBPlug * > FBPropertyPlug
Property: FBPropertyBaseComponent(FBPlug*)
FBPropertyFlag
Available flags for FBProperty objects.
Definition: fbproperties.h:118
unsigned int 64 bits.
Definition: fbproperties.h:84
AnimationNodeNotify evaluation information.
class FBPropertyBaseAnimatable< FBTimeCode, kFBPT_TimeCode > FBPropertyAnimatableTimeCode
FBPropertyBaseAnimatableTimeCode type definition.
void operator=(const char *pValue)
Overloaded = operator.
const char void * pValue
Definition: fbcontrols.h:2116
This flag is used to show/hide the property in the propertiview.
Definition: fbproperties.h:121
class FBPropertyBaseAnimatable< FBVector4d, kFBPT_Vector4D > FBPropertyAnimatableVector4d
FBPropertyAnimatableVector4D type definition.
void * mParent
mParent Parent of the property.
Definition: fbproperties.h:200
class FBPropertyBase< long long, kFBPT_int64 > FBPropertyInt64
Property: int
String class.
FBPropertyType
Property types.
Definition: fbproperties.h:79
#define FBClassDeclare(Name, Parent)
Class declaration.
Definition: fbdefines.h:85
tType ValueType
Property Value Type.
HIObject FBGetFBObject(HIObject pObject, bool pAutoCreate=false)
Get the SDK object from an Internal Object.
PropertyEvent: Global ConnectionDataNotify event.
Definition: fbproperties.h:589
virtual int Remove(tType pItem)
Remove pItem from the list.
Definition: fbproperties.h:950
virtual FBPropertyType GetPropertyType() override
Get the property's type.
void operator=(const FBPropertyBase< tType, pPT > &pProperty)
Overloaded = operator.
Definition: fbproperties.h:669
IRegister * HIRegister
Definition: fbcomponent.h:71
class FBPropertyBaseAnimatable< FBTime, kFBPT_Time > FBPropertyAnimatableTime
FBPropertyBaseAnimatableTime type definition.
PropertyEvent: Global KeyingNotify event.
Definition: fbproperties.h:605
This is property is connected and slaved by other same type of master property, and it always ask val...
Definition: fbproperties.h:124
virtual FBPropertyType GetPropertyType() override
Get the property's type.
void(ICallback::* kICallbackHandler)(HIRegister pCaller, HKEventBase pEvent)
Definition: icallback.h:50
Py_ssize_t count
Definition: abstract.h:1077
class FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
void operator=(tType pValue)
Overloaded = operator.
Definition: fbproperties.h:785