FBX C++ API Reference
fbxcache.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_SCENE_GEOMETRY_CACHE_H_
14 #define _FBXSDK_SCENE_GEOMETRY_CACHE_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
18 #include <fbxsdk/core/fbxobject.h>
20 
21 #include <fbxsdk/fbxsdk_nsbegin.h>
22 
23 class FbxCache_internal;
24 
34 {
36 
37 public:
39 
40 
42  {
46  eAlembic
47  };
48 
52  void SetCacheFileFormat(EFileFormat pFileFormat, FbxStatus* pStatus=NULL);
53 
56  EFileFormat GetCacheFileFormat() const;
57 
62  void SetCacheFileName(const char* pRelativeFileName_UTF8, const char* pAbsoluteFileName_UTF8, FbxStatus* pStatus=NULL);
63 
67  void GetCacheFileName(FbxString& pRelativeFileName_UTF8, FbxString& pAbsoluteFileName_UTF8) const;
68 
72  bool OpenFileForRead(FbxStatus* pStatus=NULL);
73 
77  bool IsOpen(FbxStatus* pStatus=NULL) const;
78 
86  bool Read(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime, unsigned int pChannel=0);
87 
91  bool CloseFile(FbxStatus* pStatus=NULL);
92 
96  double GetSamplingFrameRate(FbxStatus* pStatus=NULL);
97 
101  FbxTime GetCacheTimePerFrame(FbxStatus* pStatus=NULL);
102 
106  int GetChannelCount(FbxStatus* pStatus=NULL);
107 
113  bool GetChannelName(int pChannelIndex, FbxString& pChannelName, FbxStatus* pStatus=NULL);
115 
117 
118  enum EMCFileCount
120  {
122  eMCOneFilePerFrame
123  };
124 
127  {
134  eFloatVectorArray
135  };
136 
139  {
141  eMCX
142  };
143 
146  {
148  eSamplingIrregular
149  };
150 
159  bool OpenFileForWrite(EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName, EMCBinaryFormat pBinaryFormat, EMCDataType pMCDataType=eDoubleVectorArray, const char* pInterpretation="Points", FbxStatus* pStatus=NULL);
160 
170  bool AddChannel(const char* pChannelName, EMCDataType pMCDataType, const char* pInterpretation, unsigned int& pChannelIndex, FbxStatus* pStatus=NULL);
171 
177  bool GetChannelDataType(int pChannelIndex, EMCDataType& pChannelType, FbxStatus* pStatus=NULL);
178 
183  int GetChannelIndex(const char* pChannelName, FbxStatus* pStatus=NULL);
184 
192  bool Read(int pChannelIndex, FbxTime& pTime, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL);
193 
201  bool Read(int pChannelIndex, FbxTime& pTime, float* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL);
202 
210  bool Read(int pChannelIndex, FbxTime& pTime, int* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL);
211 
216  bool BeginWriteAt( FbxTime& pTime, FbxStatus* pStatus=NULL );
217 
228  bool Write(int pChannelIndex, FbxTime& pTime, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL);
229 
240  bool Write(int pChannelIndex, FbxTime& pTime, float* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL);
241 
252  bool Write(int pChannelIndex, FbxTime& pTime, int* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL);
253 
258  bool EndWriteAt(FbxStatus* pStatus=NULL);
259 
266  bool GetAnimationRange(int pChannelIndex, FbxTime &pTimeStart, FbxTime &pTimeEnd, FbxStatus* pStatus=NULL);
267 
272  bool GetCacheType(EMCFileCount& pFileCount, FbxStatus* pStatus=NULL);
273 
279  bool GetChannelInterpretation(int pChannelIndex, FbxString& pInterpretation, FbxStatus* pStatus=NULL);
280 
286  bool GetChannelSamplingType(int pChannelIndex, EMCSamplingType& pSamplingType, FbxStatus* pStatus=NULL);
287 
293  bool GetChannelSamplingRate(int pChannelIndex, FbxTime& pSamplingRate, FbxStatus* pStatus=NULL);
294 
300  bool GetChannelSampleCount(int pChannelIndex, unsigned int& pSampleCount, FbxStatus* pStatus=NULL);
301 
308  bool GetChannelPointCount(int pChannelIndex, FbxTime pTime, unsigned int& pPointCount, FbxStatus* pStatus=NULL);
309 
313  int GetCacheDataFileCount(FbxStatus* pStatus=NULL) const;
314 
321  bool GetCacheDataFileName(int pIndex, FbxString& pRelativeFileName, FbxString& pAbsoluteFileName, FbxStatus* pStatus=NULL);
322 
328  bool EnableMultiChannelFetching(bool pMultiChannelFetching, FbxStatus* pStatus=NULL);
329 
336  bool GetNextTimeWithData(FbxTime pCurTime, FbxTime& pNextTime, int pChannelIndex = -1, FbxStatus* pStatus=NULL);
337 
342  int GetDataCount(int pChannelIndex, FbxStatus* pStatus=NULL);
343 
350  bool GetDataTime(int pChannelIndex, unsigned int pDataIndex, FbxTime& pTime, FbxStatus* pStatus=NULL);
352 
354 
355 
362  bool OpenFileForWrite(double pFrameStartOffset, double pSamplingFrameRate, unsigned int pSampleCount, unsigned int pPointCount, FbxStatus* pStatus=NULL);
363 
368  unsigned int GetSampleCount(FbxStatus* pStatus=NULL);
369 
374  unsigned int GetPointCount(FbxStatus* pStatus=NULL);
375 
379  double GetFrameStartOffset(FbxStatus* pStatus=NULL);
380 
387  bool Read(unsigned int pFrameIndex, double* pBuffer, unsigned int pPointCount, FbxStatus* pStatus=NULL);
388 
395  bool Write(unsigned int pFrameIndex, double* pBuffer, FbxStatus* pStatus=NULL);
397 
399 
400 
407  bool ConvertFromPC2ToMC(EMCFileCount pFileCount, double pSamplingFrameRate, EMCBinaryFormat pBinaryFormat, FbxStatus* pStatus=NULL);
408 
415  bool ConvertFromMCToPC2(double pSamplingFrameRate, unsigned int pChannelIndex, FbxStatus* pStatus=NULL);
417 
418 /*****************************************************************************************************************************
419 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
420 *****************************************************************************************************************************/
421 #ifndef DOXYGEN_SHOULD_SKIP_THIS
422  enum EOpenFlag
423  {
424  eReadOnly,
425  eWriteOnly
426  };
427 
428 protected:
429  bool OpenFile(EOpenFlag pFlag, EMCFileCount pFileCount, double pSamplingFrameRate, const char* pChannelName, const char* pInterpretation, unsigned int pSampleCount, unsigned int pPointCount, double pFrameStartOffset, FbxStatus* pStatus, EMCDataType pMCDataType = eDoubleVectorArray, EMCBinaryFormat pBinaryFormat = eMCX);
430 
431  virtual void Construct( const FbxObject* pFrom );
432  virtual void ConstructProperties(bool pForceSet);
433  virtual void Destruct(bool pRecursive);
434 
435  FbxCache_internal* mData;
436 
437 private:
438  bool AllocateReadBuffer(unsigned int pTypeSize, unsigned int pTypeLength, unsigned int pLength, bool pAllocateConvertBuffer);
439  bool ReadMayaCache(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime, unsigned int pChannel);
440  bool ReadMaxCache(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime);
441  bool ReadAlembicCache(float** pBuffer, unsigned int& pBufferLength, const FbxTime& pTime, unsigned int pChannel);
442 
443  FbxPropertyT<FbxString> CacheFile;
444  FbxPropertyT<FbxString> CacheFileAbsolutePath;
445  FbxPropertyT<FbxEnum> CacheFileType;
446 
447  void* mReadBuffer;
448  unsigned int mReadBufferLength;
449  unsigned int mReadBufferSize;
450  unsigned int mReadTypeSize;
451  unsigned int mReadTypeLength;
452  unsigned int mReadLength;
453  void* mConvertBuffer;
454 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
455 };
456 
458 
459 #include <fbxsdk/fbxsdk_nsend.h>
460 
461 #endif /* _FBXSDK_SCENE_GEOMETRY_CACHE_H_ */
#define FBXSDK_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new class derived from FbxObject.
Definition: fbxobject.h:61
FBX SDK environment definition.
EMCFileCount
Number of files used to store the animation.
Definition: fbxcache.h:119
Regular sampling.
Definition: fbxcache.h:147
EFileFormat
Supported cache file formats.
Definition: fbxcache.h:41
#define NULL
Definition: fbxarch.h:210
Utility class to manipulate strings.
Definition: fbxstring.h:66
MCC cache file format, 32bit (older format)
Definition: fbxcache.h:140
3ds Max Point Cache 2 file format.
Definition: fbxcache.h:44
This class facilitates the testing/reporting of errors.
Definition: fbxstatus.h:26
EFbxType FbxTypeOf(const FbxCache::EFileFormat &)
Definition: fbxcache.h:457
EFbxType
Type identifier constants.
Class to encapsulate time units.
Definition: fbxtime.h:44
The base class of most FBX objects.
Definition: fbxobject.h:157
EMCDataType
Data types in the MC cache file.
Definition: fbxcache.h:126
EMCBinaryFormat
Binary cache format.
Definition: fbxcache.h:138
Unknown data.
Definition: fbxcache.h:128
virtual void Construct(const FbxObject *pFrom)
Optional constructor override, automatically called by default constructor.
Maya Cache file format.
Definition: fbxcache.h:45
Enumeration.
Unknown cache file format.
Definition: fbxcache.h:43
#define FBXSDK_DLL
Definition: fbxarch.h:173
EMCSamplingType
Cache channel sampling types.
Definition: fbxcache.h:145
virtual void Destruct(bool pRecursive)
Optional destructor override, automatically called by default destructor.
No use but has to be defined for consistency reasons.
Definition: fbxcache.h:129
One file is used for all the frames of animation.
Definition: fbxcache.h:121
virtual void ConstructProperties(bool pForceSet)
Optional property constructor override, automatically called by default constructor.
This object contains methods for accessing point animation in a cache file.
Definition: fbxcache.h:33