FBX SDK Reference Guide: kfbx.h Source File
00001 #ifndef FBXFILESDK_COMPONENTS_KBASELIB_KFBX_KFBX_H
00002 #define FBXFILESDK_COMPONENTS_KBASELIB_KFBX_KFBX_H
00003 
00004 /**************************************************************************************
00005 
00006  Copyright © 2001 - 2008 Autodesk, Inc. and/or its licensors.
00007  All Rights Reserved.
00008 
00009  The coded instructions, statements, computer programs, and/or related material 
00010  (collectively the "Data") in these files contain unpublished information 
00011  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00012  Canada and United States of America federal copyright law and by international 
00013  treaties. 
00014  
00015  The Data may not be disclosed or distributed to third parties, in whole or in
00016  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00017 
00018  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00019  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00020  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00021  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00022  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00023  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00024  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00028  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00029  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00030  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00031  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00032  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00033  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00034  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00035  OR DAMAGE. 
00036 
00037 **************************************************************************************/
00038 
00039 #include <fbxfilesdk/components/kbaselib/kbaselib_h.h>
00040 
00041 #include <string.h>
00042 #include <stdio.h>
00043 #include <stdlib.h>
00044 #include <errno.h>
00045 
00046 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00047 #include <fbxfilesdk/components/kbaselib/klib/ktime.h>
00048 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00049 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00050 #include <fbxfilesdk/components/kbaselib/klib/ksystemtime.h>
00051 #include <fbxfilesdk/components/kbaselib/klib/kcharptrset.h>
00052 
00053 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00054 
00055 class KFBX_DLL KFbxXRefManager;
00056 class KFile;
00057 class KFbxReader;
00058 class KFbxWriter;
00059 
00060 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00061 
00062 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00063 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00064 
00065     // Defines the current version number.
00066     // Please keep this version journal updated.
00067 
00068 
00069     #define FBX_DEFAULT_VERSION_NUMBER 6100
00070 
00071     #define FBX7_DEFAULT_VERSION_NUMBER 7000
00072 
00073 
00074     // Defines the current version number.
00075     // Please keep this version journal updated.
00076 
00077     // Version 2000
00078     // New Bob KFCurve and embedded FBX.; no FCurve/FCurve node storing
00079     // No more .takf must has been created in an earlier version, no history
00080     // Ben's data is saved and retrieve
00081 
00082     // Version 2001
00083     // Version incremented to support KTime save in native (integer, not double!) format.
00084 
00085     // Version 3000
00086     // FiLMBOX 3.0 version, nothing changed in current class since version 2001.
00087     // FBX SDK 3.0 and 3.6
00088     // Ben's data is retrieve only to keep compatibility
00089 
00090     // Version 3001
00091     // FiLMBOX 3.0 encrypted version, only a trial.
00092     // Encrypted files could only be written in debug versions.
00093 
00094     // Gross big fat mistake! Cannot switch to a higher version number now because any
00095     // file with a version number >= 3001 is read as encrypted.
00096     // Hence, this value now only gives file type. (3000 or less -> binary, 3001 or more -> encrypted)
00097 
00098     // FiLMBOX 3.2, FiLMBOX 3.5 and Online 3.51 have been released with version 3000.
00099 
00100     // Version 4000
00101     // MotionBuilder 4.0, new type in KFCurve tangents, supported in FiLMBOX 3.5 but not by earlier versions.
00102     // Version number is now stored in section footer.
00103     // Before September 3rd 2002, the version number was always 3000 in main section footer.
00104     // Now the main section footer has version number 4000.
00105     // The minimum version number in footer of an extension section is 4000.
00106 
00107     // Version 4001
00108     // ASCII Header is 4.1 !!!!
00109     // MotionBuilder 4.01, to fix FCurveNode problem with layertypes in version 4000
00110     // Now the main section footer has version number 4001.
00111     // Now the footer for extension sections has version number 4001.
00112 
00113     // Version 4050
00114     // ASCII Header is 4.5 !!!!
00115     // MotionBuilder 4.1 or 4.5 (we dont know yet) before January 22nd 2003
00116     // This is because EvaluationProperties now have color.
00117     // Now the main section footer has version number 4050.
00118     // Now the footer for extension sections has version number 4050.
00119 
00120     // Version 5000
00121     // ASCII Header is not compatible anymore with MotionBuilder 4.0, 4.01 and 4.02 and FBX SDK 3.6 and 3.7
00122     // MotionBuilder 4.03 and 4.1 or 4.5 (we dont know yet) from January 22nd 2003
00123     // FBX SDK 3.6.1
00124     // New extended header to improve FBX file version management.
00125     // Now the extended header and the main section footer have version number 5000.
00126     // Now the footer for extension sections has version number 5000.
00127 
00128     // ************************************************************************************************
00129     // ************************************************************************************************
00130     // ***********************                                                    *********************
00131     // Version 5800
00132     // THIS IS A TEMPORARY VERSION WHILE WAITING FOR THE VERSION 6000 which will render the previous
00133     // versions incompatible with MotionBuilder 6.0. For now, however, this format is needed to allow
00134     // some tools/plugins (ex:maya) to correctly detect that the file has some features that are not
00135     // totally backward compatible (ex: pivots defined with _pre/_post nodes which require a special
00136     // processing). By incrementing only the minor version we do not compromise the integrity of the
00137     // files.
00138     // ***********************                                                    *********************
00139     // ************************************************************************************************
00140     // ************************************************************************************************
00141 
00142     // Version 6000
00143     // Header version is now 6.0
00144     // Extended header now contain a creation time stamp that can be retrieve without parsing the
00145     // main section of the file.
00146     // A creator tag (string) is now stored in the Extended header. This contain the originator (MB/FBXSDK)
00147     // of the file and the build number of the originator.
00148     // First release of the file format using the KProperties to store/retrieve information.
00149 
00150 
00151     // Version 6100
00152     // Add support for multiple attributes (mainly multiple geometry) at the node level.
00153     // The pointer to the node attribute have been replaced by a connection between the node and its attribute(s).
00154 
00155     // Version 7000
00156     // First version of the 7.0 series; most likely very short-lived, developped for Protein, before ADP.
00157     // Supports reference cloning, external documents, blobs, unique IDs (per file), property templates.
00158     // So many changes that it was decided to break from 6.0 to keep Motion Builder intact.
00159 
00160     enum
00161     {
00162         FBX_NO_SECTION = -1,
00163         FBX_MAIN_SECTION,
00164         FBX_EXTENSION_SECTION_0,
00165         // FBX_EXTENSION_SECTION_1,
00166         // FBX_EXTENSION_SECTION_2,
00167         // ...
00168     };
00169 
00170     class KFBX_DLL KDefaultRenderResolution
00171     {
00172     public:
00173         bool    mIsOK;
00174         KString mCameraName;
00175         KString mResolutionMode;
00176         double mResolutionW;
00177         double mResolutionH;
00178 
00179         KDefaultRenderResolution();
00180 
00181         void Reset();
00182     };
00183 
00184     class KFBX_DLL KFbxFileHeaderInfo
00185     {
00186     public:
00187         KFbxFileHeaderInfo();
00188         virtual ~KFbxFileHeaderInfo();
00189 
00190         virtual void                Reset();
00191 
00192         // Derived classes can get funky and read more info out of the header.
00193         // Return false in case of failure that should stop loading the file.
00194         virtual bool                ReadExtendedHeaderInformation(KFbx*);
00195 
00196         KDefaultRenderResolution    mDefaultRenderResolution;
00197 
00198         //Read only properties (not used for file write)
00199         int                         mFileVersion;
00200         bool                        mCreationTimeStampPresent;
00201         kLocalTime                  mCreationTimeStamp;
00202         KString                     mCreator;               
00203         bool                        mPLE;
00204         bool                        mIOPlugin;
00205     };
00206 
00207     /***********************************************************************
00208         CLASS KFbx
00209 
00210         Description: FBX physical file I/O class.
00211     ************************************************************************/
00212     class KFBX_DLL KFbx
00213     {
00214 
00215     public:
00216         // Exception-safe way of setting/resetting the xref manager in a KFbx object.
00217         struct KFbxAutoResetXRefManager
00218         {
00219             KFbx*                   mFbx;
00220             const KFbxXRefManager*  mXRefManager;
00221 
00222             KFbxAutoResetXRefManager(KFbx* pFbx, KFbxXRefManager& pXRefManager)
00223             : mFbx(pFbx)
00224             , mXRefManager(NULL)
00225             {
00226                 if( mFbx )
00227                 {
00228                     mXRefManager = mFbx->ProjectGetXRefManager();
00229                     mFbx->ProjectSetXRefManager(&pXRefManager);
00230                 }
00231             }
00232 
00233             ~KFbxAutoResetXRefManager()
00234             {
00235                 if( mFbx )
00236                 {
00237                     mFbx->ProjectSetXRefManager(mXRefManager);
00238                 }
00239             }
00240         };
00241 
00242 
00243         static KFbx* KFbxObjectCreate(){ return new KFbx; }
00244 
00245         KFbx();
00246         virtual ~KFbx();
00247 
00252 
00254         bool ProjectOpen(void* pAddress, kULong pMaxLength, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00255 
00257         bool ProjectOpen(const char* pName, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00258 
00260         bool ProjectOpen (KFile * pFile, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00261 
00263         bool ProjectOpenDirect(const char* pName, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00264 
00266         bool ProjectCreate(void* pAddress, kUInt pSize, KFbxWriter* pWriter, bool pBinary, bool pEncrypted, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00267 
00269         bool ProjectCreate(const char* pName, KFbxWriter* pWriter, bool pBinary, bool pEncrypted, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00270 
00272         bool ProjectCreateDirect(const char* pName, KFbxWriter* pWriter, bool pBinary, bool pEncrypted, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00273 
00275         bool ProjectCreateEmpty(const char* pName, KFbxWriter* pWriter, int pVersion, bool pBinary, bool pEncrypted);
00276 
00277         // Write FBX signature at the top of the file, prepare file for writing header information
00278         bool ProjectWrite_BeginFileHeader();
00279 
00280         // Open up the 'extended header'
00281         bool ProjectWrite_BeginExtendedHeader();
00282 
00283         // Write the contents of the extended header
00284         bool ProjectWrite_WriteExtendedHeader(const KFbxFileHeaderInfo* pExtendedHeader);
00285 
00286         // Close the extended header
00287         bool ProjectWrite_EndExtendedHeader();
00288 
00289         // Close up the header, prepare file for payload write.
00290         bool ProjectWrite_EndFileHeader();
00291 
00293         bool ProjectClose(void** pData=0,kULong *pSize=0);
00294 
00301         void ProjectSetXRefManager(const KFbxXRefManager*);
00302 
00306         const KFbxXRefManager* ProjectGetXRefManager() const;
00307 
00319         bool ProjectCreateEmbeddedFolder(const KFbxXRefManager& pXRefManager, KString& pCreatedFolder); 
00320 
00322         void SetEmbedded(bool pValue);
00323 
00325         bool IsEmbedded() const;
00326 
00328         bool IsBinary() const;
00329 
00331         bool IsEncrypted () const;
00332 
00333         bool Fbx7Support() const;
00334         void Fbx7Support(bool pSupport);
00335 
00336         // This is only used for FBX7 files; should we compress arrays if possible?
00337         // The writer may decide not to compress all arrays, or it may even decide
00338         // not to compress anyway.  Flags are written in the file to help the reader
00339         // out, on a per-array basis.
00340         bool CompressArrays() const;
00341         void CompressArrays(bool pCompress);
00342 
00343         int  CompressMinimumSize() const;
00344         void CompressMinimumSize(int pSize);
00345 
00346         int  CompressLevel() const;
00347         void CompressLevel(int pLevel); // Range is: [0-9], from no compression to as-much-as-we-can
00348 
00352         bool CheckCRC();
00353 
00355         kUInt32 GetFileVersionNumber() const; 
00356 
00358 
00363 
00365         bool ProjectOpenMainSection();
00366 
00368         int ProjectGetExtensionSectionCount();
00369 
00371         bool ProjectOpenExtensionSection(int pExtensionSectionIndex);
00372 
00374         bool ProjectCreateExtensionSection(bool pOverwriteLastExtensionSection = false);
00375 
00377         void ProjectCloseSection();
00378 
00380         bool ProjectRemoveLastExtensionSection();
00381 
00383         int ProjectGetCurrentSection();
00384 
00386         int ProjectGetCurrentSectionMode();
00387 
00389         int ProjectGetCurrentSectionVersion();
00390 
00396         int ProjectGetSectionVersion(int pSection);
00397 
00404         static void ProjectConvertVersionNumber(int pVersion, int& pMajor, int& pMinor, int& pRevision);
00405 
00409         bool IsPasswordProtected() const;
00410 
00415         bool CheckPassword(const char* pPassword);
00416 
00422         bool WritePassword(const char* pPassword);
00423 
00425 
00430 
00432         const char* GetFilename() const;
00433 
00435         KString GetDataDirectory(bool pAutoCreate = true);
00436 
00442         KString GetMediaDirectory(bool pCreate = false);
00443 
00445         char* GetRelativePath(const char* pPath);
00446 
00448         char* GetRelativeFilePath(const char* pFilePath);
00449 
00451         char* GetFullPath(const char* pRelativePath);
00452 
00454         char* GetFullFilePath(const char* pRelativeFilePath);
00455 
00457         char* GetTmpProjectName(const char* pName);
00458 
00460         bool SwapFromTmpProject(const char* pName, char* pError=NULL);
00461 
00463 
00468 
00470         void FieldReadResetPosition();
00471 
00473         int FieldGetCount();
00474 
00476         const char* FieldGetName(int pFieldIndex);
00477 
00479         int FieldGetInstanceCount(const char* pFieldName);
00480 
00482         bool FieldReadBegin(int pFieldIndex, int pInstance);
00483 
00485         bool FieldReadBegin(const char* pFieldName);
00486 
00488         bool FieldReadBegin(const char* pFieldName, int pInstance);
00489 
00491         void FieldReadEnd();
00492 
00494         bool FieldReadIsBlock();
00495 
00497         bool FieldReadBlockBegin();
00498 
00500         void FieldReadBlockEnd();
00501 
00503         int FieldReadGetCount();
00504 
00506         int FieldReadGetRemain();
00507 
00509         char FieldReadGetType();
00510 
00512         char FieldReadCH();
00513 
00515         char FieldReadCH(const char* pFieldName, char pDefault=0);
00516 
00518         const char* FieldReadC();
00519 
00521         const char* FieldReadC(const char* pFieldName, const char* pDefault="");
00522 
00524         const char* FieldReadS();
00525 
00527         const char* FieldReadS(const char* pFieldName, const char* pDefault="");
00528 
00530         bool FieldReadB();
00531 
00533         bool FieldReadB(const char* pFieldName, bool pDefault = false);
00534 
00536         int FieldReadI();
00537 
00539         int FieldReadI(const char* pFieldName, int pDefault=0);
00540 
00542         kLongLong FieldReadLL();
00543 
00545         kLongLong FieldReadLL(const char* pFieldName, kLongLong pDefault=0);
00546 
00548         float FieldReadF();
00549 
00551         float FieldReadF(const char* pFieldName, float pDefault=0);
00552 
00554         double FieldReadD();
00555 
00557         double FieldReadD(const char* pFieldName, double pDefault=0);
00558 
00560         KTime FieldReadT(const char* pFieldName);
00561 
00563         KTime FieldReadT();
00564 
00566         KTimeSpan FieldReadTS(const char* pFieldName);
00567 
00569         KTimeSpan FieldReadTS();
00570 
00572         void FieldReadFn(float* pValue, kUInt pn);
00573 
00575         void FieldRead3F(float* pValue);
00576 
00578         void FieldRead4F(float* pValue);
00579 
00581         void FieldReadFn(const char* pFieldName, float* pValue, const float *pDefault, kUInt pn);
00582 
00584         void FieldRead3F(const char* pFieldName, float* pValue, const float* pDefault=NULL);
00585 
00587         void FieldRead4F(const char* pFieldName, float* pValue, const float* pDefault=NULL);
00588 
00590         void FieldReadDn(double* pValue, kUInt pn);
00591 
00593         void FieldRead3D(double* pValue);
00594 
00596         void FieldRead4D(double* pValue);
00597 
00599         void FieldReadDn(const char* pFieldName, double* pValue, const double *pDefault, kUInt pn);
00600 
00602         void FieldRead3D(const char* pFieldName, double* pValue, const double* pDefault=NULL);
00603 
00605         void FieldRead4D(const char* pFieldName, double* pValue, const double* pDefault=NULL);
00606 
00608         void* FieldReadR(int* pByteSize);
00609 
00611         void* FieldReadR(const char* pFieldName,int* pByteSize);
00612 
00617         virtual bool FieldReadEmbeddedFile (KString& pFileName, KString& pRelativeFileName, const char* pEmbeddedMediaDirectory = "", bool *pIsFileCreated=NULL);
00618 
00619         const double*   FieldReadArrayD( int &pCount );
00620         const float*    FieldReadArrayF( int &pCount );
00621         const int*      FieldReadArrayI( int &pCount );
00622         const kLongLong*FieldReadArrayLL(int &pCount );
00623         const bool*     FieldReadArrayB( int &pCount );
00624         const kUByte*   FieldReadArrayBytes( int &pCount );
00625 
00626         const int*    FieldReadArray(int& pCount, const int*);
00627         const float*  FieldReadArray(int& pCount, const float*);
00628         const double* FieldReadArray(int& pCount, const double*);
00629         const kLongLong* FieldReadArray(int& pCount, const kLongLong*);
00630         const bool* FieldReadArray(int& pCount, const bool*);
00631         const kUByte* FieldReadArray(int& pCount, const kUByte*);
00632 
00634 
00639 
00641         void FieldWriteBegin(const char* pFieldName);
00642 
00644         void FieldWriteEnd();
00645 
00647         void FieldWriteBlockBegin();
00648 
00650         void FieldWriteObjectBegin(const char* pObjectType, const char* pName, const char* pSubType=NULL);
00651 
00653         void FieldWriteObjectEnd();
00654 
00658         void FieldWriteBlockBegin(const char* pFileName);
00659 
00661         void FieldWriteBlockEnd ();
00662 
00664         void FieldWriteCH(char pValue);
00665 
00667         void FieldWriteCH(const char* pFieldName, char pValue);
00668 
00670         void FieldWriteC(const char* pValue);
00671 
00673         void FieldWriteC(const char* pFieldName, const char* pValue);
00674 
00676         void FieldWriteS(const char* pValue);
00677         void FieldWriteS(const KString& pValue);
00678 
00680         void FieldWriteS(const char* pFieldName, const char* pValue);
00681         void FieldWriteS(const char* pFieldName, const KString& pValue);
00682 
00684         void FieldWriteB(bool pValue);
00685 
00687         void FieldWriteB(const char* pFieldName, bool pValue);
00688 
00690         void FieldWriteI(int pValue);
00691 
00693         void FieldWriteI(const char* pFieldName, int pValue);
00694 
00696         void FieldWriteLL(kLongLong pValue);
00697 
00699         void FieldWriteLL(const char* pFieldName, kLongLong pValue);
00700 
00704         void FieldWriteF(float pValue);
00705 
00709         void FieldWriteF(const char* pFieldName, float pValue);
00710 
00712         void FieldWriteD(double  pValue);
00713 
00715         void FieldWriteD(const char* pFieldName, double pValue);
00716 
00718         void FieldWriteT(KTime pTime);
00719 
00721         void FieldWriteT(const char* pFieldName,KTime pValue);
00722 
00724         void FieldWriteTS(KTimeSpan pTimeSpan);
00725 
00727         void FieldWriteTS(const char* pFieldName,KTimeSpan pValue);
00728 
00730         void FieldWriteFn(const float* pValue, kUInt pn);
00731 
00733         void FieldWriteFn(const char* pFieldName, const float* pValue, kUInt pn);
00734 
00736         void FieldWrite3F(const float* pValue);
00737 
00739         void FieldWrite3F(const char* pFieldName, const float* pValue);
00740 
00742         void FieldWrite4F(const float* pValue);
00743 
00745         void FieldWrite4F(const char* pFieldName, const float* pValue);
00746 
00748         void FieldWriteDn(const double* pValue, kUInt pn);
00749 
00751         void FieldWriteDn(const char* pFieldName, const double* pValue, kUInt pn);
00752 
00754         void FieldWrite3D(const double* pValue);
00755 
00757         void FieldWrite3D(const char* pFieldName, const double* pValue);
00758 
00760         void FieldWrite4D(const double* pValue);
00761 
00763         void FieldWrite4D(const char* pFieldName, const double* pValue);
00764 
00765         // The maximum number of value entries is, in theory, 2**32.  In practice it should be a lot less than that.
00766         // pSize is the number of values to write from each pointer location, and stride is how much we 
00767         // advance to get to the next value; if the stride is zero, values are tighly packed together.
00768         // So in total we'll write n * pSize items.
00769         void FieldWriteArrayD( int n, const double*     pValue, int pSize = 1, int pStride = 0 );
00770         void FieldWriteArrayF( int n, const float*      pValue, int pSize = 1, int pStride = 0 );
00771         void FieldWriteArrayI( int n, const int*        pValue, int pSize = 1, int pStride = 0 );
00772         void FieldWriteArrayLL(int n, const kLongLong*  pValue, int pSize = 1, int pStride = 0 );
00773         void FieldWriteArrayB( int n, const bool*       pValue, int pSize = 1, int pStride = 0 );
00774         void FieldWriteArrayBytes( int n, const kUByte* pValue, int pSize = 1, int pStride = 0 );
00775 
00778         void FieldWriteR(const void* pRawData, int pByteSize);
00779 
00782         void FieldWriteR(const char* pFieldName, const void* pRawData, int pByteSize);
00783 
00784         // ASCII files may limit how big you can write your raw data, forcing you to break it down into
00785         // chunks.
00786         int GetFieldRMaxChunkSize() const;
00787 
00789         void FieldWriteObjectReference(const char* pName);
00790 
00792         void FieldWriteObjectReference(const char* pFieldName, const char* pName);
00793 
00798         bool FieldWriteEmbeddedFile (KString pFileName, KString pRelativeFileName);
00799 
00801         void WriteComments(const char* pFieldName);
00802 
00804 
00809 
00811         enum EError
00812         {
00813             eFileCorrupted,
00814             eFileVersionNotSupportedYet,
00815             eFileVersionNotSupportedAnymore,
00816             eFileNotOpened,
00817             eFileNotCreated,
00818             eDirectoryNotCreated,
00819             eCrcCheckFailed,
00820             eNonExistingSection,
00821             eOperationCanceled,
00822             eCountError,
00823             eInvalidData,
00824             eWriteError,
00825             eReadError,
00826             eErrorCount
00827         };
00828 
00832         KError& GetError();
00833 
00837         EError GetLastErrorID() const;
00838 
00842         const char* GetLastErrorString() const;
00843 
00845 
00846     #ifdef _DEBUG
00847         // Dump function for debugging purpose only
00848         void StdoutDump();
00849     #endif
00850 
00851         bool GetHaveLoadedEmbededFile() const;
00852 
00853         void* GetMemoryFileInfo(kULong& pSize);
00854 
00855     public:
00856         bool    IsBeforeVersion6() const;
00857         void    SetIsBeforeVersion6(bool pIsBeforeVersion6);
00858 
00859     private:
00860         struct KFbxImpl;
00861         KFbxImpl* mImpl;
00862 
00864 
00865         void ProjectClear();
00866         void ProjectReset();
00867 
00868         bool ProjectReadHeader(bool pCheckASCIIHeader, bool pCheckCRC, bool pOpenMainSection, KFbxFileHeaderInfo* pFileHeaderInfo);
00869         bool ProjectReadExtendedHeader(int& pExtendedHeaderEnd, KFbxFileHeaderInfo* pFileHeaderInfo);
00870         bool BinaryReadHeader();
00871         bool BinaryReadSectionPosition();
00872         bool ASCIIReadHeader();
00873         bool ASCIIReadSectionPosition();
00874 
00875         bool ProjectWriteHeader(KFbxFileHeaderInfo* pFileHeaderInfo);
00876         bool ProjectWriteExtendedHeader(KFbxFileHeaderInfo* pFileHeaderInfo);
00877         void BinaryWriteHeader();
00878         void ASCIIWriteHeader();
00879 
00880         void ReadEncryptionKey(char* pEncryptionKey);
00881         void WriteEncryptionKey(char* pEncryptionKey);
00882 
00884 
00885         bool ProjectClearSection();
00886         bool ProjectOpenSection(int pSection);
00887         bool BinaryReadSectionHeader();
00888         int BinaryReadSectionFooter(char* pSourceCheck);
00889         bool BinaryReadExtensionCode(kUInt32 pFollowingSectionStart, kUInt32& pSectionStart, kUInt32& pSectionVersion);
00890         void BinaryReadSectionPassword();
00891 
00892         bool ProjectWriteSectionHeader();
00893         void BinaryWriteSectionFooter();
00894         bool BinaryWriteExtensionCode(kUInt32 pSectionStart, kUInt32 pSectionVersion);
00895 
00896         KString GetCreationTime();
00897         void SetCreationTime(KString pCreationTime);
00898         void CreateSourceCheck(char* lSourceCheck);
00899         bool TestSourceCheck(char* pSourceCheck, char* pSourceCompany);
00900         KString GetMangledCreationTime();
00901         void EncryptSourceCheck(char* pSourceCheck, char* pEncryptionData);
00902         void DecryptSourceCheck(char* pSourceCheck, const char* pEncryptionData);
00903 
00904         void EncryptPasswordV1(KString pOriginalPassword, KString &pEncryptedPassword);
00905         void DecryptPasswordV1(KString pEncryptedPassword, KString &pDecryptedPassword);
00906 
00908 
00909         void CheckValidityOfFieldName(const char* pFieldName);
00910         void GetUnusedEmbeddedName(const KString& pDirectory, const KString& pName, KString& pResult, bool pCreateSubdirectory);
00911 
00913         KString GetDirectory(bool pAutoCreate, const char* pExtension);
00914     };
00915 
00916 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00917 
00918 #endif // FBXFILESDK_COMPONENTS_KBASELIB_KFBX_KFBX_H
00919