| 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 | |
| 12 | //! \file fbxcollection.h |
| 13 | #ifndef _FBXSDK_SCENE_COLLECTION_H_ |
| 14 | #define _FBXSDK_SCENE_COLLECTION_H_ |
| 15 | |
| 16 | #include <fbxsdk/fbxsdk_def.h> |
| 17 | |
| 18 | #include <fbxsdk/core/fbxobject.h> |
| 19 | |
| 20 | #include <fbxsdk/fbxsdk_nsbegin.h> |
| 21 | |
| 22 | class FbxCriteria; |
| 23 | |
| 24 | /** A FbxObject derived container for FbxObject. |
| 25 | * \nosubgrouping |
| 26 | * |
| 27 | */ |
| 28 | class FBXSDK_DLL FbxCollection : public FbxObject |
| 29 | { |
| 30 | FBXSDK_OBJECT_DECLARE(FbxCollection, FbxObject); |
| 31 | |
| 32 | public: |
| 33 | /** |
| 34 | * \name Collection member management |
| 35 | */ |
| 36 | //@{ |
| 37 | //! Deletes all objects in the container. |
| 38 | virtual void Clear(); |
| 39 | |
| 40 | /** Adds a member. |
| 41 | * \param pMember Object to be added. |
| 42 | */ |
| 43 | virtual bool AddMember(FbxObject* pMember) { return ConnectSrcObject(pMember); } |
| 44 | |
| 45 | /** Removes a member. |
| 46 | * \param pMember Object to be removed. |
| 47 | */ |
| 48 | virtual bool RemoveMember(FbxObject* pMember) { return DisconnectSrcObject(pMember); } |
| 49 | |
| 50 | /** Returns the number of objects contained within the collection. |
| 51 | * \return The number of objects the collection contains. |
| 52 | */ |
| 53 | inline int GetMemberCount () const { return GetSrcObjectCount(); } |
| 54 | |
| 55 | /** Returns the member of the collection at the given index. |
| 56 | * \param pIndex The given index. |
| 57 | * \return The member of the collection at the given index. |
| 58 | */ |
| 59 | inline FbxObject* GetMember(int pIndex=0) const { return GetSrcObject(pIndex); } |
| 60 | |
| 61 | /** Judges whether an object is a part of the collection. |
| 62 | * \param pMember The member to be judged. |
| 63 | * \return \c True if it is a member of the collection, returns \c false if it is not a member. |
| 64 | */ |
| 65 | virtual bool IsMember(const FbxObject* pMember) const; |
| 66 | //@} |
| 67 | |
| 68 | /** |
| 69 | * \name Templated member management |
| 70 | */ |
| 71 | //@{ |
| 72 | /** Returns the number of class T objects contained within the collection. |
| 73 | * \return The number of objects of class T the collection contains. */ |
| 74 | template <class T> inline int GetMemberCount() const { return GetSrcObjectCount<T>(); } |
| 75 | |
| 76 | /** Returns the member of class T at the given index in the collection. |
| 77 | * \param pIndex The given index. |
| 78 | * \return The member of class T at the given index. */ |
| 79 | template <class T> inline T* GetMember(int pIndex=0) const { return GetSrcObject<T>(pIndex); } |
| 80 | |
| 81 | /** Searches for a member of class T. |
| 82 | * \param pName Member name. */ |
| 83 | template <class T> inline T* FindMember(const char* pName) const { return FindSrcObject<T>(pName); } |
| 84 | //@} |
| 85 | |
| 86 | /** |
| 87 | * \name Criteria based member management |
| 88 | */ |
| 89 | //@{ |
| 90 | /** Returns the number of objects contained within the collection that meet the specified criteria. |
| 91 | * \param pCriteria Defines a set of criteria that each object must meet in order to be included in the results. |
| 92 | * \return The number of objects the collection contains that meet the specified criteria. |
| 93 | */ |
| 94 | inline int GetMemberCount(const FbxCriteria& pCriteria) const { return GetSrcObjectCount(pCriteria); } |
| 95 | |
| 96 | /** Returns the member at the given index in the collection if it meets the specified criteria. |
| 97 | * \param pCriteria Defines a set of criteria that the returned object must meet. |
| 98 | * \param pIndex The given index. |
| 99 | * \return The member at the given index if it meets the criteria; NULL otherwise. |
| 100 | */ |
| 101 | inline FbxObject* GetMember(const FbxCriteria& pCriteria, int pIndex=0) const { return GetSrcObject(pCriteria, pIndex); } |
| 102 | |
| 103 | /** Searches for a member with the given name that also meets the given criteria. |
| 104 | * \param pCriteria Defines a set of criteria that the returned object must meet. |
| 105 | * \param pName Member name. |
| 106 | * \return The member with the given name if it meets the criteria; NULL if no match could be found. |
| 107 | */ |
| 108 | inline FbxObject* FindMember(const FbxCriteria& pCriteria, const char* pName) const { return FindSrcObject(pCriteria, pName); } |
| 109 | //@} |
| 110 | |
| 111 | /** |
| 112 | * \name Selection management |
| 113 | */ |
| 114 | //@{ |
| 115 | /** Selects/Deselects all the contained objects. |
| 116 | * \param pSelection If \c true, all objects are selected, if \c false, all objects are deselected. |
| 117 | */ |
| 118 | virtual void SetSelectedAll(bool pSelection); |
| 119 | //@} |
| 120 | }; |
| 121 | |
| 122 | #include <fbxsdk/fbxsdk_nsend.h> |
| 123 | |
| 124 | #endif /* _FBXSDK_SCENE_COLLECTION_H_ */ |
| 125 | |