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 fbxobject.h |
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> |
21 | #include <fbxsdk/core/fbxproperty.h> |
22 | #include <fbxsdk/core/fbxstream.h> |
23 | #include <fbxsdk/core/base/fbxstringlist.h> |
24 | #include <fbxsdk/utils/fbxnamehandler.h> |
25 | |
26 | #include <fbxsdk/fbxsdk_nsbegin.h> |
27 | |
28 | class FbxManager; |
29 | class FbxDocument; |
30 | class FbxImplementation; |
31 | class FbxImplementationFilter; |
32 | class FbxLibrary; |
33 | class FbxMessage; |
34 | class FbxPeripheral; |
35 | class FbxUserDataRecord; |
36 | class FbxConnectEvent; |
37 | |
38 | //! \internal Macro used to declare ClassId mechanics. |
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 | //! \internal Macro used to declare the FbxObject class. |
53 | #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 | //! Macro used to declare a new class derived from FbxObject. |
61 | #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 | //! Macro used to declare a new abstract class derived from FbxObject. |
68 | #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 | //! Macro used to implement a new class derived from FbxObject. |
76 | #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 | //! Macro used to implement a new abstract class derived from FbxObject. |
96 | #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 | /** The base class of most FBX objects. Provides the benefits of connectivity, identity, run-time typing, |
105 | * properties, naming, copying, cloning, selection, and automated file IO. Most of |
106 | * the FBX SDK API deals with FbxObject pointers when it comes to manipulate objects in its simplest form. |
107 | * |
108 | * The ClassID mechanism replaces the dynamic_cast mechanism for efficient run-time type information. |
109 | * |
110 | * The FbxObject provides methods for managing the connections between objects. |
111 | * Using connections, objects can be related to each other to form hierarchies or structures. All of |
112 | * the FBX scene's object relations are expressed as connections between objects. Those connections can |
113 | * be altered as needed to reflect most kind of setups encountered in this world. For example, |
114 | * connections can be used to express parenting between transform nodes. Connections are not strict in |
115 | * the sense that we allow any type of objects to connect to any other type of objects. The meaning of |
116 | * the connection is purely semantic. As of yet, we do not provide the functionality to validate if |
117 | * the connections made by the users are allowed or not. |
118 | * |
119 | * FbxObject provide a property (FbxProperty) mechanism to describe characteristics of |
120 | * objects in a scene. Properties may be either static or dynamic. Static properties are defined in the class direction |
121 | * and can be accessed directly by their name on the object exposing them without |
122 | * the need for a search in the property list of the object. Dynamic properties can be added during run-time, |
123 | * while the program is running. Objects can have an unlimited amount of properties. |
124 | * Properties can be listed at run-time, allowing for a flexible support of custom data |
125 | * on objects, since they might be considered by the FBX file readers/writers depending on the flags set. |
126 | * |
127 | * Here is an example of a new empty minimal class template for FBX objects: |
128 | * \code |
129 | * //Declaration |
130 | * class MyClass : public FbxObject |
131 | * { |
132 | * FBXSDK_OBJECT_DECLARE(MyClass, FbxObject); //Be careful! The second parameter to this macro must be the parent class name! |
133 | * |
134 | * public: |
135 | * //Declare methods and properties here... |
136 | * }; |
137 | * \endcode |
138 | * \code |
139 | * //Implementation |
140 | * FBXSDK_OBJECT_IMPLEMENT(MyClass); |
141 | * \endcode |
142 | * Before the new class can be used, it needs to be registered to the manager with the following method: |
143 | * \code |
144 | * MyFbxManager->RegisterFbxClass("MyClassName", FBX_TYPE(MyClass), FBX_TYPE(FbxObject)); //Be careful! The 3rd parameter must be the parent class! If the parent class change, it must be updated here too! |
145 | * \endcode |
146 | * Then to create or delete instances of your new class, the following methods must be used: |
147 | * \code |
148 | * //Creating a new instance |
149 | * MyClass* MyObject = MyClass::Create(MyFbxManager, "Object Name"); |
150 | * |
151 | * //Deleting this instance |
152 | * MyObject->Destroy(); |
153 | * MyObject = NULL; |
154 | * \endcode |
155 | * \see FbxProperty |
156 | */ |
157 | class FBXSDK_DLL FbxObject : public FbxEmitter |
158 | { |
159 | FBXSDK_FBXOBJECT_DECLARE(FbxObject, FbxEmitter); |
160 | |
161 | public: |
162 | //! \name General Object Management |
163 | //@{ |
164 | /** Test if this class is a hierarchical children of the specified class type. This is the standard method to differentiate object classes. (Deprecated, please use Is<Type>() instead.) |
165 | * \param pClassId The class type to test against self. |
166 | * \return \c true if the object is a hierarchical children of the type specified. |
167 | * \remark This function will perform a complete search until it reaches the top level class, but it will stop as soon as one ClassId matches the test. */ |
168 | FBX_DEPRECATED inline bool Is(const FbxClassId& pClassId) const { return GetClassId().Is(pClassId); } |
169 | |
170 | /** Templated test if this class is a hierarchical children of the specified class type. |
171 | * \return \c true if the object is a hierarchical children of the type specified. |
172 | * \remark This function will perform a complete search until it reaches the top level class, but it will stop as soon as one ClassId matches the test. */ |
173 | template <class T> inline bool Is() const { return GetClassId().Is(T::ClassId); } |
174 | |
175 | /** Retrieve the FbxManager this object belongs to. |
176 | * \return A pointer to the manager that this object belongs to. */ |
177 | FbxManager* GetFbxManager() const; |
178 | |
179 | /** Returns a const pointer to the document that contains this object. |
180 | * \return A const pointer to the document that contains this object or \c NULL if the object does not belong to any document. */ |
181 | FbxDocument* GetDocument() const; |
182 | |
183 | /** Returns a const pointer to the root document that contains this object. |
184 | * \return A const pointer to the root document that contains this object or \c NULL if the object does not belong to any document. |
185 | * \remarks It returns this pointer if this object is a document object and does not belong to any document. That means this object is the root document. */ |
186 | FbxDocument* GetRootDocument() const; |
187 | |
188 | /** Returns a const pointer to the scene that contains this object. |
189 | * \return A pointer to the scene that contains this object or \c NULL if the object does not belong to any scene. */ |
190 | FbxScene* GetScene() const; |
191 | |
192 | /** Unregister and delete this object from memory. This will also breaks all connections as well as removing all the instance of all the properties of this object with the object's class. |
193 | * \param pRecursive If true, all children (source) objects will also be unregistered and deleted. */ |
194 | void Destroy(bool pRecursive=false); |
195 | |
196 | /** Reset all the properties of this object to their default values. */ |
197 | void ResetProperties(); |
198 | //@} |
199 | |
200 | //! \name Object Flags Management |
201 | //@{ |
202 | //! Flags available to control objects. |
203 | enum EObjectFlag |
204 | { |
205 | eNone = 0, //!< No flags. |
206 | eInitialized = 1 << 0, //!< Automatically set when FbxObject::Construct() is completed. |
207 | eSystem = 1 << 1, //!< When set, object is deleted upon FbxManager destroy only. Use carefully! |
208 | eSavable = 1 << 2, //!< If set, object is stored in FBX file upon export. All objects are savable by default. |
209 | eSelected = 1 << 3, //!< Used by the selection mechanic to specify a selected object. |
210 | eHidden = 1 << 4, //!< Used for interface representation; if set, the object should not be visible. |
211 | eContentLoaded = 1 << 5, //!< Used by load-on-demand mechanic to specify if an object has its content loaded. |
212 | eDontLocalize = 1 << 6, //!< Used by asset builder; Do not localize this object |
213 | eCopyCalledByClone = 1 << 16 //!< Used internally. If set, modify the Copy behavior of the object |
214 | }; |
215 | |
216 | /** Set the state of object flags. |
217 | * \param pFlags Bit flags which value is going to be changed. |
218 | * \param pValue If \c true, bit flags will be set, otherwise bits will be un-set. */ |
219 | void SetObjectFlags(EObjectFlag pFlags, bool pValue); |
220 | |
221 | /** Get the state of object flags. |
222 | * \param pFlags Bit flags to query. |
223 | * \return \c true if the specified bit flags are all set. */ |
224 | bool GetObjectFlags(EObjectFlag pFlags) const; |
225 | |
226 | /** Override all object flags at once. |
227 | * \param pFlags The bit flags to set all the object flags to. |
228 | * \remark This function will override all flags; unspecified bit flags will be un-set. */ |
229 | void SetAllObjectFlags(FbxUInt pFlags); |
230 | |
231 | /** Get all object flags at once. |
232 | * \return All bit flags at once. */ |
233 | FbxUInt GetAllObjectFlags() const; |
234 | //@} |
235 | |
236 | //! \name Copying, Cloning and Referencing |
237 | //@{ |
238 | /** Copy an object content into this object. |
239 | * \param pObject The source object to copy data from. |
240 | * \return Returns the destination object being modified by the source. |
241 | * \remark This function replace the assignment operator (operator=). It will copy all property values and the name. Connections are NOT copied. */ |
242 | virtual FbxObject& Copy(const FbxObject& pObject); |
243 | |
244 | //! Types of clones that can be created for FbxObject. |
245 | enum ECloneType |
246 | { |
247 | eDeepClone, //!< A deep copy of the object. Changes to either the original or clone properties do not propagate to each other. |
248 | eReferenceClone //!< Changes to original object properties propagate to clone. Changes to clone properties do not propagate to original. |
249 | }; |
250 | |
251 | /** Creates a clone of this object. |
252 | * By default, the connections are NOT cloned. If the desired effect is to clone the connections as well, you must clone using the FbxCloneManager |
253 | * (refer to this class documentation for further details). |
254 | * |
255 | * \param pCloneType The type of clone to be created. By default, the clone type is eDeepClone. |
256 | * \param pContainer An optional parameter to specify which object will "contain" the new object. By contain, we mean the new object |
257 | * will become a source to the container, connection-wise. |
258 | * \param pSet See remark section. |
259 | * \return The new clone, or NULL (if the specified clone type is not supported). |
260 | * \remark When doing either a "deep" or "reference" clone type, the clone will always get its properties values set from |
261 | * the source object properties values. |
262 | * \remark Since this is a virtual function, some classes might do additional tasks. |
263 | * \remark The \e pSet argument is not used in the default implementation of this method. Specialized implementations should |
264 | * cast this pointer to FbxCloneManager::CloneSet to have access to the cloned objects so far. Typically, this |
265 | * pointer is set by the clone manager. |
266 | */ |
267 | virtual FbxObject* Clone(FbxObject::ECloneType pCloneType=eDeepClone, FbxObject* pContainer=NULL, void* pSet = NULL) const; |
268 | |
269 | /** Checks if this object is a reference clone of another object. |
270 | * \return \c True if this object is a clone of another object, \c false otherwise */ |
271 | bool IsAReferenceTo() const; |
272 | |
273 | /** If this object is a reference clone, returns the original object (from which the clone originates). |
274 | * \return The original object, or NULL (if this object is not a reference clone). */ |
275 | FbxObject* GetReferenceTo() const; |
276 | |
277 | /** Checks if any objects are reference cloned from this object. |
278 | * \return \c True if there are objects reference cloned from this object, \c false otherwise. */ |
279 | bool IsReferencedBy() const; |
280 | |
281 | /** Returns the number of objects that are reference clones of this object. |
282 | * \return The number of objects that are reference clones of this object. */ |
283 | int GetReferencedByCount() const; |
284 | |
285 | /** Returns a reference clone of this object at the specified index. |
286 | * \param pIndex The specified index, valid values are [0, GetReferencedByCount()) |
287 | * \return The reference clone, or NULL (if pIndex is out of range). */ |
288 | FbxObject* GetReferencedBy(int pIndex) const; |
289 | //@} |
290 | |
291 | /** |
292 | * \name Object Name Management |
293 | */ |
294 | //@{ |
295 | /** Sets the name of this object. |
296 | * \param pName The object name as a \c NULL terminated string. |
297 | */ |
298 | void SetName(const char* pName); |
299 | |
300 | /** Returns the full name of this object. |
301 | * \return The full name as a \c NULL terminated string. |
302 | */ |
303 | const char* GetName() const; |
304 | |
305 | /** Returns the name of the object without the namespace qualifier. |
306 | * \return The object name without the namespace qualifier. |
307 | */ |
308 | FbxString GetNameWithoutNameSpacePrefix() const; |
309 | |
310 | /** Returns the name of the object with the namespace qualifier. |
311 | * \return The object name with the namespace qualifier. |
312 | */ |
313 | FbxString GetNameWithNameSpacePrefix() const; |
314 | |
315 | /** Sets the initial name of the object. |
316 | * \param pName The object's initial name as a \c NULL terminated string. |
317 | */ |
318 | void SetInitialName(const char* pName); |
319 | |
320 | /** Returns the initial name of the object. |
321 | * \return The object's initial name as a \c NULL terminated string. |
322 | */ |
323 | const char* GetInitialName() const; |
324 | |
325 | /** Returns the namespace of the object. |
326 | * \return The object's namespace as a \c NULL terminated string. |
327 | */ |
328 | FbxString GetNameSpaceOnly(); |
329 | |
330 | /** Sets the namespace of the object. |
331 | * \param pNameSpace The object's namespace as a \c NULL terminated string. |
332 | */ |
333 | void SetNameSpace(FbxString pNameSpace); |
334 | |
335 | /** Returns an array of all the namespaces for this object |
336 | * \param identifier The identifier of the namespaces. |
337 | * \return The array of all namespaces. |
338 | */ |
339 | FbxArray<FbxString*> GetNameSpaceArray(char identifier); |
340 | |
341 | /** Returns only the name (no namespace or prefix) of the object. |
342 | * \return The name only as a \c NULL terminated string. |
343 | */ |
344 | FbxString GetNameOnly() const; |
345 | |
346 | /** Returns the namespace qualifier. |
347 | * \return The namespace qualifier. |
348 | */ |
349 | FbxString GetNameSpacePrefix() const; |
350 | |
351 | /** Removes the prefix of pName |
352 | * \param pName Whose prefix is removed. |
353 | * \return A temporary string without prefix. |
354 | */ |
355 | static FbxString RemovePrefix(char* pName); |
356 | |
357 | /** Strips the prefix of pName |
358 | * \param lName Whose prefix is stripped. |
359 | * \return lName stripped of its prefix. |
360 | */ |
361 | static FbxString StripPrefix(FbxString& lName); |
362 | |
363 | /** Strips the prefix of pName |
364 | * \param pName Whose prefix is stripped. |
365 | * \return A temporary string stripped of its prefix. |
366 | */ |
367 | static FbxString StripPrefix(const char* pName); |
368 | |
369 | //!Returns the unique ID of this object. |
370 | const FbxUInt64& GetUniqueID() const; |
371 | //@} |
372 | |
373 | /** |
374 | * \name Selection management |
375 | */ |
376 | //@{ |
377 | /** Returns if this object is currently in a selected state. |
378 | * \return \c True if this object is selected, \c false otherwise. |
379 | */ |
380 | virtual bool GetSelected(); |
381 | |
382 | /** Sets whether this object is currently selected. |
383 | * \param pSelected The selection flag. |
384 | */ |
385 | virtual void SetSelected(bool pSelected); |
386 | //@} |
387 | |
388 | /** |
389 | * \name User data |
390 | */ |
391 | //@{ |
392 | /** Sets the data pointer for an user data record whose ID is pUserID. |
393 | * \param pUserID The ID of the user data record. |
394 | * \param pUserData The data pointer of the user data record. |
395 | * \remarks An user data record is composed of an ID and a data pointer. |
396 | * If the user data record identified by pUserID does not exist, a new user data record is created and its data pointer is set as pUserData. |
397 | */ |
398 | void SetUserDataPtr(const FbxUInt64& pUserID, void* pUserData); |
399 | |
400 | /** Returns the data pointer of an user data record whose ID is pUserID. |
401 | * \param pUserID The ID of the user data record. |
402 | * \return The data pointer of the user data record, \c NULL if the user data record is not found. |
403 | */ |
404 | void* GetUserDataPtr(const FbxUInt64& pUserID) const; |
405 | |
406 | /** Sets the data pointer for the user data record whose ID is the object ID. |
407 | * \param pUserData The data pointer of the user data record. |
408 | * \remarks An user data record is composed of an ID and a data pointer. |
409 | * If the user data record identified by pUserID does not exist, a new user data record is created and its data pointer is set as pUserData. |
410 | */ |
411 | inline void SetUserDataPtr(void* pUserData){ SetUserDataPtr(GetUniqueID(), pUserData); } |
412 | |
413 | /** Returns the data pointer of the user data record whose ID is the object ID. |
414 | * \return The data pointer of the user data record, \c NULL if the user data record is not found. |
415 | */ |
416 | inline void* GetUserDataPtr() const { return GetUserDataPtr(GetUniqueID()); } |
417 | //@} |
418 | |
419 | /** |
420 | * \name General Object Connection and Relationship Management |
421 | */ |
422 | //@{ |
423 | /** Connects this object to a source object. |
424 | * \param pObject The source object to which this object connects. |
425 | * \param pType The connection type between this object and the source object. |
426 | * \return \c True on success, \c false otherwise. |
427 | */ |
428 | inline bool ConnectSrcObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone) { return RootProperty.ConnectSrcObject(pObject,pType); } |
429 | |
430 | /** Judges whether this object connects with the source object. |
431 | * \param pObject The source object. |
432 | * \return \c True if this object connects with the source object, \c false otherwise. |
433 | */ |
434 | inline bool IsConnectedSrcObject(const FbxObject* pObject) const { return RootProperty.IsConnectedSrcObject(pObject); } |
435 | |
436 | /** Disconnects this object from a source object. |
437 | * \param pObject The source object from which this object will be disconnected. |
438 | * \return \c True on success, \c false otherwise. |
439 | */ |
440 | inline bool DisconnectSrcObject(FbxObject* pObject){ return RootProperty.DisconnectSrcObject(pObject); } |
441 | |
442 | /** Disconnects this object from all source objects. |
443 | * \return \c True if it disconnects all source objects successfully, \c false otherwise. |
444 | */ |
445 | inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(); } |
446 | |
447 | /** Disconnects this object from all source objects that satisfy a given criteria. |
448 | * \param pCriteria The given criteria. |
449 | * \return \c True if it disconnects all the source objects successfully, \c false otherwise. |
450 | */ |
451 | inline bool DisconnectAllSrcObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllSrcObject(pCriteria); } |
452 | |
453 | /** Disconnects this object from all source objects of a specific class type. (Deprecated, please use DisconnectAllSrcObject<Type>() instead.) |
454 | * \param pClassId The specific class type. |
455 | * \return \c True if it disconnects all source objects successfully, \c false otherwise. |
456 | */ |
457 | FBX_DEPRECATED inline bool DisconnectAllSrcObject(FbxClassId pClassId) { return RootProperty.DisconnectAllSrcObject(FbxCriteria::ObjectType(pClassId)); } |
458 | |
459 | /** Returns the number of source objects with which this object connects. |
460 | * \return The number of source objects with which this object connects. |
461 | */ |
462 | inline int GetSrcObjectCount() const { return RootProperty.GetSrcObjectCount(); } |
463 | |
464 | /** Returns the number of source objects that satisfy the given criteria with which this object connects. |
465 | * \param pCriteria The given criteria. |
466 | * \return The number of source objects that satisfy the given criteria with which this object connects. |
467 | */ |
468 | inline int GetSrcObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetSrcObjectCount(pCriteria); } |
469 | |
470 | /** Returns the number of source objects of the specific class type with which this object connects. (Deprecated, please use GetSrcObjectCount<Type>() instead.) |
471 | * \param pClassId The specific class type. |
472 | * \return The number of source objects of the specific class type with which this object connects. |
473 | */ |
474 | FBX_DEPRECATED inline int GetSrcObjectCount(FbxClassId pClassId) const { return RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(pClassId)); } |
475 | |
476 | /** Returns the source object with which this object connects at the specified index. |
477 | * \param pIndex The specified index whose default value is 0. |
478 | * \return The source object at the specified index, NULL if not found. |
479 | */ |
480 | inline FbxObject* GetSrcObject(int pIndex=0) const { return RootProperty.GetSrcObject(pIndex); } |
481 | |
482 | /** Returns the source object that satisfies the criteria at the specified index with which this object connects. |
483 | * \param pCriteria The given criteria. |
484 | * \param pIndex The specified index whose default value is 0. |
485 | * \return The source object that satisfies the given criteria at the specified index, NULL if not found. |
486 | */ |
487 | inline FbxObject* GetSrcObject(const FbxCriteria& pCriteria, int pIndex=0) const { return RootProperty.GetSrcObject(pCriteria,pIndex); } |
488 | |
489 | /** Returns the source object of the specified class type at the specified index with which this object connects. (Deprecated, please use GetSrcObject<Type>() instead.) |
490 | * \param pClassId The specified class type. |
491 | * \param pIndex The specified index whose default value is 0. |
492 | * \return The source object of the specified class type at the specified index, NULL if not found. |
493 | */ |
494 | FBX_DEPRECATED inline FbxObject* GetSrcObject(FbxClassId pClassId, int pIndex=0) const { return RootProperty.GetSrcObject(FbxCriteria::ObjectType(pClassId), pIndex); } |
495 | |
496 | /** Searches the source object with the specified name, starting at the specified index. |
497 | * \param pName The object name. |
498 | * \param pStartIndex The start index. |
499 | * \return The source object with the name, NULL if not found. |
500 | */ |
501 | inline FbxObject* FindSrcObject(const char* pName, int pStartIndex=0) const { return RootProperty.FindSrcObject(pName,pStartIndex); } |
502 | |
503 | /** Searches the source object with the specified name which satisfies the given criteria, starting at the specified index. |
504 | * \param pCriteria The given criteria. |
505 | * \param pName The object name. |
506 | * \param pStartIndex The start index. |
507 | * \return The source object with the name, NULL if not found. |
508 | */ |
509 | inline FbxObject* FindSrcObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return RootProperty.FindSrcObject(pCriteria,pName,pStartIndex); } |
510 | |
511 | /** Searches the source object with the specified name which is also the specified class type, starting at the specified index. (Deprecated, please use FindSrcObject<Type>() instead.) |
512 | * \param pClassId The specified class type. |
513 | * \param pName The object name. |
514 | * \param pStartIndex The start index. |
515 | * \return The source object with the name, NULL if not found. |
516 | */ |
517 | FBX_DEPRECATED inline FbxObject* FindSrcObject(FbxClassId pClassId, const char* pName, int pStartIndex=0) const { return RootProperty.FindSrcObject(FbxCriteria::ObjectType(pClassId), pName, pStartIndex); } |
518 | |
519 | /** Disconnects this object from all source objects of the specified class type. |
520 | * \return \c true if it disconnects all source objects successfully, \c false otherwise. */ |
521 | template <class T> inline bool DisconnectAllSrcObject() { return RootProperty.DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId)); } |
522 | |
523 | /** Disconnects this object from all source objects that are of the specified class type and that satisfy the given criteria. |
524 | * \param pCriteria The given criteria. |
525 | * \return \c true if it disconnects all source objects successfully, \c false otherwise. */ |
526 | template <class T> inline bool DisconnectAllSrcObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } |
527 | |
528 | /** Returns the number of source objects of a specific class type with which this object connects. |
529 | * \return The number of source objects of the specified class type with which this object connects. */ |
530 | template <class T> inline int GetSrcObjectCount() const { return RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId)); } |
531 | |
532 | /** Returns the number of source objects with which this object connects that are the specified class type and that satisfy the given criteria. |
533 | * \param pCriteria The given criteria. |
534 | * \return The number of source objects that are the specified class type and that satisfy the given criteria. */ |
535 | template <class T> inline int GetSrcObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetSrcObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } |
536 | |
537 | /** Returns the source object of the specified class type at the specified index. |
538 | * \param pIndex The specified index whose default value is 0. |
539 | * \return The source object of a specified class type at the specified index, NULL if not found. */ |
540 | template <class T> inline T* GetSrcObject(int pIndex=0) const { return (T*)RootProperty.GetSrcObject(FbxCriteria::ObjectType(T::ClassId), pIndex); } |
541 | |
542 | /** Returns the source object that is the specified class type and that satisfies the given criteria at the specified index. |
543 | * \param pCriteria The given criteria. |
544 | * \param pIndex The specified index whose default value is 0. |
545 | * \return The source object that is of the specified class type and that satisfies the given criteria at the specified index, NULL if not found. */ |
546 | template <class T> inline T* GetSrcObject(const FbxCriteria& pCriteria, int pIndex=0) const { return (T*)RootProperty.GetSrcObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); } |
547 | |
548 | /** Searches the source object with the specified name that is the specified class type, starting at the specified index. |
549 | * \param pName The object name. |
550 | * \param pStartIndex The start index. |
551 | * \return The source object with the name, NULL if not found. */ |
552 | template <class T> inline T* FindSrcObject(const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindSrcObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); } |
553 | |
554 | /** Searches the source object with the specified name that is the specified class type and that satisfies the given criteria, starting at the specified index. |
555 | * \param pCriteria The given criteria. |
556 | * \param pName The object name. |
557 | * \param pStartIndex The start index. |
558 | * \return The source object with the name, NULL if not found. */ |
559 | 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); } |
560 | |
561 | /** Connects this object to one destination object. |
562 | * \param pObject The destination object with which this object connects. |
563 | * \param pType The connection type between this object and the destination object. |
564 | * \return \c True on success, \c false otherwise. |
565 | */ |
566 | inline bool ConnectDstObject(FbxObject* pObject, FbxConnection::EType pType=FbxConnection::eNone) { return RootProperty.ConnectDstObject(pObject,pType); } |
567 | |
568 | /** Judges whether this object connects with the destination object. |
569 | * \param pObject The destination object. |
570 | * \return \c True if this object connects with the destination object, \c false otherwise. |
571 | */ |
572 | inline bool IsConnectedDstObject(const FbxObject* pObject) const { return RootProperty.IsConnectedDstObject(pObject); } |
573 | |
574 | /** Disconnects this object from the destination object. |
575 | * \param pObject The destination object from which this object disconnects. |
576 | * \return \c True on success, \c false otherwise. |
577 | */ |
578 | inline bool DisconnectDstObject(FbxObject* pObject) { return RootProperty.DisconnectDstObject(pObject); } |
579 | |
580 | /** Disconnects this object from all destination objects. |
581 | * \return \c True if it disconnects all destination objects successfully, \c false otherwise. |
582 | */ |
583 | inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(); } |
584 | |
585 | /** Disconnects this object from all destination objects that satisfy given criteria. |
586 | * \param pCriteria The given criteria. |
587 | * \return \c True if it disconnects all destination objects successfully, \c false otherwise. |
588 | */ |
589 | inline bool DisconnectAllDstObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllDstObject(pCriteria); } |
590 | |
591 | /** Disconnects this object from all destination objects of the specified class type. (Deprecated, please use DisconnectAllDstObject<Type>() instead.) |
592 | * \param pClassId The specified class type. |
593 | * \return \c True if it disconnects all destination objects of the specified class type successfully, \c false otherwise. |
594 | */ |
595 | FBX_DEPRECATED inline bool DisconnectAllDstObject(FbxClassId pClassId) { return RootProperty.DisconnectAllDstObject(FbxCriteria::ObjectType(pClassId)); } |
596 | |
597 | /** Returns the number of destination objects with which this object connects. |
598 | * \return The number of destination objects with which this object connects. |
599 | */ |
600 | inline int GetDstObjectCount() const { return RootProperty.GetDstObjectCount(); } |
601 | |
602 | /** Returns the number of destination objects with which this object connects that satisfy the given criteria. |
603 | * \param pCriteria The given criteria. |
604 | * \return The number of destination objects with which this object connects that satisfy the given criteria. |
605 | */ |
606 | inline int GetDstObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetDstObjectCount(pCriteria); } |
607 | |
608 | /** Returns the number of destination objects of the specified class type with which this object connects. (Deprecated, please use GetDstObjectCount<Type>() instead.) |
609 | * \param pClassId The specified class type. |
610 | * \return The number of destination objects of the specified class type with which this object connects. |
611 | */ |
612 | FBX_DEPRECATED inline int GetDstObjectCount(FbxClassId pClassId) const { return RootProperty.GetDstObjectCount(FbxCriteria::ObjectType(pClassId)); } |
613 | |
614 | /** Returns the destination object at the specified index with which this object connects. |
615 | * \param pIndex The specified index whose default value is 0. |
616 | * \return The destination object at the specified index, NULL if not found. |
617 | */ |
618 | inline FbxObject* GetDstObject(int pIndex=0) const { return RootProperty.GetDstObject(pIndex); } |
619 | |
620 | /** Returns the destination object with which this object connects that satisfies the given criteria at the specified index. |
621 | * \param pCriteria The given criteria. |
622 | * \param pIndex The specified index whose default value is 0. |
623 | * \return The destination object that satisfies the given criteria at the specified index, NULL if not found. |
624 | */ |
625 | inline FbxObject* GetDstObject(const FbxCriteria& pCriteria, int pIndex=0) const { return RootProperty.GetDstObject(pCriteria,pIndex); } |
626 | |
627 | /** Returns the destination object of the specified class type with which this object connects at the specified index. (Deprecated, please use GetDstObject<Type>() instead.) |
628 | * \param pClassId The specified class type. |
629 | * \param pIndex The specified index whose default value is 0. |
630 | * \return The destination object of the specified class type at the specified index, NULL if not found. |
631 | */ |
632 | FBX_DEPRECATED inline FbxObject* GetDstObject(FbxClassId pClassId, int pIndex=0) const { return RootProperty.GetDstObject(FbxCriteria::ObjectType(pClassId), pIndex); } |
633 | |
634 | /** Searches the destination object with the specified name, starting at the specified index. |
635 | * \param pName The object name. |
636 | * \param pStartIndex The start index. |
637 | * \return The destination object with the name, NULL if not found. |
638 | */ |
639 | inline FbxObject* FindDstObject(const char* pName, int pStartIndex=0) const { return RootProperty.FindDstObject(pName,pStartIndex); } |
640 | |
641 | /** Searches the destination object with the specified name which satisfies the given criteria, starting at the specified index. |
642 | * \param pCriteria The given criteria. |
643 | * \param pName The object name. |
644 | * \param pStartIndex The start index. |
645 | * \return The destination object with the name, NULL if not found. |
646 | */ |
647 | inline FbxObject* FindDstObject(const FbxCriteria& pCriteria, const char* pName, int pStartIndex=0) const { return RootProperty.FindDstObject(pCriteria,pName,pStartIndex); } |
648 | |
649 | /** Searches the destination object with the specified name which is the specified class type, starting at the specified index. (Deprecated, please use FindDstObject<Type>() instead.) |
650 | * \param pClassId The specified class type. |
651 | * \param pName The object name. |
652 | * \param pStartIndex The start index. |
653 | * \return The destination object with the name, NULL if not found. |
654 | */ |
655 | FBX_DEPRECATED inline FbxObject* FindDstObject(FbxClassId pClassId, const char* pName,int pStartIndex=0) const { return RootProperty.FindDstObject(FbxCriteria::ObjectType(pClassId), pName, pStartIndex); } |
656 | |
657 | /** Disconnects this object from all destination objects of the specified class type. |
658 | * \return \c true if it disconnects all destination objects of the specified class type successfully, \c false otherwise. */ |
659 | template <class T> inline bool DisconnectAllDstObject() { return RootProperty.DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId)); } |
660 | |
661 | /** Disconnects this object from all destination objects that are the specified class type and that satisfy the given criteria. |
662 | * \param pCriteria The given criteria. |
663 | * \return \c true if it disconnects all destination objects successfully, \c false otherwise. */ |
664 | template <class T> inline bool DisconnectAllDstObject(const FbxCriteria& pCriteria) { return RootProperty.DisconnectAllDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } |
665 | |
666 | /** Returns the number of destination objects of the specified class type with which this object connects. |
667 | * \return The number of destination objects of the specified class type with which this object connects. */ |
668 | template <class T> inline int GetDstObjectCount() const { return RootProperty.GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId)); } |
669 | |
670 | /** Returns the number of destination objects with which this object connects that are the specified class type and that satisfy the given criteria. |
671 | * \param pCriteria The given criteria. |
672 | * \return The number of destination objects that are the specified class type and that satisfy the given criteria. */ |
673 | template <class T> inline int GetDstObjectCount(const FbxCriteria& pCriteria) const { return RootProperty.GetDstObjectCount(FbxCriteria::ObjectType(T::ClassId) && pCriteria); } |
674 | |
675 | /** Returns the destination object with which this object connects that is the specified class type at the specified index. |
676 | * \param pIndex The specified index whose default value is 0. |
677 | * \return The destination object of the specified class type at the specified index, NULL if not found. */ |
678 | template <class T> inline T* GetDstObject(int pIndex=0) const { return (T*)RootProperty.GetDstObject(FbxCriteria::ObjectType(T::ClassId), pIndex); } |
679 | |
680 | /** Returns the destination object with which this object connects that is the specified class type and that satisfies the given criteria at the specified index. |
681 | * \param pCriteria The given criteria. |
682 | * \param pIndex The specified index whose default value is 0. |
683 | * \return The destination object that is the specified class type and that satisfies the given criteria at the specified index, NULL if not found. */ |
684 | template <class T> inline T* GetDstObject(const FbxCriteria& pCriteria, int pIndex=0) const { return (T*)RootProperty.GetDstObject(FbxCriteria::ObjectType(T::ClassId) && pCriteria, pIndex); } |
685 | |
686 | /** Searches the destination object with the specified name which is of the specified class type, starting at the specified index. |
687 | * \param pName The object name. |
688 | * \param pStartIndex The start index. |
689 | * \return The source object with the name, NULL if not found. */ |
690 | template <class T> inline T* FindDstObject(const char* pName, int pStartIndex=0) const { return (T*)RootProperty.FindDstObject(FbxCriteria::ObjectType(T::ClassId), pName, pStartIndex); } |
691 | |
692 | /** Searches the destination object with the specified name that is the specified class type and that satisfies the given criteria, starting at the specified index. |
693 | * \param pCriteria The given criteria. |
694 | * \param pName The object name. |
695 | * \param pStartIndex The start index. |
696 | * \return The source object with the name, NULL if not found. */ |
697 | 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); } |
698 | //@} |
699 | |
700 | /** |
701 | * \name Property Management |
702 | */ |
703 | //@{ |
704 | /** Returns the first property of this object. |
705 | * \return The first property of this object. |
706 | */ |
707 | inline FbxProperty GetFirstProperty() const |
708 | { |
709 | return RootProperty.GetFirstDescendent(); |
710 | } |
711 | |
712 | /** Returns the next property of this object that follows the specified property. |
713 | * \param pProperty The specified property. |
714 | * \return The next property of this object that follows pProperty. |
715 | */ |
716 | inline FbxProperty GetNextProperty(const FbxProperty& pProperty) const |
717 | { |
718 | return RootProperty.GetNextDescendent(pProperty); |
719 | } |
720 | |
721 | /** Searches a property by name. |
722 | * \param pName The property name. |
723 | * \param pCaseSensitive Whether the name is case-sensitive. |
724 | * \return A valid FbxProperty if found, else an invalid FbxProperty. See FbxProperty::IsValid() |
725 | */ |
726 | inline FbxProperty FindProperty(const char* pName, bool pCaseSensitive = true) const |
727 | { |
728 | return RootProperty.Find(pName, pCaseSensitive ); |
729 | } |
730 | |
731 | /** Searches a property by name and data type. |
732 | * \param pName The property name. |
733 | * \param pDataType The data type of the property. |
734 | * \param pCaseSensitive Whether the name is case-sensitive. |
735 | * \return A valid FbxProperty if the property is found, else an invalid FbxProperty. See FbxProperty::IsValid() |
736 | */ |
737 | inline FbxProperty FindProperty(const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const |
738 | { |
739 | return RootProperty.Find(pName, pDataType, pCaseSensitive ); |
740 | } |
741 | |
742 | /** Searches a property by full name. |
743 | * \param pName The full name of the property as a \c NULL terminated string. |
744 | * \param pCaseSensitive whether or not the name is case-sensitive. |
745 | * \return A valid FbxProperty if the property is found, else |
746 | * an invalid FbxProperty. See FbxProperty::IsValid() |
747 | */ |
748 | inline FbxProperty FindPropertyHierarchical(const char* pName, bool pCaseSensitive = true) const |
749 | { |
750 | return RootProperty.FindHierarchical(pName, pCaseSensitive ); |
751 | } |
752 | |
753 | /** Searches a property by full name and data type. |
754 | * \param pName The full name of the property as a \c NULL terminated string. |
755 | * \param pDataType The data type of the property. |
756 | * \param pCaseSensitive whether or not the name is case-sensitive. |
757 | * \return A valid FbxProperty if the property is found, else |
758 | * an invalid FbxProperty. See FbxProperty::IsValid() |
759 | */ |
760 | inline FbxProperty FindPropertyHierarchical(const char* pName, const FbxDataType& pDataType, bool pCaseSensitive = true) const |
761 | { |
762 | return RootProperty.FindHierarchical(pName, pDataType, pCaseSensitive ); |
763 | } |
764 | |
765 | /** Returns the class root property. |
766 | * \return The class root property if it exists, else an invalid FbxProperty. See FbxProperty::IsValid(). |
767 | * \remarks Class FbxObject and its sub-classes all have a class root property. This class root property contains basic information about the class type, such as the class name. |
768 | */ |
769 | FbxProperty GetClassRootProperty(); |
770 | |
771 | /** Connects this object to a source property. |
772 | * \param pProperty The source property with which this object connects. |
773 | * \return \c True on success, \c false otherwise. |
774 | */ |
775 | inline bool ConnectSrcProperty(const FbxProperty& pProperty) { return RootProperty.ConnectSrcProperty(pProperty); } |
776 | |
777 | /** Determines whether this object connects with the specified source property. |
778 | * \param pProperty The specified source property. |
779 | * \return \c True if this object connects with the specified source property, \c false otherwise. |
780 | */ |
781 | inline bool IsConnectedSrcProperty(const FbxProperty& pProperty) { return RootProperty.IsConnectedSrcProperty(pProperty); } |
782 | |
783 | /** Disconnects this object from the specified source property. |
784 | * \param pProperty The specified source property. |
785 | * \return \c True on success, \c false otherwise. |
786 | */ |
787 | inline bool DisconnectSrcProperty(const FbxProperty& pProperty) { return RootProperty.DisconnectSrcProperty(pProperty); } |
788 | |
789 | /** Returns the number of source properties with which this object connects. |
790 | * \return The number of source properties with which this object connects. |
791 | */ |
792 | inline int GetSrcPropertyCount() const { return RootProperty.GetSrcPropertyCount(); } |
793 | |
794 | /** Returns the source property at the specified index with which this object connects. |
795 | * \param pIndex The specified index. |
796 | * \return The source property at the specified index. |
797 | */ |
798 | inline FbxProperty GetSrcProperty(int pIndex=0) const { return RootProperty.GetSrcProperty(pIndex); } |
799 | |
800 | /** Searches a source property with which this object connects that has a specific name, starting at the specified index. |
801 | * \param pName The specified property name. |
802 | * \param pStartIndex The start index. |
803 | * \return The source property with the specified name. |
804 | */ |
805 | inline FbxProperty FindSrcProperty(const char* pName,int pStartIndex=0) const { return RootProperty.FindSrcProperty(pName,pStartIndex); } |
806 | |
807 | /** Connects this object to a destination property. |
808 | * \param pProperty The destination property with which this object connects. |
809 | * \return \c True on success, \c false otherwise. |
810 | */ |
811 | inline bool ConnectDstProperty(const FbxProperty& pProperty) { return RootProperty.ConnectDstProperty(pProperty); } |
812 | |
813 | /** Determines if this object connects with the specified destination property. |
814 | * \param pProperty The specified destination property. |
815 | * \return \c True if this object connects with the specified destination property, \c false otherwise. |
816 | */ |
817 | inline bool IsConnectedDstProperty(const FbxProperty& pProperty) { return RootProperty.IsConnectedDstProperty(pProperty); } |
818 | |
819 | /** Disconnects this object from the specified destination property. |
820 | * \param pProperty The specified destination property. |
821 | * \return \c True on success, \c false otherwise. |
822 | */ |
823 | inline bool DisconnectDstProperty(const FbxProperty& pProperty) { return RootProperty.DisconnectDstProperty(pProperty); } |
824 | |
825 | /** Returns the number of destination properties with which this object connects. |
826 | * \return The number of destination properties with which this object connects. |
827 | */ |
828 | inline int GetDstPropertyCount() const { return RootProperty.GetDstPropertyCount(); } |
829 | |
830 | /** Returns the destination property at the specified index with which this object connects. |
831 | * \param pIndex The specified index. |
832 | * \return The destination property at the specified index. |
833 | */ |
834 | inline FbxProperty GetDstProperty(int pIndex=0) const { return RootProperty.GetDstProperty(pIndex); } |
835 | |
836 | /** Searches a destination property with which this object connects that has a specific name, starting at the specified index. |
837 | * \param pName The specified property name. |
838 | * \param pStartIndex The start index. |
839 | * \return The destination property with the specified name. |
840 | */ |
841 | inline FbxProperty FindDstProperty(const char* pName, int pStartIndex=0) const { return RootProperty.FindDstProperty(pName,pStartIndex); } |
842 | //@} |
843 | |
844 | /** |
845 | * \name Off-Loading Management |
846 | * \remarks You can modify the unloaded state flag using the SetObjectFlags() |
847 | * method. The ContentIsUnloaded() method below (implemented in this class) |
848 | * is simply a synonym of GetObjectFlags(eCONTENT_UNLOADED_FLAG) |
849 | */ |
850 | //@{ |
851 | /** Unloads this object's content using the offload peripheral that is currently set in the document |
852 | * then flushes it from memory. |
853 | * \return 2 if the object's content is already unloaded or 1 if |
854 | * this object's content has been successfully unloaded to the current |
855 | * peripheral. |
856 | * |
857 | * \remarks If the content is locked more than once, or the peripheral cannot handle |
858 | * this object's unloading, or if an error occurs, this method returns 0 and does not flush the content. |
859 | */ |
860 | int ContentUnload(); |
861 | |
862 | /** Loads this object's content using the offload peripheral that is currently set in the document. |
863 | * \return 1 if this object's content has been successfully loaded from the current |
864 | * peripheral, 2 if the content is already loaded, and 0 if an error occurs or |
865 | * the object's content is locked. |
866 | * \remarks On a successful Load attempt, the object content is locked. |
867 | */ |
868 | int ContentLoad(); |
869 | |
870 | /** Judges if this object's content is loaded. |
871 | * \return \c True if this object's content is loaded, \c false otherwise. |
872 | * \remarks An object that has not been filled yet must be considered |
873 | * unloaded. |
874 | */ |
875 | bool ContentIsLoaded() const; |
876 | |
877 | /** Decreases the content lock count of an object. If the content lock count of an object |
878 | * is greater than 0, the content of the object is considered locked. |
879 | */ |
880 | void ContentDecrementLockCount(); |
881 | |
882 | /** Increases the content lock count of an object. If the content lock count of an object |
883 | * is greater than 0, the content of the object is considered locked. |
884 | */ |
885 | void ContentIncrementLockCount(); |
886 | |
887 | /** Judges if this object's content is locked. The content is considered locked if the content lock count |
888 | * is greater than 0 |
889 | * \return \c True if this object's content is locked, \c false otherwise. |
890 | * \remarks A locked state prevents the object content from being unloaded from memory but |
891 | * does not block the loading. |
892 | */ |
893 | bool ContentIsLocked() const; |
894 | |
895 | /** Writes the content of the object to the given stream. |
896 | * \param pStream The destination stream. |
897 | * \return \c True if the content is successfully processed |
898 | * by the receiving stream, \c false otherwise. |
899 | */ |
900 | virtual bool ContentWriteTo(FbxStream& pStream) const; |
901 | |
902 | /** Reads the content of the object from the given stream. |
903 | * \param pStream The source stream. |
904 | * \return \c True if the object fills itself with the received data |
905 | * from the stream successfully, \c false otherwise. |
906 | */ |
907 | virtual bool ContentReadFrom(const FbxStream& pStream); |
908 | //@} |
909 | |
910 | /** |
911 | * \name Logging. |
912 | */ |
913 | //@{ |
914 | /** Emits a message in all available message emitters in the document or SDK manager. |
915 | * \param pMessage The message to emit. |
916 | * \remarks The ownership of the message is transferred, don't delete it. |
917 | */ |
918 | void EmitMessage(FbxMessage* pMessage) const; |
919 | //@} |
920 | |
921 | /** |
922 | * \name Localization helper. |
923 | */ |
924 | //@{ |
925 | /** Localization helper function, it calls the implementation of FBX SDK manager. |
926 | * Sub-classes that manage their own localization could over-ride this function. |
927 | * \param pID The identifier of the text to be localized. |
928 | * \param pDefault The default text. Uses pID as the default text if pDefault is NULL. |
929 | * \return The localized text or the default text if the text can't be localized, . |
930 | */ |
931 | virtual const char* Localize(const char* pID, const char* pDefault=NULL) const; |
932 | //@} |
933 | |
934 | /** |
935 | * \name Application Implementation Management |
936 | */ |
937 | //@{ |
938 | /** Returns a handle on the parent library of this object. |
939 | * \return The parent library of this object, or \c NULL if the parent library doesn't exist. |
940 | */ |
941 | FbxLibrary* GetParentLibrary() const; |
942 | |
943 | /** Adds an implementation. |
944 | * \param pImplementation The implementation to be added. |
945 | * \return \c True on success, \c false otherwise. |
946 | * \remarks To succeed this function must be called with an implementation that has not already been added to this node. |
947 | */ |
948 | bool AddImplementation(FbxImplementation* pImplementation); |
949 | |
950 | /** Removes an implementation. |
951 | * \param pImplementation The implementation to be removed. |
952 | * \return \c True on success, \c false otherwise. |
953 | * \remarks To succeed this function must be called with an implementation that has already been added to this node. |
954 | */ |
955 | bool RemoveImplementation(FbxImplementation* pImplementation); |
956 | |
957 | /** Determines if this shading node has a default implementation. |
958 | * \return \c True if this shading node has a default implementation, \c false otherwise. |
959 | */ |
960 | bool HasDefaultImplementation(void) const; |
961 | |
962 | /** Returns the default implementation of this shading node. |
963 | * \return The default implementation of this shading node. |
964 | */ |
965 | FbxImplementation* GetDefaultImplementation(void) const; |
966 | |
967 | /** Sets the default implementation of this shading node. |
968 | * \param pImplementation The implementation to be set. |
969 | * \return \c True on success, \c false otherwise. |
970 | * \remarks To succeed this function must be called with an implementation that has already been added to this node. |
971 | * Only the implementation which has already been added can be set as the default implementation. |
972 | */ |
973 | bool SetDefaultImplementation(FbxImplementation* pImplementation); |
974 | |
975 | /** Returns the number of implementations that satisfy a given criteria. |
976 | * \param pCriteria The given criteria. |
977 | * \returns The number of implementations. |
978 | */ |
979 | int GetImplementationCount(const FbxImplementationFilter* pCriteria=NULL) const; |
980 | |
981 | /** Returns the implementation at the specified index that satisfies the given criteria. |
982 | * \param pIndex The specified index. |
983 | * \param pCriteria The given criteria. |
984 | * \return The implementation at the specified index, NULL if not found. |
985 | */ |
986 | FbxImplementation* GetImplementation(int pIndex, const FbxImplementationFilter* pCriteria=NULL) const; |
987 | //@} |
988 | |
989 | /** |
990 | * \name Object Storage && Retrieval |
991 | */ |
992 | //@{ |
993 | /** Returns the URL of this object. |
994 | * \return The URL of this object. |
995 | * \remarks The URL indicates where the object is stored. |
996 | */ |
997 | virtual FbxString GetUrl() const; |
998 | |
999 | /** Sets the URL of this object. |
1000 | * \param pUrl The URL to be set. |
1001 | * \return \c True on success, \c false otherwise. |
1002 | * \remarks The URL indicates where the object is stored. |
1003 | */ |
1004 | virtual bool SetUrl(char* pUrl); |
1005 | //@} |
1006 | |
1007 | /** \name Run-time ClassId Management */ |
1008 | //@{ |
1009 | /** Set the run-time ClassId for this class. In most contexts, users do not have to change the run-time ClassId, they are automatically generated when registered a new class during run-time. |
1010 | * \param pClassId The ClassId to set as the run-time ClassId for this object. */ |
1011 | void SetRuntimeClassId(const FbxClassId& pClassId); |
1012 | |
1013 | /** Retrieve the run-time ClassId for this object. |
1014 | * \return The run-time ClassId for this object. */ |
1015 | FbxClassId GetRuntimeClassId() const; |
1016 | |
1017 | /** Test if this class is a hierarchical children of the specified class type. This test will be performed on the run-time class registered with the FBX SDK Manager rather than the static ClassId generated at compile time. |
1018 | * \param pClassId The class type to test against self. |
1019 | * \return True if the object is a hierarchical children of the type specified. |
1020 | * \remarks This function will perform a complete search until it reaches the top level class, but it will stop as soon as one ClassId matches the test. */ |
1021 | bool IsRuntime(const FbxClassId& pClassId) const; |
1022 | |
1023 | /** Find out if the ClassId was registered during run-time rather than at compile time. |
1024 | * \return True if the run-time ClassId is inequal to the ClassId. */ |
1025 | bool IsRuntimePlug() const; |
1026 | //@} |
1027 | |
1028 | /** Compact the memory used by this object. |
1029 | * \remark Note that this function might not result in saved memory because it depends if the sub-class implements it, or if any memory can actually be saved. */ |
1030 | virtual void Compact(); |
1031 | |
1032 | //! The root property that holds all children property for this object |
1033 | FbxProperty RootProperty; |
1034 | |
1035 | protected: |
1036 | /** Optional constructor override, automatically called by default constructor. |
1037 | * \param pFrom If not null, the function must take it into account like a copy constructor. |
1038 | * \remark In case it is decided to override this function, do not forget to call ParentClass::Construct(pFrom) at the beginning. */ |
1039 | virtual void Construct(const FbxObject* pFrom); |
1040 | |
1041 | /** Optional property constructor override, automatically called by default constructor. |
1042 | * \param pForceSet If the property value must be set regardless of default value. |
1043 | * \remark If your object have properties, they must be initialized in this function. */ |
1044 | virtual void ConstructProperties(bool pForceSet); |
1045 | |
1046 | /** Optional destructor override, automatically called by default destructor. |
1047 | * \param pRecursive If true, children objects should be destroyed as well. |
1048 | * \remark In case it is decided to override this function, do not forget to call ParentClass::Destruct(pResursive) at the end. */ |
1049 | virtual void Destruct(bool pRecursive); |
1050 | |
1051 | /** Clears this object's content from memory. This method must be overridden in the derived classes. |
1052 | * \remark This method is called by ContentUnload() if the object content's unloading is successful. */ |
1053 | virtual void ContentClear(); |
1054 | |
1055 | /** Retrieves the peripheral of that object. |
1056 | * \return The current peripheral for that object |
1057 | * \remark A peripheral manipulates the content of an object. For instance, a peripheral can load the connections of an object on demand. */ |
1058 | virtual FbxPeripheral* GetPeripheral(); |
1059 | |
1060 | /***************************************************************************************************************************** |
1061 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
1062 | *****************************************************************************************************************************/ |
1063 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1064 | public: |
1065 | virtual bool Compare(FbxObject* pOtherObject); |
1066 | |
1067 | //Basic comparison operator implementation. It simply compare property values between source and target. |
1068 | //NOTE: If a property cannot be found on one of the object, the comparison fails (return false). |
1069 | //Different classid will fail comparison as well as different property count. Reference properties are not compared. |
1070 | bool operator==(const FbxObject& pObject); |
1071 | bool operator!=(const FbxObject& pObject); |
1072 | |
1073 | virtual void SetDocument(FbxDocument* pDocument); |
1074 | |
1075 | inline FbxPropertyHandle& GetPropertyHandle() { return RootProperty.mPropertyHandle; } |
1076 | |
1077 | //Important note: If this function is not implemented, the pFileSubTypeName string used when registering your |
1078 | //class via FbxManager::RegisterFbxClass will be used instead. This makes it useless to re-implement this |
1079 | //function if you do not intend to return a different string for the same class. |
1080 | virtual const char* GetTypeName() const; |
1081 | virtual FbxStringList GetTypeFlags() const; |
1082 | |
1083 | // This function will go as deep as possible to clear the Connection list without sending |
1084 | // notifications to the connections to give them the chance to Disconnect themselves. |
1085 | // This is a bypass of the intended workflow and should be used with care. |
1086 | void WipeAllConnections(); |
1087 | |
1088 | //Used as global flag to modify the behavior of FbxObject::Destruct() during a ForceKill() on the scene. This is for internal use. |
1089 | static void SetWipeMode(bool pState); |
1090 | static bool GetWipeMode(); |
1091 | |
1092 | protected: |
1093 | FbxObject(FbxManager& pManager, const char* pName); |
1094 | |
1095 | enum EPropertyNotifyType |
1096 | { |
1097 | ePropertySetRequest, |
1098 | ePropertySet, |
1099 | ePropertyGet |
1100 | }; |
1101 | |
1102 | virtual bool ConnectNotify(const FbxConnectEvent& pEvent); |
1103 | virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty); |
1104 | bool Copyable(const FbxObject& pObject); |
1105 | |
1106 | private: |
1107 | void CopyPropertiesFrom(const FbxObject& pFrom); |
1108 | void SetClassRootProperty(FbxProperty& lProperty); |
1109 | int GetFlatPropertyCount() const; |
1110 | |
1111 | FbxNameHandler mName; |
1112 | FbxClassId mRuntimeClassId; |
1113 | FbxUserDataRecord* mUserData; |
1114 | FbxManager* mManager; |
1115 | FbxImplementation* mDefaultImplementation; |
1116 | FbxUInt64 mUniqueID; |
1117 | FbxInt32 mObjectFlags; |
1118 | FbxInt32 mContentLockCount; |
1119 | FbxInt32 mUserDataCount; |
1120 | static bool mWipeMode; |
1121 | |
1122 | friend class FbxProperty; |
1123 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
1124 | }; |
1125 | |
1126 | /** A utility class for iterating over the properties (FbxProperty) of any FbxObject. |
1127 | * \nosubgrouping |
1128 | */ |
1129 | template<typename FbxProperty> class FbxIterator |
1130 | { |
1131 | public: |
1132 | /** Constructor. |
1133 | *\param pObject The object whose properties are going to be iterated. |
1134 | */ |
1135 | FbxIterator(const FbxObject* pObject) : mObject(pObject) {} |
1136 | |
1137 | /** Get the first property of the object. |
1138 | * \return The first property of the object. |
1139 | */ |
1140 | inline const FbxProperty& GetFirst() { mProperty = mObject->GetFirstProperty(); return mProperty; } |
1141 | |
1142 | /** Get next property of the object. |
1143 | * \return The next property of the object. |
1144 | */ |
1145 | inline const FbxProperty& GetNext() { mProperty = mObject->GetNextProperty(mProperty); return mProperty; } |
1146 | |
1147 | private: |
1148 | FbxProperty mProperty; |
1149 | const FbxObject* mObject; |
1150 | }; |
1151 | |
1152 | /** A utility class for iterating over source objects that connect to property (FbxProperty) or object (FbxObject). |
1153 | * \nosubgrouping |
1154 | */ |
1155 | class FbxIteratorSrcBase |
1156 | { |
1157 | public: |
1158 | /** |
1159 | * Constructor. |
1160 | * \param pProperty Property object. The iterator will iterate source objects that connect to it. |
1161 | * \param pClassId The class ID specifies the type of the source objects. |
1162 | */ |
1163 | inline FbxIteratorSrcBase(FbxProperty& pProperty,FbxClassId pClassId) : |
1164 | mProperty(pProperty), |
1165 | mClassId(pClassId), |
1166 | mSize(0), |
1167 | mIndex(-1) |
1168 | { |
1169 | ResetToBegin(); |
1170 | } |
1171 | |
1172 | /** |
1173 | * Constructor. |
1174 | * \param pObject FBX object. The iterator will iterate source objects that connect to it. |
1175 | * \param pClassId The class ID specifies the type of the source objects. |
1176 | */ |
1177 | inline FbxIteratorSrcBase(FbxObject* pObject,FbxClassId pClassId) : |
1178 | mProperty(pObject->RootProperty), |
1179 | mClassId(pClassId), |
1180 | mSize(0), |
1181 | mIndex(-1) |
1182 | { |
1183 | ResetToBegin(); |
1184 | } |
1185 | |
1186 | /** |
1187 | * Get the first source object that connects to the property or object. |
1188 | * \return The first source object. |
1189 | */ |
1190 | inline FbxObject* GetFirst() |
1191 | { |
1192 | ResetToBegin(); |
1193 | return GetNext(); |
1194 | } |
1195 | |
1196 | /** |
1197 | * Get next source object that connects to the property or object. |
1198 | * \return The next source object. If there are no more objects, return NULL. |
1199 | */ |
1200 | inline FbxObject* GetNext() |
1201 | { |
1202 | mIndex++; |
1203 | return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(FbxCriteria::ObjectType(mClassId), mIndex) : NULL; |
1204 | } |
1205 | |
1206 | /** |
1207 | * Get next source object that connects to the property or object. |
1208 | * \return The next source object. If there are no more objects, return NULL. |
1209 | * \remark This method makes sure the iterate index is not out of bounds. |
1210 | */ |
1211 | inline FbxObject* GetSafeNext() |
1212 | { |
1213 | mSize = mProperty.GetSrcObjectCount(FbxCriteria::ObjectType(mClassId)); |
1214 | return GetNext(); |
1215 | } |
1216 | |
1217 | /** |
1218 | * Get the last source object that connects to the property or object. |
1219 | * \return The last source object. |
1220 | */ |
1221 | inline FbxObject* GetLast() |
1222 | { |
1223 | ResetToEnd(); |
1224 | return GetPrevious(); |
1225 | } |
1226 | |
1227 | /** |
1228 | * Get previous source object that connects to the property or object. |
1229 | * \return The previous source object. If there are no more objects, return NULL. |
1230 | */ |
1231 | inline FbxObject* GetPrevious() |
1232 | { |
1233 | mIndex--; |
1234 | return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetSrcObject(FbxCriteria::ObjectType(mClassId), mIndex) : NULL; |
1235 | } |
1236 | |
1237 | /** |
1238 | * Get previous source object that connects to the property or object. |
1239 | * \return The previous source object. If there are no more objects, return NULL. |
1240 | * \remark This method makes sure the iterate index is not out of bounds. |
1241 | * If the iterate index is out of bounds, the last source object is returned. |
1242 | */ |
1243 | inline FbxObject* GetSafePrevious() |
1244 | { |
1245 | mSize = mProperty.GetSrcObjectCount(FbxCriteria::ObjectType(mClassId)); |
1246 | while (mIndex>mSize) mIndex--; |
1247 | return GetPrevious(); |
1248 | } |
1249 | |
1250 | protected: |
1251 | /** |
1252 | * Reset the iterate index to the beginning. |
1253 | */ |
1254 | inline void ResetToBegin() |
1255 | { |
1256 | mSize = mProperty.GetSrcObjectCount(FbxCriteria::ObjectType(mClassId)); |
1257 | mIndex = -1; |
1258 | } |
1259 | |
1260 | /** |
1261 | * Reset the iterate index to the end. |
1262 | */ |
1263 | inline void ResetToEnd() |
1264 | { |
1265 | mSize = mProperty.GetSrcObjectCount(FbxCriteria::ObjectType(mClassId)); |
1266 | mIndex = mSize; |
1267 | } |
1268 | |
1269 | FbxProperty mProperty; //! The property to iterate. If iterate an object, this is the root property of the object. |
1270 | FbxClassId mClassId; //! The class ID specifies the type of the source objects to be retrieved. |
1271 | int mSize; //! The number of source objects whose type is specified by mClassId. |
1272 | int mIndex; //! Iterate index. |
1273 | }; |
1274 | |
1275 | /** |
1276 | * A utility class for iterating over source objects that connect to property (FbxProperty) or object (FbxObject). |
1277 | * The class is a wrapper of FbxIteratorSrcBase with template. |
1278 | * \nosubgrouping |
1279 | */ |
1280 | template<class Type> class FbxIteratorSrc : protected FbxIteratorSrcBase |
1281 | { |
1282 | public: |
1283 | /** |
1284 | * Constructor. |
1285 | * \param pObject FBX object. The iterator will iterate source objects that connect to it. |
1286 | */ |
1287 | inline FbxIteratorSrc(FbxObject* pObject) : FbxIteratorSrcBase(pObject,Type::ClassId) {} |
1288 | |
1289 | /** |
1290 | * Constructor. |
1291 | * \param pProperty Property object. The iterator will iterate source objects that connect to it. |
1292 | */ |
1293 | inline FbxIteratorSrc(FbxProperty& pProperty) : FbxIteratorSrcBase(pProperty,Type::ClassId) {} |
1294 | |
1295 | /** |
1296 | * Get the first source object that connects to the property or object. |
1297 | * \return The first source object. |
1298 | */ |
1299 | inline Type* GetFirst() { return (Type*)FbxIteratorSrcBase::GetFirst(); } |
1300 | |
1301 | /** |
1302 | * Get next source object that connects to the property or object. |
1303 | * \return The next source object. If there are no more objects, return NULL. |
1304 | */ |
1305 | inline Type* GetNext() { return (Type*)FbxIteratorSrcBase::GetNext(); } |
1306 | |
1307 | /** |
1308 | * Get next source object that connects to the property or object. |
1309 | * \return The next source object. If there are no more objects, return NULL. |
1310 | * \remark This method makes sure the iterate index is not out of bounds. |
1311 | */ |
1312 | inline Type* GetSafeNext() { return (Type*)FbxIteratorSrcBase::GetSafeNext(); } |
1313 | |
1314 | /** |
1315 | * Get the last source object that connects to the property or object. |
1316 | * \return The last source object. |
1317 | */ |
1318 | inline Type* GetLast() { return (Type*)FbxIteratorSrcBase::GetLast(); } |
1319 | |
1320 | |
1321 | /** |
1322 | * Get previous source object that connects to the property or object. |
1323 | * \return The previous source object. If there are no more objects, return NULL. |
1324 | */ |
1325 | inline Type* GetPrevious() { return (Type*)FbxIteratorSrcBase::GetPrevious(); } |
1326 | |
1327 | /** |
1328 | * Get previous source object that connects to the property or object. |
1329 | * \return The previous source object. If there are no more objects, return NULL. |
1330 | * \remark This method makes sure the iterate index is not out of bounds. |
1331 | * If the iterate index is out of bounds, the last source object is returned. |
1332 | */ |
1333 | inline Type* GetSafePrevious() { return (Type*)FbxIteratorSrcBase::GetSafePrevious(); } |
1334 | }; |
1335 | |
1336 | /** A utility class for iterating over destination objects that connect to property (FbxProperty) or object (FbxObject). |
1337 | * \nosubgrouping |
1338 | */ |
1339 | class FbxIteratorDstBase |
1340 | { |
1341 | protected: |
1342 | /** The property to iterate. If iterate an object, this is the root property of the object. */ |
1343 | FbxProperty mProperty; |
1344 | /** The class ID specifies the type of the destination objects to be retrieved. */ |
1345 | FbxClassId mClassId; |
1346 | /** The number of destination objects whose type is specified by mClassId. */ |
1347 | int mSize; |
1348 | /** Iterate index. */ |
1349 | int mIndex; |
1350 | |
1351 | public: |
1352 | /** |
1353 | * Constructor. |
1354 | * \param pProperty Property object. The iterator will iterate destination objects that connect to it. |
1355 | * \param pClassId The class ID specifies the type of the destination objects. |
1356 | */ |
1357 | inline FbxIteratorDstBase(FbxProperty& pProperty,FbxClassId pClassId) : |
1358 | mProperty(pProperty), |
1359 | mClassId(pClassId), |
1360 | mSize(0), |
1361 | mIndex(-1) |
1362 | { |
1363 | ResetToBegin(); |
1364 | } |
1365 | |
1366 | /** |
1367 | * Constructor. |
1368 | * \param pObject FBX object. The iterator will iterate source objects that connect to it. |
1369 | * \param pClassId The class ID specifies the type of the source objects. |
1370 | */ |
1371 | inline FbxIteratorDstBase(FbxObject* pObject,FbxClassId pClassId) : |
1372 | mProperty(pObject->RootProperty), |
1373 | mClassId(pClassId), |
1374 | mSize(0), |
1375 | mIndex(-1) |
1376 | { |
1377 | ResetToBegin(); |
1378 | } |
1379 | |
1380 | /** |
1381 | * Get the first destination object that connects to the property or object. |
1382 | * \return The first destination object. |
1383 | */ |
1384 | inline FbxObject* GetFirst() |
1385 | { |
1386 | ResetToBegin(); |
1387 | return GetNext(); |
1388 | } |
1389 | |
1390 | /** |
1391 | * Get next destination object that connects to the property or object. |
1392 | * \return The next destination object. If there are no more objects, return NULL. |
1393 | */ |
1394 | inline FbxObject* GetNext() |
1395 | { |
1396 | mIndex++; |
1397 | return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(FbxCriteria::ObjectType(mClassId), mIndex) : NULL; |
1398 | } |
1399 | |
1400 | /** |
1401 | * Get next destination object that connects to the property or object. |
1402 | * \return The next destination object. If there are no more objects, return NULL. |
1403 | * \remark This method makes sure the iterate index is not out of bounds. |
1404 | */ |
1405 | inline FbxObject* GetSafeNext() |
1406 | { |
1407 | mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId)); |
1408 | return GetNext(); |
1409 | } |
1410 | |
1411 | /** |
1412 | * Get the last destination object that connects to the property or object. |
1413 | * \return The last destination object. |
1414 | */ |
1415 | inline FbxObject* GetLast() |
1416 | { |
1417 | ResetToEnd(); |
1418 | return GetPrevious(); |
1419 | } |
1420 | |
1421 | /** |
1422 | * Get previous destination object that connects to the property or object. |
1423 | * \return The previous destination object. If there are no more objects, return NULL. |
1424 | */ |
1425 | inline FbxObject* GetPrevious() |
1426 | { |
1427 | mIndex--; |
1428 | return ((mIndex>=0) && (mIndex<mSize)) ? mProperty.GetDstObject(FbxCriteria::ObjectType(mClassId), mIndex) : NULL; |
1429 | } |
1430 | |
1431 | /** |
1432 | * Get previous destination object that connects to the property or object. |
1433 | * \return The previous destination object. If there are no more objects, return NULL. |
1434 | * \remark This method makes sure the iterate index is not out of bounds. |
1435 | * If the iterate index is out of bounds, the last destination object is returned. |
1436 | */ |
1437 | inline FbxObject* GetSafePrevious() |
1438 | { |
1439 | mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId)); |
1440 | while (mIndex>mSize) mIndex--; |
1441 | return GetPrevious(); |
1442 | } |
1443 | |
1444 | protected: |
1445 | /** |
1446 | * Reset the iterate index to the beginning. |
1447 | */ |
1448 | inline void ResetToBegin() |
1449 | { |
1450 | mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId)); |
1451 | mIndex = -1; |
1452 | } |
1453 | |
1454 | /** |
1455 | * Reset the iterate index to the end. |
1456 | */ |
1457 | inline void ResetToEnd() |
1458 | { |
1459 | mSize = mProperty.GetDstObjectCount(FbxCriteria::ObjectType(mClassId)); |
1460 | mIndex = mSize; |
1461 | } |
1462 | }; |
1463 | |
1464 | /** |
1465 | * A utility class for iterating over destination objects that connect to property (FbxProperty) or object (FbxObject). |
1466 | * The class is a wrapper of FbxIteratorDstBase with template. |
1467 | * \nosubgrouping |
1468 | */ |
1469 | template<class Type> class FbxIteratorDst : protected FbxIteratorDstBase |
1470 | { |
1471 | public: |
1472 | /** |
1473 | * Constructor. |
1474 | * \param pObject FBX object. The iterator will iterate destination objects that connect to it. |
1475 | */ |
1476 | inline FbxIteratorDst(FbxObject* pObject) : FbxIteratorDstBase(pObject,Type::ClassId) {} |
1477 | |
1478 | /** |
1479 | * Constructor. |
1480 | * \param pProperty Property object. The iterator will iterate destination objects that connect to it. |
1481 | */ |
1482 | inline FbxIteratorDst(FbxProperty& pProperty) : FbxIteratorDstBase(pProperty,Type::ClassId) {} |
1483 | |
1484 | /** |
1485 | * Get the first destination object that connects to the property or object. |
1486 | * \return The first destination object. |
1487 | */ |
1488 | inline Type* GetFirst() { return (Type*)FbxIteratorDstBase::GetFirst(); } |
1489 | |
1490 | /** |
1491 | * Get next destination object that connects to the property or object. |
1492 | * \return The next destination object. If there are no more objects, return NULL. |
1493 | */ |
1494 | inline Type* GetNext() { return (Type*)FbxIteratorDstBase::GetNext(); } |
1495 | |
1496 | /** |
1497 | * Get next destination object that connects to the property or object. |
1498 | * \return The next destination object. If there are no more objects, return NULL. |
1499 | * \remark This method makes sure the iterate index is not out of bounds. |
1500 | */ |
1501 | inline Type* GetSafeNext() { return (Type*)FbxIteratorDstBase::GetSafeNext(); } |
1502 | |
1503 | /** |
1504 | * Get the last destination object that connects to the property or object. |
1505 | * \return The last destination object. |
1506 | */ |
1507 | inline Type* GetLast() { return (Type*)FbxIteratorDstBase::GetLast(); } |
1508 | |
1509 | /** |
1510 | * Get previous destination object that connects to the property or object. |
1511 | * \return The previous destination object. If there are no more objects, return NULL. |
1512 | */ |
1513 | inline Type* GetPrevious() { return (Type*)FbxIteratorDstBase::GetPrevious(); } |
1514 | |
1515 | /** |
1516 | * Get previous destination object that connects to the property or object. |
1517 | * \return The previous destination object. If there are no more objects, return NULL. |
1518 | * \remark This method makes sure the iterate index is not out of bounds. |
1519 | * If the iterate index is out of bounds, the last destination object is returned. |
1520 | */ |
1521 | inline Type* GetSafePrevious() { return (Type*)FbxIteratorDstBase::GetSafePrevious(); } |
1522 | }; |
1523 | |
1524 | /** Convert the class type parameter into a C class parameter for other function inputs. |
1525 | * Usage example: |
1526 | * \code |
1527 | * //Assuming MyCamera is a valid FbxCamera object |
1528 | * bool AreCamerasObject = MyCamera->Is<FbxObject>(); //Should return true :) |
1529 | * \endcode |
1530 | */ |
1531 | #define FBX_TYPE(class) ((const class*)0) |
1532 | |
1533 | /** Safe casting of FBX SDK objects into other FBX SDK class types. This cast will perform |
1534 | * the complete test to make sure the object inherits from the requested class type. This is |
1535 | * the equivalent of a dynamic_cast but much faster. |
1536 | * \param pObject The object to try to cast into T type. |
1537 | * \return A non-null pointer if the cast was successful. |
1538 | */ |
1539 | template <class T> inline T* FbxCast(FbxObject* pObject) |
1540 | { |
1541 | return pObject && pObject->Is<T>() ? (T*)pObject : 0; |
1542 | } |
1543 | |
1544 | /** Safe const casting of FBX SDK objects into other FBX SDK class types. This cast will perform |
1545 | * the complete test to make sure the object inherits from the requested class type. This is |
1546 | * the equivalent of a dynamic_cast but much faster. |
1547 | * \param pObject The object to try to cast into T type. |
1548 | * \return A non-null pointer if the cast was successful. |
1549 | */ |
1550 | template <class T> inline const T* FbxCast(const FbxObject* pObject) |
1551 | { |
1552 | return pObject && pObject->Is<T>() ? (const T*)pObject : 0; |
1553 | } |
1554 | |
1555 | //! Macro used to iterate over source or destination objects that connect to property (FbxProperty) or object (FbxObject). |
1556 | #define FbxForEach(Iterator, Object) for((Object)=(Iterator).GetFirst();(Object)!=0;(Object)=(Iterator).GetNext()) |
1557 | |
1558 | //! Macro used to reversely iterate over source or destination objects that connect to property (FbxProperty) or object (FbxObject) |
1559 | #define FbxForEachReverse(Iterator, Object) for(Object=(Iterator).GetLast();(Object)!=0;Object=(Iterator).GetPrevious()) |
1560 | |
1561 | /***************************************************************************************************************************** |
1562 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
1563 | *****************************************************************************************************************************/ |
1564 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
1565 | class FBXSDK_DLL FbxConnectEvent |
1566 | { |
1567 | public: |
1568 | enum EType |
1569 | { |
1570 | eConnectRequest, |
1571 | eConnect, |
1572 | eConnected, |
1573 | eDisconnectRequest, |
1574 | eDisconnect, |
1575 | eDisconnected |
1576 | }; |
1577 | |
1578 | enum EDirection |
1579 | { |
1580 | eSource, |
1581 | eDestination |
1582 | }; |
1583 | |
1584 | inline FbxConnectEvent(EType pType,EDirection pDir,FbxProperty *pSrc,FbxProperty *pDst) : |
1585 | mType(pType), |
1586 | mDirection(pDir), |
1587 | mSrc(pSrc), |
1588 | mDst(pDst) |
1589 | { |
1590 | } |
1591 | inline EType GetType() const { return mType; } |
1592 | inline EDirection GetDirection() const { return mDirection; } |
1593 | inline FbxProperty& GetSrc() const { return *mSrc; } |
1594 | inline FbxProperty& GetDst() const { return *mDst; } |
1595 | template <class T> inline T* GetSrcIfObject() const { return mSrc->IsRoot() ? FbxCast<T>(mSrc->GetFbxObject()) : (T*)0; } |
1596 | template <class T> inline T* GetDstIfObject() const { return mDst->IsRoot() ? FbxCast<T>(mDst->GetFbxObject()) : (T*)0; } |
1597 | |
1598 | private: |
1599 | EType mType; |
1600 | EDirection mDirection; |
1601 | FbxProperty* mSrc; |
1602 | FbxProperty* mDst; |
1603 | }; |
1604 | |
1605 | class FbxObjectPropertyChanged : public FbxEvent<FbxObjectPropertyChanged> |
1606 | { |
1607 | FBXSDK_EVENT_DECLARE(FbxObjectPropertyChanged); |
1608 | |
1609 | public: |
1610 | FbxObjectPropertyChanged(FbxProperty pProp) : mProp(pProp) {} |
1611 | FbxProperty mProp; |
1612 | }; |
1613 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
1614 | |
1615 | #include <fbxsdk/fbxsdk_nsend.h> |
1616 | |
1617 | #endif /* _FBXSDK_CORE_OBJECT_H_ */ |
1618 | |