FBX C++ API Reference
fbxcallbacks.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2019 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_FILEIO_CALLBACKS_H_
14 #define _FBXSDK_FILEIO_CALLBACKS_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 #include <fbxsdk/core/fbxclassid.h>
18 #include <fbxsdk/core/fbxobject.h>
19 
20 #include <fbxsdk/fbxsdk_nsbegin.h>
21 
22 #define FBXCALLBACK_FUNCTION(x) FbxHandle(x)
23 #define FBXCALLBACK_USERDATA(x) FbxHandle((void*)(x))
25 {
27 
28 public:
29  enum State {
30  eFailure = 0, // The callback function failed for whatever reason
31  eNotHandled = 1, // The callback function did not handled the data
32  eHandled = 2 // The callback function handled the data
33  };
34 
38  void SetDataHint(FbxClassId pDataHint);
39 
46  bool GetCallback(int pId, FbxHandle& pFunction, FbxHandle& pUserData);
47 
48 protected:
57  int AddCallback(FbxHandle pFunction, FbxHandle pUserData = FBXCALLBACK_USERDATA(nullptr));
58 
59  /*****************************************************************************************************************************
60  ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
61  *****************************************************************************************************************************/
62 #ifndef DOXYGEN_SHOULD_SKIP_THIS
63 protected:
64  FbxArray<FbxHandle> mCallbackFunctions;
65  FbxArray<FbxHandle> mUserData;
66  FbxClassId mDataHint;
67 
68  void Construct(const FbxObject* pFrom) override;
69  void Destruct(bool pRecursive) override;
70 #endif
71 };
72 
167 {
169 
170 public:
182  typedef FbxCallback::State (*ReadCBFunction)(void* pUserData, FbxClassId pDataHint,
183  const char* pFileName, const void* pFileBuffer, size_t pSizeInBytes);
184 
192  int RegisterReadFunction(ReadCBFunction pFunction, void* pUserData = nullptr);
193 
201  FbxCallback::State Trigger(const char* pFileName, const void* pFileBuffer, size_t pSizeInBytes);
202 
217  typedef FbxCallback::State (*WriteCBFunction)(void* pUserData, FbxClassId pDataHint,
218  const char* pFileName, const void** pFileBuffer, size_t* pSizeInBytes);
219 
227  int RegisterWriteFunction(WriteCBFunction pFunction, void* pUserData = nullptr);
228 
236  FbxCallback::State Trigger(const char* pFileName, const void** pFileBuffer, size_t* pSizeInBytes);
237 
238  /*****************************************************************************************************************************
239  ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
240  *****************************************************************************************************************************/
241 #ifndef DOXYGEN_SHOULD_SKIP_THIS
242 protected:
243  void Construct(const FbxObject* pFrom) override;
244 private:
245  int mReadFctId;
246  int mWriteFctId;
247 public:
248  FbxObject& Copy(const FbxObject& pObject) override;
249 #endif
250 };
251 
252 #include <fbxsdk/fbxsdk_nsend.h>
253 
254 #endif /* _FBXSDK_FILEIO_CALLBACKS_H_ */
#define FBXSDK_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new class derived from FbxObject.
Definition: fbxobject.h:61
Callback to operate on the embedded data while it is processed.
Definition: fbxcallbacks.h:166
FBX SDK environment definition.
virtual FbxObject & Copy(const FbxObject &pObject)
Copy an object content into this object.
The base class of most FBX objects.
Definition: fbxobject.h:157
#define FBXSDK_ABSTRACT_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new abstract class derived from FbxObject.
Definition: fbxobject.h:68
virtual void Construct(const FbxObject *pFrom)
Optional constructor override, automatically called by default constructor.
Internal class used to differentiate objects during run-time.
Definition: fbxclassid.h:39
#define FBXCALLBACK_USERDATA(x)
Definition: fbxcallbacks.h:23
#define FBXSDK_DLL
Definition: fbxarch.h:176
virtual void Destruct(bool pRecursive)
Optional destructor override, automatically called by default destructor.
Class for array of basic elements such as pointers and basic types.
Definition: fbxarray.h:37