fbxsdk/core/fbxobject.h Source File

fbxobject.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_CORE_OBJECT_H_
14 #define _FBXSDK_CORE_OBJECT_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
18 #include <fbxsdk/core/fbxclassid.h>
19 #include <fbxsdk/core/fbxquery.h>
20 #include <fbxsdk/core/fbxemitter.h>
22 #include <fbxsdk/core/fbxstream.h>
25 
26 #include <fbxsdk/fbxsdk_nsbegin.h>
27 
28 class FbxManager;
29 class FbxDocument;
30 class FbxImplementation;
32 class FbxLibrary;
33 class FbxMessage;
34 class FbxPeripheral;
35 class FbxUserDataRecord;
36 class FbxConnectEvent;
37 
39 #define FBXSDK_CLASS_DECLARE(Class, Parent)\
40 private:\
41  Class(const Class&);\
42  Class& operator=(const Class&);\
43 protected:\
44  virtual ~Class(){};\
45 public:\
46  static FbxClassId ClassId;\
47  virtual FbxClassId GetClassId() const { return ClassId; }\
48  friend class FBXSDK_NAMESPACE::FbxManager;\
49  typedef Parent ParentClass;\
50  static Class* Create(FbxManager* pManager, const char* pName);\
51 
52 #define FBXSDK_FBXOBJECT_DECLARE(Class, Parent)\
54  FBXSDK_CLASS_DECLARE(Class, Parent)\
55  FBXSDK_FRIEND_NEW()\
56  static Class* Create(FbxObject* pContainer, const char* pName);\
57 protected:\
58  static Class* Allocate(FbxManager* pManager, const char* pName, const Class* pFrom);\
59 
60 #define FBXSDK_OBJECT_DECLARE(Class, Parent)\
62  FBXSDK_FBXOBJECT_DECLARE(Class, Parent)\
63 protected:\
64  Class(FbxManager& pManager, const char* pName) : Parent(pManager, pName){};\
65 private: /* end of object declaration, put back private */\
66 
67 #define FBXSDK_ABSTRACT_OBJECT_DECLARE(Class, Parent)\
69  FBXSDK_CLASS_DECLARE(Class, Parent)\
70 protected:\
71  static FbxObjectCreateProc Allocate;\
72  Class(FbxManager& pManager, const char* pName) : Parent(pManager, pName){};\
73 private: /* end of object declaration, put back private */\
74 
75 #define FBXSDK_OBJECT_IMPLEMENT(Class)\
77  FbxClassId Class::ClassId;\
78  Class* Class::Create(FbxManager* pManager, const char* pName)\
79  {\
80  return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName);\
81  }\
82  Class* Class::Create(FbxObject* pContainer, const char* pName)\
83  {\
84  FBX_ASSERT_RETURN_VALUE(pContainer && pContainer->GetFbxManager(), NULL);\
85  return (Class*)pContainer->GetFbxManager()->CreateNewObjectFromClassId(Class::ClassId, pName, pContainer);\
86  }\
87  Class* Class::Allocate(FbxManager* pManager, const char* pName, const Class* pFrom)\
88  {\
89  Class* lNewObject = FbxNew<Class>(*pManager, pName);\
90  lNewObject->Construct(pFrom);\
91  lNewObject->SetObjectFlags(FbxObject::eInitialized, true);\
92  return lNewObject;\
93  }\
94 
95 #define FBXSDK_ABSTRACT_OBJECT_IMPLEMENT(Class)\
97  FbxClassId Class::ClassId;\
98  FbxObjectCreateProc Class::Allocate = 0;\
99  Class* Class::Create(FbxManager* pManager, const char* pName)\
100  {\
101  return (Class*)pManager->CreateNewObjectFromClassId(Class::ClassId, pName);\
102  }\
103 
104 
158 {
160 
161 public:
163 
164 
167  template <class T> inline bool Is() const { return GetClassId().Is(T::ClassId); }
168 
171  FbxManager* GetFbxManager() const;
172 
175  FbxDocument* GetDocument() const;
176 
180  FbxDocument* GetRootDocument() const;
181 
184  FbxScene* GetScene() const;
185 
188  void Destroy(bool pRecursive=false);
189 
191  void ResetProperties();
193 
195 
196  enum EObjectFlag
198  {
199  eNone = 0,
200  eInitialized = 1 << 0,
201  eSystem = 1 << 1,
202  eSavable = 1 << 2,
203  eSelected = 1 << 3,
204  eHidden = 1 << 4,
205  eContentLoaded = 1 << 5,
206  eDontLocalize = 1 << 6,
207  eCopyCalledByClone = 1 << 16
208  };
209 
213  void SetObjectFlags(EObjectFlag pFlags, bool pValue);
214 
218  bool GetObjectFlags(EObjectFlag pFlags) const;
219 
223  void SetAllObjectFlags(FbxUInt pFlags);
224 
227  FbxUInt GetAllObjectFlags() const;
229 
231 
232 
236  virtual FbxObject& Copy(const FbxObject& pObject);
237 
240  {
242  eReferenceClone
243  };
244 
261  virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const;
262 
265  bool IsAReferenceTo() const;
266 
269  FbxObject* GetReferenceTo() const;
270 
273  bool IsReferencedBy() const;
274 
277  int GetReferencedByCount() const;
278 
282  FbxObject* GetReferencedBy(int pIndex) const;
284 
292  void SetName(const char* pName);
293 
297  const char* GetName() const;
298 
302  FbxString GetNameWithoutNameSpacePrefix() const;
303 
307  FbxString GetNameWithNameSpacePrefix() const;
308 
312  void SetInitialName(const char* pName);
313 
317  const char* GetInitialName() const;
318 
322  FbxString GetNameSpaceOnly();
323 
327  void SetNameSpace(FbxString pNameSpace);
328 
333  FbxArray<FbxString*> GetNameSpaceArray(char identifier);
334 
338  FbxString GetNameOnly() const;
339 
343  FbxString GetNameSpacePrefix() const;
344 
349  static FbxString RemovePrefix(char* pName);
350 
355  static FbxString StripPrefix(FbxString& lName);
356 
361  static FbxString StripPrefix(const char* pName);
362 
364  const FbxUInt64& GetUniqueID() const;
366 
374  virtual bool GetSelected();
375 
379  virtual void SetSelected(bool pSelected);
381 
392  void SetUserDataPtr(const FbxUInt64& pUserID, void* pUserData);
393 
398  void* GetUserDataPtr(const FbxUInt64& pUserID) const;
399 
405  inline void SetUserDataPtr(void* pUserData){ SetUserDataPtr(GetUniqueID(), pUserData); }
406 
410  inline void* GetUserDataPtr() const { return GetUserDataPtr(GetUniqueID()); }
412 
422  inline bool ConnectSrcObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone) { return RootProperty.ConnectSrcObject(pObject,pType); }
423 
428  inline bool IsConnectedSrcObject(const FbxObject* pObject) const { return RootProperty.IsConnectedSrcObject(pObject); }
429 
434  inline bool DisconnectSrcObject(FbxObject* pObject){ return RootProperty.DisconnectSrcObject(pObject); }
435 
439  inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(); }
440 
445  inline bool DisconnectAllSrcObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllSrcObject(pCriteria); }
446 
450  inline int GetSrcObjectCount() const { return RootProperty.GetSrcObjectCount(); }
451 
456  inline int GetSrcObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetSrcObjectCount(pCriteria); }
457 
462  inline FbxObject* GetSrcObject(int pIndex=0) const { return RootProperty.GetSrcObject(pIndex); }
463 
469  inline FbxObject* GetSrcObject(const FbxCriteria& pCriteria, int pIndex=0) const { return RootProperty.GetSrcObject(pCriteria,pIndex); }
470 
476  inline FbxObject* FindSrcObject(const char* pName, int pStartIndex=0) const { return RootProperty.FindSrcObject(pName,pStartIndex); }
477 
484  inline FbxObject* FindSrcObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return RootProperty.FindSrcObject(pCriteria,pName,pStartIndex); }
485 
488  template <class T> inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId)); }
489 
493  template <class T> inline bool DisconnectAllSrcObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); }
494 
497  template <class T> inline int GetSrcObjectCount() const { return RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId)); }
498 
502  template <class T> inline int GetSrcObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); }
503 
507  template <class T> inline T* GetSrcObject(int pIndex=0) const { return (T*)RootProperty.GetSrcObject(FbxCriteria::ObjectType(T::ClassId), pIndex); }
508 
513  template <class T> inline T* GetSrcObject(const FbxCriteria& pCriteria, int pIndex=0) const { return (T*)RootProperty.GetSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); }
514 
519  template <class T> inline T* FindSrcObject(const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindSrcObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); }
520 
526  template <class T> inline T* FindSrcObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pName, pStartIndex); }
527 
533  inline bool ConnectDstObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone) { return RootProperty.ConnectDstObject(pObject,pType); }
534 
539  inline bool IsConnectedDstObject(const FbxObject* pObject) const { return RootProperty.IsConnectedDstObject(pObject); }
540 
545  inline bool DisconnectDstObject(FbxObject* pObject) { return RootProperty.DisconnectDstObject(pObject); }
546 
550  inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(); }
551 
556  inline bool DisconnectAllDstObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllDstObject(pCriteria); }
557 
561  inline int GetDstObjectCount() const { return RootProperty.GetDstObjectCount(); }
562 
567  inline int GetDstObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetDstObjectCount(pCriteria); }
568 
573  inline FbxObject* GetDstObject(int pIndex=0) const { return RootProperty.GetDstObject(pIndex); }
574 
580  inline FbxObject* GetDstObject(const FbxCriteria& pCriteria, int pIndex=0) const { return RootProperty.GetDstObject(pCriteria,pIndex); }
581 
587  inline FbxObject* FindDstObject(const char* pName, int pStartIndex=0) const { return RootProperty.FindDstObject(pName,pStartIndex); }
588 
595  inline FbxObject* FindDstObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return RootProperty.FindDstObject(pCriteria,pName,pStartIndex); }
596 
599  template <class T> inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId)); }
600 
604  template <class T> inline bool DisconnectAllDstObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); }
605 
608  template <class T> inline int GetDstObjectCount() const { return RootProperty.GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId)); }
609 
613  template <class T> inline int GetDstObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); }
614 
618  template <class T> inline T* GetDstObject(int pIndex=0) const { return (T*)RootProperty.GetDstObject(FbxCriteria::ObjectType(T::ClassId), pIndex); }
619 
624  template <class T> inline T* GetDstObject(const FbxCriteria& pCriteria, int pIndex=0) const { return (T*)RootProperty.GetDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); }
625 
630  template <class T> inline T* FindDstObject(const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindDstObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); }
631 
637  template <class T> inline T* FindDstObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pName, pStartIndex); }
639 
648  {
649  return RootProperty.GetFirstDescendent();
650  }
651 
656  inline FbxProperty GetNextProperty(const FbxProperty& pProperty) const
657  {
658  return RootProperty.GetNextDescendent(pProperty);
659  }
660 
666  inline FbxProperty FindProperty(const char* pName, bool pCaseSensitive = true) const
667  {
668  return RootProperty.Find(pName, pCaseSensitive );
669  }
670 
677  inline FbxProperty FindProperty(const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const
678  {
679  return RootProperty.Find(pName, pDataType, pCaseSensitive );
680  }
681 
688  inline FbxProperty FindPropertyHierarchical(const char* pName, bool pCaseSensitive = true) const
689  {
690  return RootProperty.FindHierarchical(pName, pCaseSensitive );
691  }
692 
700  inline FbxProperty FindPropertyHierarchical(const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const
701  {
702  return RootProperty.FindHierarchical(pName, pDataType, pCaseSensitive );
703  }
704 
709  FbxProperty GetClassRootProperty();
710 
715  inline bool ConnectSrcProperty(const FbxProperty& pProperty) { return RootProperty.ConnectSrcProperty(pProperty); }
716 
721  inline bool IsConnectedSrcProperty(const FbxProperty& pProperty) { return RootProperty.IsConnectedSrcProperty(pProperty); }
722 
727  inline bool DisconnectSrcProperty(const FbxProperty& pProperty) { return RootProperty.DisconnectSrcProperty(pProperty); }
728 
732  inline int GetSrcPropertyCount() const { return RootProperty.GetSrcPropertyCount(); }
733 
738  inline FbxProperty GetSrcProperty(int pIndex=0) const { return RootProperty.GetSrcProperty(pIndex); }
739 
745  inline FbxProperty FindSrcProperty(const char* pName,int pStartIndex=0) const { return RootProperty.FindSrcProperty(pName,pStartIndex); }
746 
751  inline bool ConnectDstProperty(const FbxProperty& pProperty) { return RootProperty.ConnectDstProperty(pProperty); }
752 
757  inline bool IsConnectedDstProperty(const FbxProperty& pProperty) { return RootProperty.IsConnectedDstProperty(pProperty); }
758 
763  inline bool DisconnectDstProperty(const FbxProperty& pProperty) { return RootProperty.DisconnectDstProperty(pProperty); }
764 
768  inline int GetDstPropertyCount() const { return RootProperty.GetDstPropertyCount(); }
769 
774  inline FbxProperty GetDstProperty(int pIndex=0) const { return RootProperty.GetDstProperty(pIndex); }
775 
781  inline FbxProperty FindDstProperty(const char* pName, int pStartIndex=0) const { return RootProperty.FindDstProperty(pName,pStartIndex); }
783 
800  int ContentUnload();
801 
808  int ContentLoad();
809 
815  bool ContentIsLoaded() const;
816 
820  void ContentDecrementLockCount();
821 
825  void ContentIncrementLockCount();
826 
833  bool ContentIsLocked() const;
834 
840  virtual bool ContentWriteTo(FbxStream& pStream) const;
841 
847  virtual bool ContentReadFrom(const FbxStream& pStream);
849 
858  void EmitMessage(FbxMessage* pMessage) const;
860 
871  virtual const char* Localize(const char* pID, const char* pDefault=NULL) const;
873 
881  FbxLibrary* GetParentLibrary() const;
882 
888  bool AddImplementation(FbxImplementation* pImplementation);
889 
895  bool RemoveImplementation(FbxImplementation* pImplementation);
896 
900  bool HasDefaultImplementation(void) const;
901 
905  FbxImplementation* GetDefaultImplementation(void) const;
906 
913  bool SetDefaultImplementation(FbxImplementation* pImplementation);
914 
919  int GetImplementationCount(const FbxImplementationFilter* pCriteria=NULL) const;
920 
926  FbxImplementation* GetImplementation(int pIndex, const FbxImplementationFilter* pCriteria=NULL) const;
928 
937  virtual FbxString GetUrl() const;
938 
944  virtual bool SetUrl(char* pUrl);
946 
951  void SetRuntimeClassId(const FbxClassId& pClassId);
952 
955  FbxClassId GetRuntimeClassId() const;
956 
961  bool IsRuntime(const FbxClassId& pClassId) const;
962 
965  bool IsRuntimePlug() const;
967 
970  virtual void Compact();
971 
974 
975 protected:
979  virtual void Construct(const FbxObject* pFrom);
980 
984  virtual void ConstructProperties(bool pForceSet);
985 
989  virtual void Destruct(bool pRecursive);
990 
993  virtual void ContentClear();
994 
998  virtual FbxPeripheral* GetPeripheral();
999 
1000 /*****************************************************************************************************************************
1001 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1002 *****************************************************************************************************************************/
1003 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1004 public:
1005  virtual bool Compare(FbxObject* pOtherObject);
1006 
1007  //Basic comparison operator implementation. It simply compare property values between source and target.
1008  //NOTE: If a property cannot be found on one of the object, the comparison fails (return false).
1009  //Different classid will fail comparison as well as different property count. Reference properties are not compared.
1010  bool operator==(const FbxObject& pObject);
1011  bool operator!=(const FbxObject& pObject);
1012 
1013  virtual void SetDocument(FbxDocument* pDocument);
1014 
1015  inline FbxPropertyHandle& GetPropertyHandle() { return RootProperty.mPropertyHandle; }
1016 
1017  //Important note: If this function is not implemented, the pFileSubTypeName string used when registering your
1018  //class via FbxManager::RegisterFbxClass will be used instead. This makes it useless to re-implement this
1019  //function if you do not intend to return a different string for the same class.
1020  virtual const char* GetTypeName() const;
1021  virtual FbxStringList GetTypeFlags() const;
1022 
1023  // This function will go as deep as possible to clear the Connection list without sending
1024  // notifications to the connections to give them the chance to Disconnect themselves.
1025  // This is a bypass of the intended workflow and should be used with care.
1026  void WipeAllConnections();
1027 
1028  //Used as global flag to modify the behavior of FbxObject::Destruct() during a ForceKill() on the scene. This is for internal use.
1029  static void SetWipeMode(bool pState);
1030  static bool GetWipeMode();
1031 
1032 protected:
1033  FbxObject(FbxManager& pManager, const char* pName);
1034 
1035  enum EPropertyNotifyType
1036  {
1037  ePropertySetRequest,
1038  ePropertySet,
1039  ePropertyGet
1040  };
1041 
1042  virtual bool ConnectNotify(const FbxConnectEvent& pEvent);
1043  virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty);
1044  bool Copyable(const FbxObject& pObject);
1045 
1046 private:
1047  void CopyPropertiesFrom(const FbxObject& pFrom);
1048  void SetClassRootProperty(FbxProperty& lProperty);
1049  int GetFlatPropertyCount() const;
1050 
1051  FbxNameHandler mName;
1052  FbxClassId mRuntimeClassId;
1053  FbxUserDataRecord* mUserData;
1054  FbxManager* mManager;
1055  FbxImplementation* mDefaultImplementation;
1056  FbxUInt64 mUniqueID;
1057  FbxInt32 mObjectFlags;
1058  FbxInt32 mContentLockCount;
1059  FbxInt32 mUserDataCount;
1060  static bool mWipeMode;
1061 
1062  friend class FbxProperty;
1063 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1064 };
1065 
1069 template<typename FbxProperty> class FbxIterator
1070 {
1071 public:
1075  FbxIterator(const FbxObject* pObject) : mObject(pObject) {}
1076 
1080  inline const FbxProperty& GetFirst() { mProperty = mObject->GetFirstProperty(); return mProperty; }
1081 
1085  inline const FbxProperty& GetNext() { mProperty = mObject->GetNextProperty(mProperty); return mProperty; }
1086 
1087 private:
1088  FbxProperty mProperty;
1089  const FbxObject* mObject;
1090 };
1091 
1096 {
1097 public:
1103  inline FbxIteratorSrcBase(FbxProperty& pProperty,FbxClassId pClassId) :
1104  mProperty(pProperty),
1105  mClassId(pClassId),
1106  mSize(0),
1107  mIndex(-1)
1108  {
1109  ResetToBegin();
1110  }
1111 
1117  inline FbxIteratorSrcBase(FbxObject* pObject,FbxClassId pClassId) :
1118  mProperty(pObject->RootProperty),
1119  mClassId(pClassId),
1120  mSize(0),
1121  mIndex(-1)
1122  {
1123  ResetToBegin();
1124  }
1125 
1131  {
1132  ResetToBegin();
1133  return GetNext();
1134  }
1135 
1140  inline FbxObject* GetNext()
1141  {
1142  mIndex++;
1144  }
1145 
1152  {
1154  return GetNext();
1155  }
1156 
1161  inline FbxObject* GetLast()
1162  {
1163  ResetToEnd();
1164  return GetPrevious();
1165  }
1166 
1172  {
1173  mIndex--;
1175  }
1176 
1184  {
1186  while (mIndex>mSize) mIndex--;
1187  return GetPrevious();
1188  }
1189 
1190 protected:
1194  inline void ResetToBegin()
1195  {
1197  mIndex = -1;
1198  }
1199 
1203  inline void ResetToEnd()
1204  {
1206  mIndex = mSize;
1207  }
1208 
1211  int mSize;
1212  int mIndex;
1213 };
1214 
1220 template<class Type> class FbxIteratorSrc : protected FbxIteratorSrcBase
1221 {
1222 public:
1227  inline FbxIteratorSrc(FbxObject* pObject) : FbxIteratorSrcBase(pObject,Type::ClassId) {}
1228 
1233  inline FbxIteratorSrc(FbxProperty& pProperty) : FbxIteratorSrcBase(pProperty,Type::ClassId) {}
1234 
1239  inline Type* GetFirst() { return (Type*)FbxIteratorSrcBase::GetFirst(); }
1240 
1245  inline Type* GetNext() { return (Type*)FbxIteratorSrcBase::GetNext(); }
1246 
1252  inline Type* GetSafeNext() { return (Type*)FbxIteratorSrcBase::GetSafeNext(); }
1253 
1258  inline Type* GetLast() { return (Type*)FbxIteratorSrcBase::GetLast(); }
1259 
1260 
1265  inline Type* GetPrevious() { return (Type*)FbxIteratorSrcBase::GetPrevious(); }
1266 
1273  inline Type* GetSafePrevious() { return (Type*)FbxIteratorSrcBase::GetSafePrevious(); }
1274 };
1275 
1280 {
1281 protected:
1287  int mSize;
1289  int mIndex;
1290 
1291 public:
1297  inline FbxIteratorDstBase(FbxProperty& pProperty,FbxClassId pClassId) :
1298  mProperty(pProperty),
1299  mClassId(pClassId),
1300  mSize(0),
1301  mIndex(-1)
1302  {
1303  ResetToBegin();
1304  }
1305 
1311  inline FbxIteratorDstBase(FbxObject* pObject,FbxClassId pClassId) :
1312  mProperty(pObject->RootProperty),
1313  mClassId(pClassId),
1314  mSize(0),
1315  mIndex(-1)
1316  {
1317  ResetToBegin();
1318  }
1319 
1325  {
1326  ResetToBegin();
1327  return GetNext();
1328  }
1329 
1334  inline FbxObject* GetNext()
1335  {
1336  mIndex++;
1337  return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(FbxCriteria::ObjectType(mClassId), mIndex) : NULL;
1338  }
1339 
1346  {
1347  mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId));
1348  return GetNext();
1349  }
1350 
1355  inline FbxObject* GetLast()
1356  {
1357  ResetToEnd();
1358  return GetPrevious();
1359  }
1360 
1366  {
1367  mIndex--;
1368  return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(FbxCriteria::ObjectType(mClassId), mIndex) : NULL;
1369  }
1370 
1378  {
1379  mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId));
1380  while (mIndex>mSize) mIndex--;
1381  return GetPrevious();
1382  }
1383 
1384 protected:
1388  inline void ResetToBegin()
1389  {
1390  mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId));
1391  mIndex = -1;
1392  }
1393 
1397  inline void ResetToEnd()
1398  {
1399  mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId));
1400  mIndex = mSize;
1401  }
1402 };
1403 
1409 template<class Type> class FbxIteratorDst : protected FbxIteratorDstBase
1410 {
1411 public:
1416  inline FbxIteratorDst(FbxObject* pObject) : FbxIteratorDstBase(pObject,Type::ClassId) {}
1417 
1422  inline FbxIteratorDst(FbxProperty& pProperty) : FbxIteratorDstBase(pProperty,Type::ClassId) {}
1423 
1428  inline Type* GetFirst() { return (Type*)FbxIteratorDstBase::GetFirst(); }
1429 
1434  inline Type* GetNext() { return (Type*)FbxIteratorDstBase::GetNext(); }
1435 
1441  inline Type* GetSafeNext() { return (Type*)FbxIteratorDstBase::GetSafeNext(); }
1442 
1447  inline Type* GetLast() { return (Type*)FbxIteratorDstBase::GetLast(); }
1448 
1453  inline Type* GetPrevious() { return (Type*)FbxIteratorDstBase::GetPrevious(); }
1454 
1461  inline Type* GetSafePrevious() { return (Type*)FbxIteratorDstBase::GetSafePrevious(); }
1462 };
1463 
1471 #define FBX_TYPE(class) ((const class*)0)
1472 
1479 template <class T> inline T* FbxCast(FbxObject* pObject)
1480 {
1481  return pObject && pObject->Is<T>() ? (T*)pObject : 0;
1482 }
1483 
1490 template <class T> inline const T* FbxCast(const FbxObject* pObject)
1491 {
1492  return pObject && pObject->Is<T>() ? (const T*)pObject : 0;
1493 }
1494 
1496 #define FbxForEach(Iterator, Object) for((Object)=(Iterator).GetFirst();(Object)!=0;(Object)=(Iterator).GetNext())
1497 
1499 #define FbxForEachReverse(Iterator, Object) for(Object=(Iterator).GetLast();(Object)!=0;Object=(Iterator).GetPrevious())
1500 
1501 /*****************************************************************************************************************************
1502 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1503 *****************************************************************************************************************************/
1504 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1505 class FBXSDK_DLL FbxConnectEvent
1506 {
1507 public:
1508  enum EType
1509  {
1510  eConnectRequest,
1511  eConnect,
1512  eConnected,
1513  eDisconnectRequest,
1514  eDisconnect,
1515  eDisconnected
1516  };
1517 
1518  enum EDirection
1519  {
1520  eSource,
1521  eDestination
1522  };
1523 
1524  inline FbxConnectEvent(EType pType,EDirection pDir,FbxProperty *pSrc,FbxProperty *pDst) :
1525  mType(pType),
1526  mDirection(pDir),
1527  mSrc(pSrc),
1528  mDst(pDst)
1529  {
1530  }
1531  inline EType GetType() const { return mType; }
1532  inline EDirection GetDirection() const { return mDirection; }
1533  inline FbxProperty& GetSrc() const { return *mSrc; }
1534  inline FbxProperty& GetDst() const { return *mDst; }
1535  template <class T> inline T* GetSrcIfObject() const { return mSrc->IsRoot() ? FbxCast<T>(mSrc->GetFbxObject()) : (T*)0; }
1536  template <class T> inline T* GetDstIfObject() const { return mDst->IsRoot() ? FbxCast<T>(mDst->GetFbxObject()) : (T*)0; }
1537 
1538 private:
1539  EType mType;
1540  EDirection mDirection;
1541  FbxProperty* mSrc;
1542  FbxProperty* mDst;
1543 };
1544 
1545 class FbxObjectPropertyChanged : public FbxEvent<FbxObjectPropertyChanged>
1546 {
1547  FBXSDK_EVENT_DECLARE(FbxObjectPropertyChanged);
1548 
1549 public:
1550  FbxObjectPropertyChanged(FbxProperty pProp) : mProp(pProp) {}
1551  FbxProperty mProp;
1552 };
1553 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1554 
1555 #include <fbxsdk/fbxsdk_nsend.h>
1556 
1557 #endif /* _FBXSDK_CORE_OBJECT_H_ */
unsigned int FbxUInt
Definition: fbxtypes.h:40
FbxProperty GetNextProperty(const FbxProperty &pProperty) const
Returns the next property of this object that follows the specified property.
Definition: fbxobject.h:656
int mSize
The class ID specifies the type of the source objects to be retrieved.
Definition: fbxobject.h:1211
Class to manage property handle.
FBX SDK environment definition.
T * FindDstObject(const FbxCriteria &pCriteria, const char *pName, int pStartIndex=0) const
Searches the destination object with the specified name that is the specified class type and that sat...
Definition: fbxobject.h:637
FbxProperty GetNextDescendent(const FbxProperty &pProperty) const
Returns the property that follows pProperty that is a descendant of this property.
Definition: fbxproperty.h:506
FbxIteratorSrcBase(FbxObject *pObject, FbxClassId pClassId)
Constructor.
Definition: fbxobject.h:1117
FbxObject * FindSrcObject(const char *pName, int pStartIndex=0) const
Searches the source object with the specified name, starting at the specified index.
Definition: fbxobject.h:476
const FbxProperty & GetFirst()
Get the first property of the object.
Definition: fbxobject.h:1080
SDK object manager.
Definition: fbxmanager.h:56
bool DisconnectDstObject(FbxObject *pObject)
Disconnects this object from the destination object.
Definition: fbxobject.h:545
T * GetSrcObject(int pIndex=0) const
Returns the source object of the specified class type at the specified index.
Definition: fbxobject.h:507
void ResetToEnd()
Reset the iterate index to the end.
Definition: fbxobject.h:1397
FbxIteratorDst(FbxProperty &pProperty)
Constructor.
Definition: fbxobject.h:1422
Type * GetSafeNext()
Get next destination object that connects to the property or object.
Definition: fbxobject.h:1441
FbxProperty GetFirstProperty() const
Returns the first property of this object.
Definition: fbxobject.h:647
const FbxProperty & GetNext()
Get next property of the object.
Definition: fbxobject.h:1085
int GetSrcObjectCount(const FbxCriteria &pCriteria) const
Returns the number of source objects that satisfy the given criteria with which this object connects...
Definition: fbxobject.h:456
FbxObject * GetDstObject(const int pIndex=0) const
Returns the destination object at the specified index with which this property connects.
int GetDstPropertyCount() const
Returns the number of destination properties with which this object connects.
Definition: fbxobject.h:768
FbxIteratorSrc(FbxProperty &pProperty)
Constructor.
Definition: fbxobject.h:1233
void * GetUserDataPtr() const
Returns the data pointer of the user data record whose ID is the object ID.
Definition: fbxobject.h:410
Type * GetLast()
Get the last source object that connects to the property or object.
Definition: fbxobject.h:1258
FbxClassId mClassId
The property to iterate. If iterate an object, this is the root property of the object.
Definition: fbxobject.h:1210
#define FBXSDK_FBXOBJECT_DECLARE(Class, Parent)
Definition: fbxobject.h:53
unsigned long long FbxUInt64
Definition: fbxtypes.h:82
bool DisconnectAllSrcObject()
Disconnects this object from all source objects of the specified class type.
Definition: fbxobject.h:488
bool DisconnectDstProperty(const FbxProperty &pProperty)
Disconnects this object from the specified destination property.
Definition: fbxobject.h:763
T * GetDstObject(int pIndex=0) const
Returns the destination object with which this object connects that is the specified class type at th...
Definition: fbxobject.h:618
Abstract class for implementing I/O operations through a stream of data.
Definition: fbxstream.h:26
FbxProperty GetDstProperty(const int pIndex=0) const
Returns the destination property at the specified index with which this property connects.
FbxProperty FindSrcProperty(const char *pName, const int pStartIndex=0) const
Searches the source property with the specified name, starting with the specified index with which th...
#define NULL
Definition: fbxarch.h:210
signed int FbxInt32
Definition: fbxtypes.h:79
Type * GetFirst()
Get the first destination object that connects to the property or object.
Definition: fbxobject.h:1428
Array that stores pairs of FbxString and a pointer.
ECloneType
Types of clones that can be created for FbxObject.
Definition: fbxobject.h:239
Utility class to manipulate strings.
Definition: fbxstring.h:66
FbxObject * GetSrcObject(const int pIndex=0) const
Returns the source object at the specified index with which this property connects.
void ResetToBegin()
Reset the iterate index to the beginning.
Definition: fbxobject.h:1388
FbxProperty FindPropertyHierarchical(const char *pName, const FbxDataType &pDataType, bool pCaseSensitive=true) const
Searches a property by full name and data type.
Definition: fbxobject.h:700
int mIndex
The number of source objects whose type is specified by mClassId.
Definition: fbxobject.h:1212
FbxObject * GetPrevious()
Get previous source object that connects to the property or object.
Definition: fbxobject.h:1171
FbxDocument is a base class for FbxScene and FbxLibrary classes.
Definition: fbxdocument.h:46
FbxIteratorDstBase(FbxObject *pObject, FbxClassId pClassId)
Constructor.
Definition: fbxobject.h:1311
FBX SDK data type class.
Definition: fbxdatatypes.h:26
T * FindDstObject(const char *pName, int pStartIndex=0) const
Searches the destination object with the specified name which is of the specified class type...
Definition: fbxobject.h:630
bool IsConnectedDstObject(const FbxObject *pObject) const
Judges whether this object connects with the destination object.
Definition: fbxobject.h:539
bool IsConnectedDstProperty(const FbxProperty &pProperty)
Determines if this object connects with the specified destination property.
Definition: fbxobject.h:757
bool ConnectSrcProperty(const FbxProperty &pProperty)
Connects this object to a source property.
Definition: fbxobject.h:715
FbxObject * GetSafePrevious()
Get previous destination object that connects to the property or object.
Definition: fbxobject.h:1377
FbxObject * FindDstObject(const FbxCriteria &pCriteria, const char *pName, int pStartIndex=0) const
Searches the destination object with the specified name which satisfies the given criteria...
Definition: fbxobject.h:595
FbxObject * GetDstObject(int pIndex=0) const
Returns the destination object at the specified index with which this object connects.
Definition: fbxobject.h:573
FbxProperty GetSrcProperty(const int pIndex=0) const
Returns the source property at the specified index with which this property connects.
A utility class for iterating over the properties (FbxProperty) of any FbxObject. ...
Definition: fbxobject.h:1069
FbxIteratorSrcBase(FbxProperty &pProperty, FbxClassId pClassId)
Constructor.
Definition: fbxobject.h:1103
This object represents the shading node implementation.
FbxProperty FindProperty(const char *pName, const FbxDataType &pDataType, bool pCaseSensitive=true) const
Searches a property by name and data type.
Definition: fbxobject.h:677
FbxProperty GetSrcProperty(int pIndex=0) const
Returns the source property at the specified index with which this object connects.
Definition: fbxobject.h:738
T * GetSrcObject(const FbxCriteria &pCriteria, int pIndex=0) const
Returns the source object that is the specified class type and that satisfies the given criteria at t...
Definition: fbxobject.h:513
T * GetDstObject(const FbxCriteria &pCriteria, int pIndex=0) const
Returns the destination object with which this object connects that is the specified class type and t...
Definition: fbxobject.h:624
bool DisconnectAllDstObject(const FbxCriteria &pCriteria)
Disconnects this object from all destination objects that satisfy given criteria. ...
Definition: fbxobject.h:556
Type * GetSafePrevious()
Get previous source object that connects to the property or object.
Definition: fbxobject.h:1273
FbxObject * GetLast()
Get the last destination object that connects to the property or object.
Definition: fbxobject.h:1355
FbxProperty GetFirstDescendent() const
Returns the first property that is a descendant of this property.
Definition: fbxproperty.h:500
FbxObject * GetSafePrevious()
Get previous source object that connects to the property or object.
Definition: fbxobject.h:1183
FbxProperty mProperty
Definition: fbxobject.h:1209
bool DisconnectSrcProperty(const FbxProperty &pProperty)
Disconnects this object from the specified source property.
Definition: fbxobject.h:727
void ResetToEnd()
Reset the iterate index to the end.
Definition: fbxobject.h:1203
static FbxCriteria ObjectType(const FbxClassId &pClassId)
Creates a new query criteria that only selects objects which have a specific class ID or derive from ...
int GetSrcObjectCount() const
Returns the number of source objects with which this object connects.
Definition: fbxobject.h:450
A deep copy of the object.
Definition: fbxobject.h:241
FbxObject * GetSafeNext()
Get next destination object that connects to the property or object.
Definition: fbxobject.h:1345
bool IsConnectedSrcObject(const FbxObject *pObject) const
Judges whether this object connects with the source object.
Definition: fbxobject.h:428
bool IsConnectedSrcProperty(const FbxProperty &pProperty)
Determines whether this object connects with the specified source property.
Definition: fbxobject.h:721
int GetDstObjectCount() const
Returns the number of destination objects with which this object connects.
Definition: fbxobject.h:561
The base class of most FBX objects.
Definition: fbxobject.h:157
void ResetToBegin()
Reset the iterate index to the beginning.
Definition: fbxobject.h:1194
This object represents a shading node filter criteria based on the shading node implementation.
T * FindSrcObject(const FbxCriteria &pCriteria, const char *pName, int pStartIndex=0) const
Searches the source object with the specified name that is the specified class type and that satisfie...
Definition: fbxobject.h:526
FbxProperty RootProperty
The root property that holds all children property for this object.
Definition: fbxobject.h:973
bool ConnectDstProperty(const FbxProperty &pProperty)
Connects this object to a destination property.
Definition: fbxobject.h:751
Type * GetSafePrevious()
Get previous destination object that connects to the property or object.
Definition: fbxobject.h:1461
FbxObject * GetSafeNext()
Get next source object that connects to the property or object.
Definition: fbxobject.h:1151
int GetDstObjectCount(const FbxCriteria &pCriteria) const
Returns the number of destination objects with which this object connects that satisfy the given crit...
Definition: fbxobject.h:567
bool ConnectSrcObject(FbxObject *pObject, FbxConnection::EType pType=FbxConnection::eNone)
Connects this object to a source object.
Definition: fbxobject.h:422
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
FbxObject * GetSrcObject(const FbxCriteria &pCriteria, int pIndex=0) const
Returns the source object that satisfies the criteria at the specified index with which this object c...
Definition: fbxobject.h:469
int GetSrcPropertyCount() const
Returns the number of source properties with which this object connects.
Definition: fbxobject.h:732
FbxProperty FindDstProperty(const char *pName, int pStartIndex=0) const
Searches a destination property with which this object connects that has a specific name...
Definition: fbxobject.h:781
int mSize
The number of destination objects whose type is specified by mClassId.
Definition: fbxobject.h:1287
void SetUserDataPtr(void *pUserData)
Sets the data pointer for the user data record whose ID is the object ID.
Definition: fbxobject.h:405
bool IsRoot() const
Judges if this property is the root property.
Definition: fbxproperty.h:468
const FbxImplementation * GetImplementation(const FbxObject *pObject, const char *pImplementationTarget)
Get FbxImplementation from FbxObject.
FbxObject * FindDstObject(const char *pName, int pStartIndex=0) const
Searches the destination object with the specified name, starting at the specified index...
Definition: fbxobject.h:587
Defines a filtering criteria for a query of objects, connections and properties, so that only those s...
Definition: fbxquery.h:104
FbxObject * GetFirst()
Get the first source object that connects to the property or object.
Definition: fbxobject.h:1130
FbxProperty FindPropertyHierarchical(const char *pName, bool pCaseSensitive=true) const
Searches a property by full name.
Definition: fbxobject.h:688
Type * GetNext()
Get next destination object that connects to the property or object.
Definition: fbxobject.h:1434
FbxIterator(const FbxObject *pObject)
Constructor.
Definition: fbxobject.h:1075
FbxObject * GetSrcObject(int pIndex=0) const
Returns the source object with which this object connects at the specified index. ...
Definition: fbxobject.h:462
int GetSrcObjectCount() const
Returns the number of source objects with which this property connects.
bool DisconnectSrcObject(FbxObject *pObject)
Disconnects this object from a source object.
Definition: fbxobject.h:434
FbxObject * GetNext()
Get next source object that connects to the property or object.
Definition: fbxobject.h:1140
int GetSrcObjectCount(const FbxCriteria &pCriteria) const
Returns the number of source objects with which this object connects that are the specified class typ...
Definition: fbxobject.h:502
FbxProperty Find(const char *pName, bool pCaseSensitive=true) const
Searches a property using its name.
Definition: fbxproperty.h:514
A utility class for iterating over source objects that connect to property (FbxProperty) or object (F...
Definition: fbxobject.h:1220
FbxProperty FindProperty(const char *pName, bool pCaseSensitive=true) const
Searches a property by name.
Definition: fbxobject.h:666
Internal class used to differentiate objects during run-time.
Definition: fbxclassid.h:39
int GetDstObjectCount() const
Returns the number of destination objects with which this property connects.
int GetDstObjectCount() const
Returns the number of destination objects of the specified class type with which this object connects...
Definition: fbxobject.h:608
FbxObject * FindSrcObject(const FbxCriteria &pCriteria, const char *pName, int pStartIndex=0) const
Searches the source object with the specified name which satisfies the given criteria, starting at the specified index.
Definition: fbxobject.h:484
int GetSrcObjectCount() const
Returns the number of source objects of a specific class type with which this object connects...
Definition: fbxobject.h:497
Class to hold user properties.
Definition: fbxproperty.h:37
bool DisconnectAllDstObject(const FbxCriteria &pCriteria)
Disconnects this object from all destination objects that are the specified class type and that satis...
Definition: fbxobject.h:604
bool Is() const
Templated test if this class is a hierarchical children of the specified class type.
Definition: fbxobject.h:167
T * FbxCast(FbxObject *pObject)
Safe casting of FBX SDK objects into other FBX SDK class types.
Definition: fbxobject.h:1479
Type * GetSafeNext()
Get next source object that connects to the property or object.
Definition: fbxobject.h:1252
Type * GetPrevious()
Get previous source object that connects to the property or object.
Definition: fbxobject.h:1265
#define FBXSDK_EVENT_DECLARE(Class)
Definition: fbxevent.h:68
Base class to emit event with the specified event type.
Definition: fbxemitter.h:49
FbxIteratorDst(FbxObject *pObject)
Constructor.
Definition: fbxobject.h:1416
A utility class for iterating over destination objects that connect to property (FbxProperty) or obje...
Definition: fbxobject.h:1409
FbxObject * GetDstObject(const FbxCriteria &pCriteria, int pIndex=0) const
Returns the destination object with which this object connects that satisfies the given criteria at t...
Definition: fbxobject.h:580
int mIndex
Iterate index.
Definition: fbxobject.h:1289
T * FindSrcObject(const char *pName, int pStartIndex=0) const
Searches the source object with the specified name that is the specified class type, starting at the specified index.
Definition: fbxobject.h:519
#define FBXSDK_DLL
Definition: fbxarch.h:173
A utility class for iterating over destination objects that connect to property (FbxProperty) or obje...
Definition: fbxobject.h:1279
bool ConnectDstObject(FbxObject *pObject, FbxConnection::EType pType=FbxConnection::eNone)
Connects this object to one destination object.
Definition: fbxobject.h:533
A name is a case-sensitive string ID of a property, a node, a node attribute, a texture, etc.
Type * GetNext()
Get next source object that connects to the property or object.
Definition: fbxobject.h:1245
FbxObject * GetPrevious()
Get previous destination object that connects to the property or object.
Definition: fbxobject.h:1365
int GetDstObjectCount(const FbxCriteria &pCriteria) const
Returns the number of destination objects with which this object connects that are the specified clas...
Definition: fbxobject.h:613
FbxIteratorSrc(FbxObject *pObject)
Constructor.
Definition: fbxobject.h:1227
bool DisconnectAllDstObject()
Disconnects this object from all destination objects.
Definition: fbxobject.h:550
FbxProperty GetDstProperty(int pIndex=0) const
Returns the destination property at the specified index with which this object connects.
Definition: fbxobject.h:774
This library class represents libraries that store sub-libraries and shading objects.
Definition: fbxlibrary.h:30
FbxProperty mProperty
The property to iterate.
Definition: fbxobject.h:1283
bool DisconnectAllDstObject()
Disconnects this object from all destination objects of the specified class type. ...
Definition: fbxobject.h:599
FbxProperty FindDstProperty(const char *pName, const int pStartIndex=0) const
Searches the destination property with the specified name, starting with the specified index with whi...
bool DisconnectAllSrcObject(const FbxCriteria &pCriteria)
Disconnects this object from all source objects that satisfy a given criteria.
Definition: fbxobject.h:445
FbxPeripheral is an interface to load/unload content of FbxObject from memory to somewhere you define...
Definition: fbxperipheral.h:31
FbxObject * GetNext()
Get next destination object that connects to the property or object.
Definition: fbxobject.h:1334
bool DisconnectAllSrcObject(const FbxCriteria &pCriteria)
Disconnects this object from all source objects that are of the specified class type and that satisfy...
Definition: fbxobject.h:493
FbxIteratorDstBase(FbxProperty &pProperty, FbxClassId pClassId)
Constructor.
Definition: fbxobject.h:1297
FbxObject * GetFirst()
Get the first destination object that connects to the property or object.
Definition: fbxobject.h:1324
FbxProperty FindSrcProperty(const char *pName, int pStartIndex=0) const
Searches a source property with which this object connects that has a specific name, starting at the specified index.
Definition: fbxobject.h:745
A utility class for iterating over source objects that connect to property (FbxProperty) or object (F...
Definition: fbxobject.h:1095
bool DisconnectAllSrcObject()
Disconnects this object from all source objects.
Definition: fbxobject.h:439
FbxProperty FindHierarchical(const char *pName, bool pCaseSensitive=true) const
Searches a property using its full name.
Definition: fbxproperty.h:531
FbxObject * GetLast()
Get the last source object that connects to the property or object.
Definition: fbxobject.h:1161
FbxClassId mClassId
The class ID specifies the type of the destination objects to be retrieved.
Definition: fbxobject.h:1285
FBX event class, derived from FbxEventBase, and it contains a type ID for event.
Definition: fbxevent.h:134
Type * GetLast()
Get the last destination object that connects to the property or object.
Definition: fbxobject.h:1447
Type * GetFirst()
Get the first source object that connects to the property or object.
Definition: fbxobject.h:1239
Type * GetPrevious()
Get previous destination object that connects to the property or object.
Definition: fbxobject.h:1453