13 #ifndef _FBXSDK_FILEIO_FBX_IO_H_
14 #define _FBXSDK_FILEIO_FBX_IO_H_
132 #define FBX_FILE_VERSION_2000 2000 //FBX 2.0
133 #define FBX_FILE_VERSION_2001 2001 //FBX 2.01
134 #define FBX_FILE_VERSION_3000 3000 //FBX 3.0
135 #define FBX_FILE_VERSION_3001 3001 //FBX 3.01
136 #define FBX_FILE_VERSION_4000 4000 //FBX 4.0
137 #define FBX_FILE_VERSION_4001 4001 //FBX 4.01
138 #define FBX_FILE_VERSION_4050 4050 //FBX 4.5
139 #define FBX_FILE_VERSION_5000 5000 //FBX 5.0
140 #define FBX_FILE_VERSION_5800 5800 //FBX 5.8
141 #define FBX_FILE_VERSION_6000 6000 //FBX 6.0
142 #define FBX_FILE_VERSION_6100 6100 //FBX 6.1 (guarantee compatibility with Autodesk 2010 products)
143 #define FBX_FILE_VERSION_7000 7000 //Compatible with 7.1, and taken as such
144 #define FBX_FILE_VERSION_7099 7099 //Compatible with 7.1, and taken as such
145 #define FBX_FILE_VERSION_7100 7100 //FBX 7.1 (guarantee compatibility with Autodesk 2011 products)
146 #define FBX_FILE_VERSION_7200 7200 //FBX 7.2 (guarantee compatibility with Autodesk 2012 products)
147 #define FBX_FILE_VERSION_7300 7300 //FBX 7.3 (guarantee compatibility with Autodesk 2013 products)
148 #define FBX_FILE_VERSION_7400 7400 //FBX 7.4 (guarantee compatibility with Autodesk 2014/2015 products)
149 #define FBX_FILE_VERSION_7500 7500 //FBX 7.5 (guarantee compatibility with Autodesk 2016/2017/2018 products)
150 #define FBX_FILE_VERSION_7700 7700 //FBX 7.7 (guarantee compatibility with Autodesk 2019/2020 products)
152 #define FBX_FILE_VERSION_7600 7600 // Needed to support the few existing files generated with this version.
159 #define FBX_53_MB55_COMPATIBLE "FBX53_MB55"
160 #define FBX_60_COMPATIBLE "FBX60_MB60"
161 #define FBX_2005_08_COMPATIBLE "FBX200508_MB70"
162 #define FBX_2006_02_COMPATIBLE "FBX200602_MB75"
163 #define FBX_2006_08_COMPATIBLE "FBX200608"
164 #define FBX_2006_11_COMPATIBLE "FBX200611"
165 #define FBX_2009_00_COMPATIBLE "FBX200900"
166 #define FBX_2009_00_V7_COMPATIBLE "FBX200900v7"
167 #define FBX_2010_00_COMPATIBLE "FBX201000"
168 #define FBX_2011_00_COMPATIBLE "FBX201100"
169 #define FBX_2012_00_COMPATIBLE "FBX201200"
170 #define FBX_2013_00_COMPATIBLE "FBX201300"
171 #define FBX_2014_00_COMPATIBLE "FBX201400"
172 #define FBX_2016_00_COMPATIBLE "FBX201600"
173 #define FBX_2018_00_COMPATIBLE "FBX201800"
174 #define FBX_2019_00_COMPATIBLE "FBX201900"
175 #define FBX_2020_00_COMPATIBLE "FBX202000"
178 #define FBX_DEFAULT_FILE_VERSION FBX_FILE_VERSION_7700
179 #define FBX_DEFAULT_FILE_COMPATIBILITY FBX_2020_00_COMPATIBLE
262 virtual void Reset();
267 virtual bool ReadExtendedHeaderInformation(
FbxIO*);
445 bool ProjectOpenDirect(
const char* pName,
FbxReader* pReader,
bool pCheckCRC =
false,
bool pOpenMainSection =
true,
FbxIOFileHeaderInfo* pFileHeaderInfo =
NULL);
497 bool ProjectCreateEmpty(
const char* pName,
FbxWriter* pWriter,
int pVersion,
bool pBinary,
bool pEncrypted);
508 bool ProjectCreateEmpty(
FbxStream* pStream,
void* pStreamData,
FbxWriter* pWriter,
int pVersion,
bool pBinary,
bool pEncrypted);
513 bool ProjectWrite_BeginFileHeader();
518 bool ProjectWrite_BeginExtendedHeader();
529 bool ProjectWrite_EndExtendedHeader();
534 bool ProjectWrite_EndFileHeader();
542 bool ProjectClose(
void** pData=0,
size_t* pSize=0);
568 bool ProjectCreateEmbeddedFolder(
const FbxXRefManager& pXRefManager,
FbxString& pCreatedFolder,
const char* pUserDefinedFolder =
NULL);
573 void SetEmbedded(
bool pValue);
578 void SetEmbeddingExtractionFolder(
const char* pExtractionFolder);
582 const char* GetEmbeddingExtractionFolder();
587 bool IsEmbedded()
const;
592 bool IsBinary()
const;
597 bool IsEncrypted ()
const;
633 bool Fbx7Support()
const;
638 void Fbx7Support(
bool pSupport);
641 bool CompressArrays()
const;
646 void CompressArrays(
bool pCompress);
649 int CompressMinimumSize()
const;
654 void CompressMinimumSize(
int pSize);
657 int CompressLevel()
const;
664 void CompressLevel(
int pLevel);
676 bool ProjectOpenMainSection();
681 int ProjectGetExtensionSectionCount()
const;
687 bool ProjectOpenExtensionSection(
int pExtensionSectionIndex);
693 bool ProjectCreateExtensionSection(
bool pOverwriteLastExtensionSection =
false);
697 void ProjectCloseSection();
702 int ProjectGetCurrentSection()
const;
707 int ProjectGetCurrentSectionMode()
const;
712 int ProjectGetCurrentSectionVersion()
const;
721 int ProjectGetSectionVersion(
int pSection)
const;
729 static void ProjectConvertVersionNumber(
int pVersion,
int& pMajor,
int& pMinor,
int& pRevision);
734 bool IsPasswordProtected()
const;
741 bool CheckPassword(
const char* pPassword);
749 bool WritePassword(
const char* pPassword);
761 const char* GetFilename()
const;
767 FbxString GetDataDirectory(
bool pAutoCreate =
true);
777 FbxString GetMediaDirectory(
bool pCreate =
false,
const char* pUserDefinedFolder =
NULL);
784 FbxString GetContainerTemplateDirectory(
const char* pTemplateName,
bool pCreate);
790 char* GetRelativePath(
const char* pPath);
796 char* GetRelativeFilePath(
const char* pFilePath);
802 char* GetFullPath(
const char* pRelativePath);
808 char* GetFullFilePath(
const char* pRelativeFilePath);
814 char* GetTmpProjectName(
const char* pName)
const;
822 bool SwapFromTmpProject(
const char* pName,
char* pError=
NULL,
int pErrorSize=0);
834 void FieldReadResetPosition();
839 int FieldGetCount()
const;
845 const char* FieldGetName(
int pFieldIndex)
const;
851 int FieldGetInstanceCount(
const char* pFieldName)
const;
858 bool FieldReadBegin(
int pFieldIndex,
int pInstance);
864 bool FieldReadBegin(
const char* pFieldName);
871 bool FieldReadBegin(
const char* pFieldName,
int pInstance);
877 bool FieldReadIsBlock();
880 bool FieldReadBlockBegin();
883 void FieldReadBlockEnd();
886 int FieldReadGetCount()
const;
889 int FieldReadGetRemain()
const;
892 char FieldReadGetType()
const;
901 char FieldReadCH(
const char* pFieldName,
char pDefault=0);
904 const char* FieldReadC();
910 const char* FieldReadC(
const char* pFieldName,
const char* pDefault=
"");
913 const char* FieldReadS();
919 const char* FieldReadS(
const char* pFieldName,
const char* pDefault=
"");
928 bool FieldReadB(
const char* pFieldName,
bool pDefault =
false);
932 int FieldReadI(
const char* pFieldName,
int pDefault=0);
954 float FieldReadF(
const char* pFieldName,
float pDefault=0);
963 double FieldReadD(
const char* pFieldName,
double pDefault=0);
968 FbxTime FieldReadT(
const char* pFieldName);
985 void FieldReadFn(
float* pValue,
FbxUInt pn);
990 void FieldRead3F(
float* pValue);
995 void FieldRead4F(
float* pValue);
1003 void FieldReadFn(
const char* pFieldName,
float* pValue,
const float *pDefault,
FbxUInt pn);
1010 void FieldRead3F(
const char* pFieldName,
float* pValue,
const float* pDefault=
NULL);
1017 void FieldRead4F(
const char* pFieldName,
float* pValue,
const float* pDefault=
NULL);
1023 void FieldReadDn(
double* pValue,
FbxUInt pn);
1028 void FieldRead3D(
double* pValue);
1033 void FieldRead4D(
double* pValue);
1041 void FieldReadDn(
const char* pFieldName,
double* pValue,
const double *pDefault,
FbxUInt pn);
1048 void FieldRead3D(
const char* pFieldName,
double* pValue,
const double* pDefault=
NULL);
1055 void FieldRead4D(
const char* pFieldName,
double* pValue,
const double* pDefault=
NULL);
1060 void* FieldReadR(
int* pByteSize);
1066 void* FieldReadR(
const char* pFieldName,
int* pByteSize);
1079 FbxChar FieldReadByte(
const char* pFieldName,
FbxChar pDefault=0);
1109 unsigned int FieldReadUI();
1115 unsigned int FieldReadUI(
const char* pFieldName,
unsigned int pDefault=0);
1129 const FbxChar* FieldReadArraySBytes(
int &pCount );
1133 const FbxShort* FieldReadArrayShort (
int &pCount );
1137 const FbxUShort* FieldReadArrayUShort(
int &pCount );
1141 const unsigned int* FieldReadArrayUI (
int &pCount );
1165 const unsigned int* FieldReadArray(
int &pCount,
const unsigned int*);
1183 virtual bool FieldReadEmbeddedFile(
FbxString& pFileName,
FbxString& pRelativeFileName,
1184 const char* pEmbeddedMediaDirectory =
"",
bool *pIsFileCreated =
NULL,
1190 const double* FieldReadArrayD(
int &pCount );
1194 const float* FieldReadArrayF(
int &pCount );
1198 const int* FieldReadArrayI(
int &pCount );
1206 const bool* FieldReadArrayB(
int &pCount );
1210 const FbxUChar* FieldReadArrayBytes(
int &pCount );
1215 const int* FieldReadArray(
int& pCount,
const int*);
1219 const float* FieldReadArray(
int& pCount,
const float*);
1223 const double* FieldReadArray(
int& pCount,
const double*);
1231 const bool* FieldReadArray(
int& pCount,
const bool*);
1248 void FieldWriteBegin(
const char* pFieldName);
1251 void FieldWriteEnd();
1254 void FieldWriteBlockBegin();
1261 void FieldWriteObjectBegin(
const char* pObjectType,
const char* pName,
const char* pSubType=
NULL);
1264 void FieldWriteObjectEnd();
1270 void FieldWriteBlockBegin(
const char* pFileName);
1273 void FieldWriteBlockEnd ();
1278 void FieldWriteCH(
char pValue);
1284 void FieldWriteCH(
const char* pFieldName,
char pValue);
1289 void FieldWriteC(
const char* pValue);
1295 void FieldWriteC(
const char* pFieldName,
const char* pValue);
1300 void FieldWriteS(
const char* pValue);
1305 void FieldWriteS(
const FbxString& pValue);
1311 void FieldWriteS(
const char* pFieldName,
const char* pValue);
1317 void FieldWriteS(
const char* pFieldName,
const FbxString& pValue);
1322 void FieldWriteB(
bool pValue);
1328 void FieldWriteB(
const char* pFieldName,
bool pValue);
1333 void FieldWriteI(
int pValue);
1339 void FieldWriteI(
const char* pFieldName,
int pValue);
1350 void FieldWriteLL(
const char* pFieldName,
FbxLongLong pValue);
1356 void FieldWriteF(
float pValue);
1363 void FieldWriteF(
const char* pFieldName,
float pValue);
1368 void FieldWriteD(
double pValue);
1374 void FieldWriteD(
const char* pFieldName,
double pValue);
1379 void FieldWriteT(
FbxTime pTime);
1385 void FieldWriteT(
const char* pFieldName,
FbxTime pValue);
1396 void FieldWriteTS(
const char* pFieldName,
FbxTimeSpan pValue);
1402 void FieldWriteFn(
const float* pValue,
FbxUInt pn);
1409 void FieldWriteFn(
const char* pFieldName,
const float* pValue,
FbxUInt pn);
1414 void FieldWrite3F(
const float* pValue);
1420 void FieldWrite3F(
const char* pFieldName,
const float* pValue);
1425 void FieldWrite4F(
const float* pValue);
1431 void FieldWrite4F(
const char* pFieldName,
const float* pValue);
1437 void FieldWriteDn(
const double* pValue,
FbxUInt pn);
1444 void FieldWriteDn(
const char* pFieldName,
const double* pValue,
FbxUInt pn);
1449 void FieldWrite3D(
const double* pValue);
1455 void FieldWrite3D(
const char* pFieldName,
const double* pValue);
1460 void FieldWrite4D(
const double* pValue);
1466 void FieldWrite4D(
const char* pFieldName,
const double* pValue);
1479 void FieldWriteArrayD(
int n,
const double* pValue,
int pSize = 1,
int pStride = 0 );
1486 void FieldWriteArrayF(
int n,
const float* pValue,
int pSize = 1,
int pStride = 0 );
1493 void FieldWriteArrayI(
int n,
const int* pValue,
int pSize = 1,
int pStride = 0 );
1500 void FieldWriteArrayLL(
int n,
const FbxLongLong* pValue,
int pSize = 1,
int pStride = 0 );
1507 void FieldWriteArrayB(
int n,
const bool* pValue,
int pSize = 1,
int pStride = 0 );
1514 void FieldWriteArrayBytes(
int n,
const FbxUChar* pValue,
int pSize = 1,
int pStride = 0 );
1520 void FieldWriteR(
const void* pRawData,
int pByteSize);
1527 void FieldWriteR(
const char* pFieldName,
const void* pRawData,
int pByteSize);
1537 void FieldWriteByte(
FbxChar pValue);
1543 void FieldWriteByte(
const char* pFieldName,
FbxChar pValue);
1548 void FieldWriteUByte(
FbxUChar pValue);
1554 void FieldWriteUByte(
const char* pFieldName,
FbxUChar pValue);
1559 void FieldWriteShort(
FbxShort pValue);
1565 void FieldWriteShort(
const char* pFieldName,
FbxShort pValue);
1570 void FieldWriteUShort(
FbxUShort pValue);
1576 void FieldWriteUShort(
const char* pFieldName,
FbxUShort pValue);
1581 void FieldWriteUI(
unsigned int pValue);
1587 void FieldWriteUI(
const char* pFieldName,
unsigned int pValue);
1599 void FieldWriteULL(
const char* pFieldName,
FbxULongLong pValue);
1607 void FieldWriteArraySBytes(
int n,
const FbxChar* pValue,
int pSize = 1,
int pStride = 0 );
1614 void FieldWriteArrayShort(
int n,
const FbxShort* pValue,
int pSize = 1,
int pStride = 0 );
1621 void FieldWriteArrayUShort(
int n,
const FbxUShort* pValue,
int pSize = 1,
int pStride = 0 );
1628 void FieldWriteArrayUI(
int n,
const unsigned int* pValue,
int pSize = 1,
int pStride = 0 );
1635 void FieldWriteArrayULL(
int n,
const FbxULongLong* pValue,
int pSize = 1,
int pStride = 0 );
1641 int GetFieldRMaxChunkSize()
const;
1646 void FieldWriteObjectReference(
const char* pName);
1652 void FieldWriteObjectReference(
const char* pFieldName,
const char* pName);
1668 void WriteComments(
const char* pFieldName);
1684 bool GetHaveEmbeddedFileCallback()
const;
1693 bool GetHaveLoadedEmbededFile()
const;
1699 void GetMemoryFileInfo(
void** pMemPtr,
size_t& pSize)
const;
1704 bool IsBeforeVersion6()
const;
1709 void SetIsBeforeVersion6(
bool pIsBeforeVersion6);
1714 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1716 FbxStatus& GetStatus() {
return mStatus; }
1718 int GetTCDefinition();
1719 bool NeedTCConversion();
1727 struct InternalImpl;
1728 struct InternalImpl32;
1729 struct InternalImpl64;
1730 InternalImpl* mImpl;
1734 void ProjectClear();
1735 void ProjectReset();
1737 bool ProjectReadHeader(
bool pCheckASCIIHeader,
bool pCheckCRC,
bool pOpenMainSection,
FbxIOFileHeaderInfo* pFileHeaderInfo);
1739 bool BinaryReadHeader();
1740 bool BinaryReadSectionPosition();
1741 bool ASCIIReadHeader();
1742 bool ASCIIReadSectionPosition();
1746 void BinaryWriteHeader();
1747 void ASCIIWriteHeader();
1749 void ReadEncryptionKey(
char* pEncryptionKey);
1750 void WriteEncryptionKey(
char* pEncryptionKey);
1754 bool ProjectClearSection();
1755 bool ProjectOpenSection(
int pSection);
1756 bool BinaryReadSectionHeader();
1757 FbxInt64 BinaryReadSectionFooter(
unsigned char* pSourceCheck);
1759 void BinaryReadSectionPassword();
1761 bool ProjectWriteSectionHeader();
1762 void BinaryWriteSectionFooter();
1763 bool BinaryWriteExtensionCode(
FbxInt64 pSectionStart,
FbxUInt32 pSectionVersion);
1766 FbxString GetMangledCreationTime()
const;
1767 void SetCreationTime(
FbxString pCreationTime);
1768 void CreateSourceCheck(
unsigned char* lSourceCheck);
1769 bool TestSourceCheck(
unsigned char* pSourceCheck,
unsigned char* pSourceCompany);
1770 void EncryptSourceCheck(
unsigned char* pSourceCheck,
unsigned char* pEncryptionData);
1771 void DecryptSourceCheck(
unsigned char* pSourceCheck,
const unsigned char* pEncryptionData);
1778 void CheckValidityOfFieldName(
const char* pFieldName);
1782 FbxString GetDirectory(
bool pAutoCreate,
const char* pExtension);
Callback to operate on the embedded data while it is processed.
FbxAutoResetXRefManager(FbxIO *pFbx, FbxXRefManager &pXRefManager)
Default constructor.
FBX SDK environment definition.
indicate not in a valid section
~FbxAutoResetXRefManager()
Destructor.
FbxString mResolutionMode
resolution mode.
Abstract class for implementing I/O operations through a stream of data.
Utility class to manipulate strings.
Base class of other readers used internally.
indicate currently in the main section
This class facilitates the testing/reporting of errors.
double mResolutionW
resolution width.
int FbxFileVersionStrToInt(const char *pFileVersion)
Convert the FBX file version string to an integral number for <= or>= tests purposes. =>
void ProjectSetXRefManager(const FbxXRefManager *)
Provide the XRef Manager to use to create the .fbm folder.
Class to encapsulate time units.
Render and resolution information.
Base class of other writers used internally.
This class manages external references to files.
static FbxIO * Create(BinaryType pBinaryType, FbxStatus &pStatus)
Creation function for this FbxIO class.
const FbxXRefManager * ProjectGetXRefManager() const
Get the XRef Manager to use.
const FbxXRefManager * mXRefManager
double mResolutionH
resolution height.
signed long long FbxInt64
Internal class used to differentiate objects during run-time.
FbxIO represents an FBX file.
FbxString mCameraName
camera name.
Class for interfacing with files, providing a similar interface for files independant of the OS or fi...
Class to encapsulate time intervals.
bool mIsOK
If the resolution data is ready.
indicate currently in the extention section 0