kfbx.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_COMPONENTS_KBASELIB_KFBX_KFBX_H
00005 #define FBXFILESDK_COMPONENTS_KBASELIB_KFBX_KFBX_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
00039 
00040 **************************************************************************************/
00041 
00042 #include <fbxfilesdk/components/kbaselib/kbaselib_h.h>
00043 
00044 #include <string.h>
00045 #include <stdio.h>
00046 #include <stdlib.h>
00047 #include <errno.h>
00048 
00049 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00050 #include <fbxfilesdk/components/kbaselib/klib/ktime.h>
00051 #include <fbxfilesdk/components/kbaselib/klib/kerror.h>
00052 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00053 #include <fbxfilesdk/components/kbaselib/klib/ksystemtime.h>
00054 #include <fbxfilesdk/components/kbaselib/klib/kcharptrset.h>
00055 
00056 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00057 
00058 class KFBX_DLL KFbxXRefManager;
00059 class KFile;
00060 class KFbxReader;
00061 class KFbxWriter;
00062 
00063 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00064 
00065 #include <fbxfilesdk/components/kbaselib/kbaselib_forward.h>
00066 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00067 
00068     // Defines the current version number.
00069     // Please keep this version journal updated.
00070 
00071 
00072     #define FBX_DEFAULT_VERSION_NUMBER 6100
00073 
00074     #define FBX7_DEFAULT_VERSION_NUMBER 7000
00075 
00076 
00077     // Defines the current version number.
00078     // Please keep this version journal updated.
00079 
00080     // Version 2000
00081     // New Bob KFCurve and embedded FBX.; no FCurve/FCurve node storing
00082     // No more .takf must has been created in an earlier version, no history
00083     // Ben's data is saved and retrieve
00084 
00085     // Version 2001
00086     // Version incremented to support KTime save in native (integer, not double!) format.
00087 
00088     // Version 3000
00089     // FiLMBOX 3.0 version, nothing changed in current class since version 2001.
00090     // FBX SDK 3.0 and 3.6
00091     // Ben's data is retrieve only to keep compatibility
00092 
00093     // Version 3001
00094     // FiLMBOX 3.0 encrypted version, only a trial.
00095     // Encrypted files could only be written in debug versions.
00096 
00097     // Gross big fat mistake! Cannot switch to a higher version number now because any
00098     // file with a version number >= 3001 is read as encrypted.
00099     // Hence, this value now only gives file type. (3000 or less -> binary, 3001 or more -> encrypted)
00100 
00101     // FiLMBOX 3.2, FiLMBOX 3.5 and Online 3.51 have been released with version 3000.
00102 
00103     // Version 4000
00104     // MotionBuilder 4.0, new type in KFCurve tangents, supported in FiLMBOX 3.5 but not by earlier versions.
00105     // Version number is now stored in section footer.
00106     // Before September 3rd 2002, the version number was always 3000 in main section footer.
00107     // Now the main section footer has version number 4000.
00108     // The minimum version number in footer of an extension section is 4000.
00109 
00110     // Version 4001
00111     // ASCII Header is 4.1 !!!!
00112     // MotionBuilder 4.01, to fix FCurveNode problem with layertypes in version 4000
00113     // Now the main section footer has version number 4001.
00114     // Now the footer for extension sections has version number 4001.
00115 
00116     // Version 4050
00117     // ASCII Header is 4.5 !!!!
00118     // MotionBuilder 4.1 or 4.5 (we dont know yet) before January 22nd 2003
00119     // This is because EvaluationProperties now have color.
00120     // Now the main section footer has version number 4050.
00121     // Now the footer for extension sections has version number 4050.
00122 
00123     // Version 5000
00124     // ASCII Header is not compatible anymore with MotionBuilder 4.0, 4.01 and 4.02 and FBX SDK 3.6 and 3.7
00125     // MotionBuilder 4.03 and 4.1 or 4.5 (we dont know yet) from January 22nd 2003
00126     // FBX SDK 3.6.1
00127     // New extended header to improve FBX file version management.
00128     // Now the extended header and the main section footer have version number 5000.
00129     // Now the footer for extension sections has version number 5000.
00130 
00131     // ************************************************************************************************
00132     // ************************************************************************************************
00133     // ***********************                                                    *********************
00134     // Version 5800
00135     // THIS IS A TEMPORARY VERSION WHILE WAITING FOR THE VERSION 6000 which will render the previous
00136     // versions incompatible with MotionBuilder 6.0. For now, however, this format is needed to allow
00137     // some tools/plugins (ex:maya) to correctly detect that the file has some features that are not
00138     // totally backward compatible (ex: pivots defined with _pre/_post nodes which require a special
00139     // processing). By incrementing only the minor version we do not compromise the integrity of the
00140     // files.
00141     // ***********************                                                    *********************
00142     // ************************************************************************************************
00143     // ************************************************************************************************
00144 
00145     // Version 6000
00146     // Header version is now 6.0
00147     // Extended header now contain a creation time stamp that can be retrieve without parsing the
00148     // main section of the file.
00149     // A creator tag (string) is now stored in the Extended header. This contain the originator (MB/FBXSDK)
00150     // of the file and the build number of the originator.
00151     // First release of the file format using the KProperties to store/retrieve information.
00152 
00153 
00154     // Version 6100
00155     // Add support for multiple attributes (mainly multiple geometry) at the node level.
00156     // The pointer to the node attribute have been replaced by a connection between the node and its attribute(s).
00157 
00158     // Version 7000
00159     // First version of the 7.0 series; most likely very short-lived, developped for Protein, before ADP.
00160     // Supports reference cloning, external documents, blobs, unique IDs (per file), property templates.
00161     // So many changes that it was decided to break from 6.0 to keep Motion Builder intact.
00162 
00163     enum
00164     {
00165         FBX_NO_SECTION = -1,
00166         FBX_MAIN_SECTION,
00167         FBX_EXTENSION_SECTION_0,
00168         // FBX_EXTENSION_SECTION_1,
00169         // FBX_EXTENSION_SECTION_2,
00170         // ...
00171     };
00172 
00176     class KFBX_DLL KDefaultRenderResolution
00177     {
00178     public:
00180         bool    mIsOK;
00182         KString mCameraName;
00183         KString mResolutionMode;
00185         double mResolutionW;
00187         double mResolutionH;
00188 
00193 
00194         KDefaultRenderResolution();
00196 
00201 
00202         void Reset();
00204     };
00205 
00208     class KFBX_DLL KFbxFileHeaderInfo
00209     {
00210     public:
00215 
00216         KFbxFileHeaderInfo();
00217 
00219         virtual ~KFbxFileHeaderInfo();
00221 
00226         virtual void                Reset();
00227 
00228         // Derived classes can get funky and read more info out of the header.
00229         // Return false in case of failure that should stop loading the file.
00230         virtual bool                ReadExtendedHeaderInformation(KFbx*);
00232 
00233         KDefaultRenderResolution    mDefaultRenderResolution;
00234 
00235         //Read only properties (not used for file write)
00236 
00238         int                         mFileVersion;
00239 
00241         bool                        mCreationTimeStampPresent;
00242 
00244         kLocalTime                  mCreationTimeStamp;
00245 
00247         KString                     mCreator;               
00248 
00250         bool                        mIOPlugin;
00251 
00252 
00253         bool                        mPLE;
00254     };
00255 
00258     class KFBX_DLL KFbx
00259     {
00260     public:
00261         // Exception-safe way of setting/resetting the xref manager in a KFbx object.
00262         struct KFbxAutoResetXRefManager
00263         {
00264             KFbx*                   mFbx;
00265             const KFbxXRefManager*  mXRefManager;
00266 
00267             KFbxAutoResetXRefManager(KFbx* pFbx, KFbxXRefManager& pXRefManager)
00268             : mFbx(pFbx)
00269             , mXRefManager(NULL)
00270             {
00271                 if( mFbx )
00272                 {
00273                     mXRefManager = mFbx->ProjectGetXRefManager();
00274                     mFbx->ProjectSetXRefManager(&pXRefManager);
00275                 }
00276             }
00277 
00278             ~KFbxAutoResetXRefManager()
00279             {
00280                 if( mFbx )
00281                 {
00282                     mFbx->ProjectSetXRefManager(mXRefManager);
00283                 }
00284             }
00285         };
00286 
00287 
00288         static KFbx* KFbxObjectCreate(){ return new KFbx; }
00289 
00290         KFbx();
00291         virtual ~KFbx();
00292 
00297 
00307         bool ProjectOpen(void* pAddress, kULong pMaxLength, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00308 
00317         bool ProjectOpen(const char* pName, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00318 
00327         bool ProjectOpen (KFile * pFile, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00328 
00337         bool ProjectOpenDirect(const char* pName, KFbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00338 
00348         bool ProjectCreate(void* pAddress, kUInt pSize, KFbxWriter* pWriter, bool pBinary, bool pEncrypted, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00349 
00358         bool ProjectCreate(const char* pName, KFbxWriter* pWriter, bool pBinary, bool pEncrypted, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00359 
00368         bool ProjectCreateDirect(const char* pName, KFbxWriter* pWriter, bool pBinary, bool pEncrypted, KFbxFileHeaderInfo* pFileHeaderInfo = NULL);
00369 
00378         bool ProjectCreateEmpty(const char* pName, KFbxWriter* pWriter, int pVersion, bool pBinary, bool pEncrypted);
00379 
00383         bool ProjectWrite_BeginFileHeader();
00384 
00388         bool ProjectWrite_BeginExtendedHeader();
00389 
00394         bool ProjectWrite_WriteExtendedHeader(const KFbxFileHeaderInfo* pExtendedHeader);
00395 
00399         bool ProjectWrite_EndExtendedHeader();
00400 
00404         bool ProjectWrite_EndFileHeader();
00405 
00411         bool ProjectClose(void** pData=0,kULong *pSize=0);
00412 
00416         void ProjectSetXRefManager(const KFbxXRefManager*);
00417 
00421         const KFbxXRefManager* ProjectGetXRefManager() const;
00422 
00436         bool ProjectCreateEmbeddedFolder(const KFbxXRefManager& pXRefManager, KString& pCreatedFolder); 
00437 
00441         void SetEmbedded(bool pValue);
00442 
00446         bool IsEmbedded() const;
00447 
00451         bool IsBinary() const;
00452 
00456         bool IsEncrypted () const;
00457 
00461         bool CheckCRC();
00462 
00466         kUInt32 GetFileVersionNumber() const; 
00467 
00469 
00479 
00481         bool Fbx7Support() const;
00482 
00486         void Fbx7Support(bool pSupport);
00487 
00489         bool CompressArrays() const;
00490 
00494         void CompressArrays(bool pCompress);
00495 
00497         int  CompressMinimumSize() const;
00498 
00502         void CompressMinimumSize(int pSize);
00503 
00505         int  CompressLevel() const;
00506 
00512         void CompressLevel(int pLevel);
00514 
00519 
00523         bool ProjectOpenMainSection();
00524 
00528         int ProjectGetExtensionSectionCount();
00529 
00534         bool ProjectOpenExtensionSection(int pExtensionSectionIndex);
00535 
00540         bool ProjectCreateExtensionSection(bool pOverwriteLastExtensionSection = false);
00541 
00544         void ProjectCloseSection();
00545 
00549         bool ProjectRemoveLastExtensionSection();
00550 
00554         int ProjectGetCurrentSection();
00555 
00559         int ProjectGetCurrentSectionMode();
00560 
00564         int ProjectGetCurrentSectionVersion();
00565 
00573         int ProjectGetSectionVersion(int pSection);
00574 
00581         static void ProjectConvertVersionNumber(int pVersion, int& pMajor, int& pMinor, int& pRevision);
00582 
00586         bool IsPasswordProtected() const;
00587 
00593         bool CheckPassword(const char* pPassword);
00594 
00601         bool WritePassword(const char* pPassword);
00602 
00604 
00609 
00613         const char* GetFilename() const;
00614 
00619         KString GetDataDirectory(bool pAutoCreate = true);
00620 
00628         KString GetMediaDirectory(bool pCreate = false);
00629 
00635         KString GetContainerTemplateDirectory(const char* pTemplateName, bool pCreate);
00636 
00641         char* GetRelativePath(const char* pPath);
00642 
00647         char* GetRelativeFilePath(const char* pFilePath);
00648 
00653         char* GetFullPath(const char* pRelativePath);
00654 
00659         char* GetFullFilePath(const char* pRelativeFilePath);
00660 
00665         char* GetTmpProjectName(const char* pName);
00666 
00672         bool SwapFromTmpProject(const char* pName, char* pError=NULL);
00673 
00675 
00680 
00683         void FieldReadResetPosition();
00684 
00688         int FieldGetCount();
00689 
00694         const char* FieldGetName(int pFieldIndex);
00695 
00700         int FieldGetInstanceCount(const char* pFieldName);
00701 
00707         bool FieldReadBegin(int pFieldIndex, int pInstance);
00708 
00713         bool FieldReadBegin(const char* pFieldName);
00714 
00720         bool FieldReadBegin(const char* pFieldName, int pInstance);
00721 
00723         void FieldReadEnd();
00724 
00726         bool FieldReadIsBlock();
00727 
00729         bool FieldReadBlockBegin();
00730 
00732         void FieldReadBlockEnd();
00733 
00735         int FieldReadGetCount();
00736 
00738         int FieldReadGetRemain();
00739 
00741         char FieldReadGetType();
00742 
00744         char FieldReadCH();
00745 
00750         char FieldReadCH(const char* pFieldName, char pDefault=0);
00751 
00753         const char* FieldReadC();
00754 
00759         const char* FieldReadC(const char* pFieldName, const char* pDefault="");
00760 
00762         const char* FieldReadS();
00763 
00768         const char* FieldReadS(const char* pFieldName, const char* pDefault="");
00769 
00771         bool FieldReadB();
00772 
00777         bool FieldReadB(const char* pFieldName, bool pDefault = false);
00778 
00780         int FieldReadI();
00781 int FieldReadI(const char* pFieldName, int pDefault=0);
00786 
00788         kLongLong FieldReadLL();
00789 
00794         kLongLong FieldReadLL(const char* pFieldName, kLongLong pDefault=0);
00795 
00797         float FieldReadF();
00798 
00803         float FieldReadF(const char* pFieldName, float pDefault=0);
00804 
00806         double FieldReadD();
00807 
00812         double FieldReadD(const char* pFieldName, double pDefault=0);
00813 
00817         KTime FieldReadT(const char* pFieldName);
00818 
00820         KTime FieldReadT();
00821 
00825         KTimeSpan FieldReadTS(const char* pFieldName);
00826 
00828         KTimeSpan FieldReadTS();
00829 
00834         void FieldReadFn(float* pValue, kUInt pn);
00835 
00839         void FieldRead3F(float* pValue);
00840 
00844         void FieldRead4F(float* pValue);
00845 
00852         void FieldReadFn(const char* pFieldName, float* pValue, const float *pDefault, kUInt pn);
00853 
00859         void FieldRead3F(const char* pFieldName, float* pValue, const float* pDefault=NULL);
00860 
00866         void FieldRead4F(const char* pFieldName, float* pValue, const float* pDefault=NULL);
00867 
00872         void FieldReadDn(double* pValue, kUInt pn);
00873 
00877         void FieldRead3D(double* pValue);
00878 
00882         void FieldRead4D(double* pValue);
00883 
00890         void FieldReadDn(const char* pFieldName, double* pValue, const double *pDefault, kUInt pn);
00891 
00897         void FieldRead3D(const char* pFieldName, double* pValue, const double* pDefault=NULL);
00898 
00904         void FieldRead4D(const char* pFieldName, double* pValue, const double* pDefault=NULL);
00905 
00909         void* FieldReadR(int* pByteSize);
00910 
00915         void* FieldReadR(const char* pFieldName,int* pByteSize);
00916 
00921 
00922         kByte FieldReadByte();
00923 
00928         kByte FieldReadByte(const char* pFieldName, kByte pDefault=0);
00929 
00931         kUByte FieldReadUByte();
00932 
00937         kUByte FieldReadUByte(const char* pFieldName, kUByte pDefault=0);
00938 
00940         kShort FieldReadShort();
00941 
00946         kShort FieldReadShort(const char* pFieldName, kShort pDefault=0);
00947 
00949         kUShort FieldReadUShort();
00950 
00955         kUShort FieldReadUShort(const char* pFieldName, kUShort pDefault=0);
00956 
00958         unsigned int FieldReadUI();
00959         
00964         unsigned int FieldReadUI(const char* pFieldName, unsigned int pDefault=0);
00965 
00967         kULongLong FieldReadULL();
00968 
00973         kULongLong FieldReadULL(const char* pFieldName, kULongLong pDefault=0);
00974 
00978         const kByte*        FieldReadArraySBytes( int &pCount );
00982         const kShort*       FieldReadArrayShort ( int &pCount );
00986         const kUShort*      FieldReadArrayUShort( int &pCount );
00990         const unsigned int* FieldReadArrayUI    ( int &pCount );
00994         const kULongLong*   FieldReadArrayULL   ( int &pCount );
00995 
00999         const kByte*        FieldReadArray(int &pCount, const kByte*);
01006         const kShort*       FieldReadArray(int &pCount, const kShort*);
01010         const kUShort*      FieldReadArray(int &pCount, const kUShort*);
01014         const unsigned int* FieldReadArray(int &pCount, const unsigned int*);
01018         const kULongLong*   FieldReadArray(int &pCount, const kULongLong*);
01020 
01029         virtual bool FieldReadEmbeddedFile (KString& pFileName, KString& pRelativeFileName, const char* pEmbeddedMediaDirectory = "", bool *pIsFileCreated=NULL);
01030 
01034         const double*   FieldReadArrayD( int &pCount );
01038         const float*    FieldReadArrayF( int &pCount );
01042         const int*      FieldReadArrayI( int &pCount );
01046         const kLongLong*FieldReadArrayLL(int &pCount );
01050         const bool*     FieldReadArrayB( int &pCount );
01054         const kUByte*   FieldReadArrayBytes( int &pCount );
01055 
01059         const int*    FieldReadArray(int& pCount, const int*);
01063         const float*  FieldReadArray(int& pCount, const float*);
01067         const double* FieldReadArray(int& pCount, const double*);
01071         const kLongLong* FieldReadArray(int& pCount, const kLongLong*);
01075         const bool* FieldReadArray(int& pCount, const bool*);
01079         const kUByte* FieldReadArray(int& pCount, const kUByte*);
01080 
01082 
01087 
01091         void FieldWriteBegin(const char* pFieldName);
01092 
01094         void FieldWriteEnd();
01095 
01097         void FieldWriteBlockBegin();
01098 
01104         void FieldWriteObjectBegin(const char* pObjectType, const char* pName, const char* pSubType=NULL);
01105 
01107         void FieldWriteObjectEnd();
01108 
01113         void FieldWriteBlockBegin(const char* pFileName);
01114 
01116         void FieldWriteBlockEnd ();
01117 
01121         void FieldWriteCH(char pValue);
01122 
01127         void FieldWriteCH(const char* pFieldName, char pValue);
01128 
01132         void FieldWriteC(const char* pValue);
01133 
01138         void FieldWriteC(const char* pFieldName, const char* pValue);
01139 
01143         void FieldWriteS(const char* pValue);
01144 
01148         void FieldWriteS(const KString& pValue);
01149 
01154         void FieldWriteS(const char* pFieldName, const char* pValue);
01155 
01160         void FieldWriteS(const char* pFieldName, const KString& pValue);
01161 
01165         void FieldWriteB(bool pValue);
01166 
01171         void FieldWriteB(const char* pFieldName, bool pValue);
01172 
01176         void FieldWriteI(int pValue);
01177 
01182         void FieldWriteI(const char* pFieldName, int pValue);
01183 
01187         void FieldWriteLL(kLongLong pValue);
01188 
01193         void FieldWriteLL(const char* pFieldName, kLongLong pValue);
01194 
01199         void FieldWriteF(float pValue);
01200 
01206         void FieldWriteF(const char* pFieldName, float pValue);
01207 
01211         void FieldWriteD(double  pValue);
01212 
01217         void FieldWriteD(const char* pFieldName, double pValue);
01218 
01222         void FieldWriteT(KTime pTime);
01223 
01228         void FieldWriteT(const char* pFieldName,KTime pValue);
01229 
01233         void FieldWriteTS(KTimeSpan pTimeSpan);
01234 
01239         void FieldWriteTS(const char* pFieldName,KTimeSpan pValue);
01240 
01245         void FieldWriteFn(const float* pValue, kUInt pn);
01246 
01252         void FieldWriteFn(const char* pFieldName, const float* pValue, kUInt pn);
01253 
01257         void FieldWrite3F(const float* pValue);
01258 
01263         void FieldWrite3F(const char* pFieldName, const float* pValue);
01264 
01268         void FieldWrite4F(const float* pValue);
01269 
01274         void FieldWrite4F(const char* pFieldName, const float* pValue);
01275 
01280         void FieldWriteDn(const double* pValue, kUInt pn);
01281 
01287         void FieldWriteDn(const char* pFieldName, const double* pValue, kUInt pn);
01288 
01292         void FieldWrite3D(const double* pValue);
01293 
01298         void FieldWrite3D(const char* pFieldName, const double* pValue);
01299 
01303         void FieldWrite4D(const double* pValue);
01304 
01309         void FieldWrite4D(const char* pFieldName, const double* pValue);
01310 
01311         // The maximum number of value entries is, in theory, 2**32.  In practice it should be a lot less than that.
01312         // pSize is the number of values to write from each pointer location, and stride is how much we 
01313         // advance to get to the next value; if the stride is zero, values are tighly packed together.
01314         // So in total we'll write n * pSize items.
01315 
01322         void FieldWriteArrayD( int n, const double*     pValue, int pSize = 1, int pStride = 0 );
01329         void FieldWriteArrayF( int n, const float*      pValue, int pSize = 1, int pStride = 0 );
01336         void FieldWriteArrayI( int n, const int*        pValue, int pSize = 1, int pStride = 0 );
01343         void FieldWriteArrayLL(int n, const kLongLong*  pValue, int pSize = 1, int pStride = 0 );
01350         void FieldWriteArrayB( int n, const bool*       pValue, int pSize = 1, int pStride = 0 );
01357         void FieldWriteArrayBytes( int n, const kUByte* pValue, int pSize = 1, int pStride = 0 );
01358 
01363         void FieldWriteR(const void* pRawData, int pByteSize);
01364 
01370         void FieldWriteR(const char* pFieldName, const void* pRawData, int pByteSize);
01371 
01376 
01380         void FieldWriteByte(kByte pValue);
01381 
01386         void FieldWriteByte(const char* pFieldName, kByte pValue);
01387 
01391         void FieldWriteUByte(kUByte pValue);
01392 
01397         void FieldWriteUByte(const char* pFieldName, kUByte pValue);
01398 
01402         void FieldWriteShort(kShort pValue);
01403 
01408         void FieldWriteShort(const char* pFieldName, kShort pValue);
01409 
01413         void FieldWriteUShort(kUShort pValue);
01414 
01419         void FieldWriteUShort(const char* pFieldName, kUShort pValue);
01420 
01424         void FieldWriteUI(unsigned int pValue);
01425 
01430         void FieldWriteUI(const char* pFieldName, unsigned int pValue);
01431 
01435         void FieldWriteULL(kULongLong pValue);
01436 
01442         void FieldWriteULL(const char* pFieldName, kULongLong pValue);
01443 
01450         void FieldWriteArraySBytes( int n, const kByte* pValue, int pSize = 1, int pStride = 0 );
01457         void FieldWriteArrayShort( int n, const kShort* pValue, int pSize = 1, int pStride = 0 );
01464         void FieldWriteArrayUShort( int n, const kUShort* pValue, int pSize = 1, int pStride = 0 );
01471         void FieldWriteArrayUI( int n, const unsigned int*        pValue, int pSize = 1, int pStride = 0 );
01478         void FieldWriteArrayULL(int n, const kULongLong*  pValue, int pSize = 1, int pStride = 0 );
01480 
01484         int GetFieldRMaxChunkSize() const;
01485 
01489         void FieldWriteObjectReference(const char* pName);
01490 
01495         void FieldWriteObjectReference(const char* pFieldName, const char* pName);
01496 
01503         bool FieldWriteEmbeddedFile (KString pFileName, KString pRelativeFileName);
01504 
01508         void WriteComments(const char* pFieldName);
01509 
01511 
01516 
01518         enum EError
01519         {
01520             eFileCorrupted,
01521             eFileVersionNotSupportedYet,
01522             eFileVersionNotSupportedAnymore,
01523             eFileNotOpened,
01524             eFileNotCreated,
01525             eDirectoryNotCreated,
01526             eCrcCheckFailed,
01527             eNonExistingSection,
01528             eOperationCanceled,
01529             eCountError,
01530             eInvalidData,
01531             eWriteError,
01532             eReadError,
01533             eErrorCount
01534         };
01535 
01539         KError& GetError();
01540 
01544         EError GetLastErrorID() const;
01545 
01549         const char* GetLastErrorString() const;
01550 
01552 
01553     #ifdef _DEBUG
01554         // Dump function for debugging purpose only
01555         void StdoutDump();
01556     #endif
01557 
01558         bool GetHaveLoadedEmbededFile() const;
01559 
01560         void* GetMemoryFileInfo(kULong& pSize);
01561 
01562     public:
01563         bool    IsBeforeVersion6() const;
01564         void    SetIsBeforeVersion6(bool pIsBeforeVersion6);
01565 
01566     private:
01567         struct KFbxImpl;
01568         KFbxImpl* mImpl;
01569 
01571 
01572         void ProjectClear();
01573         void ProjectReset();
01574 
01575         bool ProjectReadHeader(bool pCheckASCIIHeader, bool pCheckCRC, bool pOpenMainSection, KFbxFileHeaderInfo* pFileHeaderInfo);
01576         bool ProjectReadExtendedHeader(int& pExtendedHeaderEnd, KFbxFileHeaderInfo* pFileHeaderInfo);
01577         bool BinaryReadHeader();
01578         bool BinaryReadSectionPosition();
01579         bool ASCIIReadHeader();
01580         bool ASCIIReadSectionPosition();
01581 
01582         bool ProjectWriteHeader(KFbxFileHeaderInfo* pFileHeaderInfo);
01583         bool ProjectWriteExtendedHeader(KFbxFileHeaderInfo* pFileHeaderInfo);
01584         void BinaryWriteHeader();
01585         void ASCIIWriteHeader();
01586 
01587         void ReadEncryptionKey(char* pEncryptionKey);
01588         void WriteEncryptionKey(char* pEncryptionKey);
01589 
01591 
01592         bool ProjectClearSection();
01593         bool ProjectOpenSection(int pSection);
01594         bool BinaryReadSectionHeader();
01595         int BinaryReadSectionFooter(char* pSourceCheck);
01596         bool BinaryReadExtensionCode(kUInt32 pFollowingSectionStart, kUInt32& pSectionStart, kUInt32& pSectionVersion);
01597         void BinaryReadSectionPassword();
01598 
01599         bool ProjectWriteSectionHeader();
01600         void BinaryWriteSectionFooter();
01601         bool BinaryWriteExtensionCode(kUInt32 pSectionStart, kUInt32 pSectionVersion);
01602 
01603         KString GetCreationTime();
01604         void SetCreationTime(KString pCreationTime);
01605         void CreateSourceCheck(char* lSourceCheck);
01606         bool TestSourceCheck(char* pSourceCheck, char* pSourceCompany);
01607         KString GetMangledCreationTime();
01608         void EncryptSourceCheck(char* pSourceCheck, char* pEncryptionData);
01609         void DecryptSourceCheck(char* pSourceCheck, const char* pEncryptionData);
01610 
01611         void EncryptPasswordV1(KString pOriginalPassword, KString &pEncryptedPassword);
01612         void DecryptPasswordV1(KString pEncryptedPassword, KString &pDecryptedPassword);
01613 
01615 
01616         void CheckValidityOfFieldName(const char* pFieldName);
01617         void GetUnusedEmbeddedName(const KString& pDirectory, const KString& pName, KString& pResult, bool pCreateSubdirectory);
01618 
01620         KString GetDirectory(bool pAutoCreate, const char* pExtension);
01621     };
01622 
01623 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01624 
01625 #endif // FBXFILESDK_COMPONENTS_KBASELIB_KFBX_KFBX_H
01626