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
12//! \file fbxio.h
13#ifndef _FBXSDK_FILEIO_FBX_IO_H_
14#define _FBXSDK_FILEIO_FBX_IO_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/core/base/fbxstring.h>
19#include <fbxsdk/core/base/fbxtime.h>
20#include <fbxsdk/core/base/fbxstatus.h>
21
22#include <fbxsdk/fbxsdk_nsbegin.h>
23
24class FbxIO;
25class FbxReader;
26class FbxWriter;
27class FbxFile;
28class FbxStream;
29class FbxXRefManager;
30
31/**
32 Defines the current FBX file version number in four digits. The first digit is the
33 major version number a the last three digits are the minor version number (e.g. 7100 = 7.1).
34 The following is the version history of FBX:
35
36 \li Version 2000 - New KFCurve and embedded FBX, no FCurve/FCurve node storing.
37 No more .takf file like in earlier version, no history.
38
39 \li Version 2001 - Version incremented to support FbxTime save in native (integer, not double)
40 format.
41
42 \li Version 3000 - FiLMBOX 3.0 version, nothing changed in current class since version 2001.
43 FBX SDK 3.0 and 3.6
44
45 \li Version 3001 - FiLMBOX 3.0 encrypted version, only a trial. Encrypted files could only
46 be written in debug versions. Cannot switch to a higher version number now because any
47 file with a version number >= 3001 is read as encrypted.
48 Hence, this value now only gives file type. (3000 or less -> binary, 3001 or more -> encrypted)
49 FiLMBOX 3.2, FiLMBOX 3.5 and "Online" 3.51 have been released with version 3000.
50
51 \li Version 4000 - MotionBuilder 4.0, new type in KFCurve tangents, supported in FiLMBOX 3.5
52 but not by earlier versions. Version number is now stored in section footer.
53 Before September 3rd 2002, the version number was always 3000 in main section footer.
54 Now the main section footer has version number 4000. The minimum version number in footer of
55 an extension section is 4000.
56
57 \li Version 4001 - ASCII Header is 4.1. MotionBuilder 4.01, to fix FCurveNode problem with
58 layer types in version 4000 the main section footer has version number 4001.
59 Now the footer for extension sections has version number 4001.
60
61 \li Version 4050 - ASCII Header is 4.5. MotionBuilder 4.1 or 4.5 before
62 January 22nd 2003. This is because EvaluationProperties now have color. Now the main section footer
63 has version number 4050.
64 Now the footer for extension sections has version number 4050.
65
66 \li Version 5000 - ASCII Header is not compatible anymore with MotionBuilder 4.0, 4.01 and 4.02 and FBX SDK 3.6 and 3.7
67 MotionBuilder 4.03 and 4.1 or 4.5 from January 22nd 2003
68 FBX SDK 3.6.1. New extended header to improve FBX file version management. Now the extended header and
69 the main section footer have version number 5000. Now the footer for extension sections has version number 5000.
70
71 \li Version 5800 - This was a temporary version while waiting for version 6000 renders the previous versions
72 incompatible with MotionBuilder 6.0. For now, however, this format is needed to allow
73 some tools/plugins (For example Maya) to correctly detect that the file has some features that are not
74 completely backward compatible (For example: pivots defined with _pre/_post nodes which require a special
75 processing). By incrementing only the minor version we do not compromise the integrity of the
76 files.
77
78 \li Version 6000 - Header version is now 6.0.
79 Extended header now contain a creation time stamp
80 that can be retrieve without parsing the main section of the file.
81 A creator tag (string) is now stored in the Extended header. This contain the originator (MB/FBXSDK)
82 of the file and the build number of the originator.
83 First release of the file format using the KProperties to store/retrieve information.
84
85 \li Version 6100 - Added support for multiple attributes (mainly multiple geometry) at the node level.
86 The pointer to the node attribute have been replaced by a connection between the node and its attribute(s).
87
88 \li Version 7000 -
89 First version of the 7.0 series; most likely very short-lived, developed for Protein, before ADP.
90 Supports reference cloning, external documents, blobs, unique IDs (per file), property templates.
91 So many changes that it was decided to break from 6.0 to keep Motion Builder intact.
92
93 \li Version 7099 - Temporary version for FBX 2011 alpha releases.
94
95 \li Version 7100
96 Official file version for FBX 2011, add support for animation to FBX 7.
97 First version of FBX SDK with FBX 7 files as the default file format.
98
99 \li Version 7200
100 Added support for multiple blend shape deformers and In-Between blend-shapes on each geometry.
101 Moved shape(FbxShape) to its own section other than as a part of geometry section.
102 Add support to store blend shape deformer(FbxBlendShape), blend shape channel(FbxBlendShapeChannel),
103 Substance(FbxProceduralTexture) and Lines(FbxLine).
104 Add support to store 3 different smooth binding modes of FbxSkin, including classic linear, dual quaternion
105 and blended mode of previous two modes.
106 Added the CLAMP_PROGRESSIVE tangent mode.
107 The KFCurve::KeyAttrDataFloat data array now stores as integer values (ASCII mode) to to eliminate float to int precision errors.
108 FbxLayeredTexture now stores alphas for its sub textures.
109
110 \li Version 7300
111 Changed the way the CharacterPoses are written.
112 Changed light property name HotSpot and ConeAngle to InnerAngle and OuterAngle
113
114 \li Version 7400
115 Normals, tangents and binormals save the 4th component into a separate array
116
117 \li Version 7500
118 Added support for large files (>2GB). NOTE: This breaks forward compatibility (i.e. older products won't be able to open these files!!)
119
120 */
121
122//File version numbers
123#define FBX_FILE_VERSION_2000 2000 //FBX 2.0
124#define FBX_FILE_VERSION_2001 2001 //FBX 2.01
125#define FBX_FILE_VERSION_3000 3000 //FBX 3.0
126#define FBX_FILE_VERSION_3001 3001 //FBX 3.01
127#define FBX_FILE_VERSION_4000 4000 //FBX 4.0
128#define FBX_FILE_VERSION_4001 4001 //FBX 4.01
129#define FBX_FILE_VERSION_4050 4050 //FBX 4.5
130#define FBX_FILE_VERSION_5000 5000 //FBX 5.0
131#define FBX_FILE_VERSION_5800 5800 //FBX 5.8
132#define FBX_FILE_VERSION_6000 6000 //FBX 6.0
133#define FBX_FILE_VERSION_6100 6100 //FBX 6.1 (guarantee compatibility with Autodesk 2010 products)
134#define FBX_FILE_VERSION_7000 7000 //Compatible with 7.1, and taken as such
135#define FBX_FILE_VERSION_7099 7099 //Compatible with 7.1, and taken as such
136#define FBX_FILE_VERSION_7100 7100 //FBX 7.1 (guarantee compatibility with Autodesk 2011 products)
137#define FBX_FILE_VERSION_7200 7200 //FBX 7.2 (guarantee compatibility with Autodesk 2012 products)
138#define FBX_FILE_VERSION_7300 7300 //FBX 7.3 (guarantee compatibility with Autodesk 2013 products)
139#define FBX_FILE_VERSION_7400 7400 //FBX 7.4 (guarantee compatibility with Autodesk 2014/2015 products)
140#define FBX_FILE_VERSION_7500 7500 //FBX 7.5 (guarantee compatibility with Autodesk 2016 products)
141
142//File version compatibility strings
143#define FBX_53_MB55_COMPATIBLE "FBX53_MB55"
144#define FBX_60_COMPATIBLE "FBX60_MB60"
145#define FBX_2005_08_COMPATIBLE "FBX200508_MB70"
146#define FBX_2006_02_COMPATIBLE "FBX200602_MB75"
147#define FBX_2006_08_COMPATIBLE "FBX200608"
148#define FBX_2006_11_COMPATIBLE "FBX200611"
149#define FBX_2009_00_COMPATIBLE "FBX200900"
150#define FBX_2009_00_V7_COMPATIBLE "FBX200900v7"
151#define FBX_2010_00_COMPATIBLE "FBX201000"
152#define FBX_2011_00_COMPATIBLE "FBX201100"
153#define FBX_2012_00_COMPATIBLE "FBX201200"
154#define FBX_2013_00_COMPATIBLE "FBX201300"
155#define FBX_2014_00_COMPATIBLE "FBX201400"
156#define FBX_2016_00_COMPATIBLE "FBX201600"
157
158//Default file version number used when writing new FBX files
159#define FBX_DEFAULT_FILE_VERSION FBX_FILE_VERSION_7500
160#define FBX_DEFAULT_FILE_COMPATIBILITY FBX_2016_00_COMPATIBLE
161
162/** Convert the FBX file version string to an integral number for <= or >= tests purposes.
163 * \param pFileVersion File version string.
164 * Some examples:
165 * \code
166 * int version;
167 * version = FileVersionStrToInt(FBX2012_00_COMPATIBLE); // version = 201200
168 * version = FileVersionStrToInt(FBX60_COMPATIBLE); // version = 6000
169 * version = FileVersionStrToInt("FBX200900"); // version = 200900
170 * version = FileVersionStrToInt("Toto"); // version = 0
171 * version = FileVersionStrToInt(""); // version = -1
172 * \endcode
173 * \returns the file version number or 0 if an unsupported string value is passed.
174 */
175FBXSDK_DLL int FbxFileVersionStrToInt(const char* pFileVersion);
176
177/** \internal Used internally by readers to evaluate what is the current section */
178enum
179{
180 FBX_NO_SECTION = -1, //!< indicate not in a valid section
181 FBX_MAIN_SECTION, //!< indicate currently in the main section
182 FBX_EXTENSION_SECTION_0 //!< indicate currently in the extention section 0
183};
184
185/** Render and resolution information.
186* \nosubgrouping
187*/
188class FBXSDK_DLL FbxIODefaultRenderResolution
189{
190public:
191 /** If the resolution data is ready. */
192 bool mIsOK;
193 /** camera name. */
194 FbxString mCameraName;
195 /** resolution mode. ex: "Fixed Resolution","Fixed Ratio","Fixed Width","Fixed Height","Window Size"*/
196 FbxString mResolutionMode;
197 /** resolution width. */
198 double mResolutionW;
199 /** resolution height. */
200 double mResolutionH;
201
202 /**
203 * \name Constructors and Destructor
204 */
205 //@{
206 //! Default constructor.
207 FbxIODefaultRenderResolution();
208 //@}
209
210 /**
211 * \name Member Access
212 */
213 //@{
214 //! Reset values to default.
215 void Reset();
216 //@}
217};
218
219/** FBX header information used at beginning of the FBX file
220* to get or set important values like the file format version number (mFileVersion).
221* The file version number will be used to select a particular Reader or Writer.
222* \nosubgrouping */
223class FBXSDK_DLL FbxIOFileHeaderInfo
224{
225public:
226 /**
227 * \name Constructors and Destructor
228 */
229 //@{
230 //! Default constructor.
231 FbxIOFileHeaderInfo();
232
233 //! Destructor.
234 virtual ~FbxIOFileHeaderInfo();
235 //@}
236
237 /**
238 * \name Public Member
239 */
240 //@{
241
242 //! Reset values to default.
243 virtual void Reset();
244
245 /** A derived class can override this function to read additional information from the file header.
246 * \return false in case of failure that should stop loading the file.
247 */
248 virtual bool ReadExtendedHeaderInformation(FbxIO*);
249 //@}
250
251 //! FbxIODefaultRenderResolution to handle default resolution values
252 FbxIODefaultRenderResolution mDefaultRenderResolution;
253
254 //!Read only properties (not used for file write)
255
256 //@{
257 /** File version ex; 5000, 6000, 6100, 7000, 7099, 7100
258 * the major part is the first digit, the minor part, 3 other digits
259 * ex: 7100 means version 7.1
260 */
261 int mFileVersion;
262
263 /** Indicates whether a creation time stamp is preset */
264 bool mCreationTimeStampPresent;
265
266 /** Indicates whether the mCreationTimeStamp member variable contains the actual creation time of the file. */
267 FbxLocalTime mCreationTimeStamp;
268
269 /** Indicates who is the creator of the file
270 * Ex: "FBX SDK/FBX Plugins version 2011.2"
271 */
272 FbxString mCreator;
273
274 /** Indicates whether the file is created by a genuine Autodesk plug-in or not */
275 bool mIOPlugin;
276
277 /** The flag indicates that the header was created by a personal learning edition (PLE) of FBX. */
278 bool mPLE;
279 //@}
280};
281
282/** FbxIO represents an FBX file.
283 * It is primarily used by FBX importers (FbxImporter) and exporter (FbxExporter)
284 * when reading or writing data from or to a disk or memory.
285 * Most users will not use the FbxIO class directly
286 * but will use an instance of either FbxImporter or FbxExporter
287 * to read or write FBX files.
288 *
289 * An FBX file may contain binary data or ASCII data.
290 * A good way to learn the internal structure of a FBX file
291 * is to open a FBX file saved in ASCII in a text editor.
292 *
293 * Ex: to read a FBX file content using FbxIO class directly
294 * \code
295 * // Create a FbxIO object with FbxIO::Create()
296 * // Open the file with ProjectOpen( ... ) a NULL pointer can be passed for (FbxReader)* param
297 * // ProjectOpen_xxx_Section() to open a particular section
298 * int nbSec = FieldGetCount(); // to get the number of fields of the current section opened
299 * for(int i=0; i < nbSec; i++) // read all fields
300 * {
301 * // check if the field is a block
302 * if(FieldReadIsBlock()){ } ... Read sub fields recursively ... may contain other blocks and fields
303 * else
304 * {
305 * FieldReadBegin(); // navigate on the field
306 * char fieldType = FieldReadGetType(); // get the data type
307 *
308 * // According to the Field data type, call the appropriate read functions
309 *
310 * if(fieldType == 'S') FieldReadS(...) to read a string
311 * else if(fieldType == 'B') FieldReadB(...) to read a bool
312 * else if(fieldType == 'I') FieldReadI(...) to read a int
313 * ...
314 * FieldReadEnd(); // navigate to next field
315 * }
316 * }
317 *
318 * ProjectCloseSection() // close the section opened
319 * // repeat for another section ...
320 * // finally close the Project
321 * ProjectClose(); // or delete the FbxIO object created.
322 * \endcode
323 */
324class FBXSDK_DLL FbxIO
325{
326public:
327
328 /** \internal Exception-safe way of setting/resetting the xref manager in a FbxIO object.
329 */
330 struct FbxAutoResetXRefManager
331 {
332 FbxIO* mFbx;
333 const FbxXRefManager* mXRefManager;
334
335 /** Default constructor */
336 FbxAutoResetXRefManager(FbxIO* pFbx, FbxXRefManager& pXRefManager)
337 : mFbx(pFbx)
338 , mXRefManager(NULL)
339 {
340 if( mFbx )
341 {
342 mXRefManager = mFbx->ProjectGetXRefManager();
343 mFbx->ProjectSetXRefManager(&pXRefManager);
344 }
345 }
346
347 /** Destructor */
348 ~FbxAutoResetXRefManager()
349 {
350 if( mFbx )
351 {
352 mFbx->ProjectSetXRefManager(mXRefManager);
353 }
354 }
355 };
356
357 enum BinaryType
358 {
359 BinaryNormal, //<! Standard FBX file field alignment using 32bit values, used by all file format version 7.4.0 or lower
360 BinaryLarge //<! New FBX file field alignment using 64bit values, used by all file format version 7.5.0 or higher
361 };
362
363 /** Creation function for this FbxIO class
364 * \param pStatus The FbxStatus object to hold error codes.
365 * \return a new FbxIO object pointer
366 */
367 static FbxIO* Create(BinaryType pBinaryType, FbxStatus& pStatus){ return FbxNew< FbxIO >(pBinaryType, pStatus); }
368
369 /** Default constructor */
370 FbxIO(BinaryType pBinaryType, FbxStatus& pStatus);
371
372 /** Destructor */
373 virtual ~FbxIO();
374
375 /**
376 * \name Project Global
377 * The term "Project" here is an abstract name chosen to represent a group of data
378 * ex: a file, a stream, a memory buffer, etc.
379 */
380 //@{
381
382 /** Open a project already in Memory
383 * \param pAddress
384 * \param pMaxLength
385 * \param pReader
386 * \param pCheckCRC
387 * \param pOpenMainSection
388 * \param pFileHeaderInfo
389 * \return \c true on success, \c false otherwise.
390 */
391 bool ProjectOpen(void* pAddress, FbxULong pMaxLength, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
392
393 /** Open a project.
394 * \param pName
395 * \param pReader
396 * \param pCheckCRC
397 * \param pOpenMainSection
398 * \param pFileHeaderInfo
399 * \return \c true on success, \c false otherwise.
400 */
401 bool ProjectOpen(const char* pName, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
402
403 /** Open a project.
404 * \param pStream
405 * \param pStreamData
406 * \param pReader
407 * \param pCheckCRC
408 * \param pOpenMainSection
409 * \param pFileHeaderInfo
410 * \return \c true on success, \c false otherwise.
411 */
412 bool ProjectOpen(FbxStream* pStream, void* pStreamData, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
413
414 /** Open project file without necessarily an .fbx extension.
415 * \param pName
416 * \param pReader
417 * \param pCheckCRC
418 * \param pOpenMainSection
419 * \param pFileHeaderInfo
420 * \return \c true on success, \c false otherwise.
421 */
422 bool ProjectOpenDirect(const char* pName, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
423
424 /** Create a project in Memory
425 * \param pAddress
426 * \param pSize
427 * \param pWriter
428 * \param pBinary
429 * \param pEncrypted
430 * \param pFileHeaderInfo
431 * \return \c true on success, \c false otherwise.
432 */
433 bool ProjectCreate(void* pAddress, FbxUInt pSize, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
434
435 /** Create a project.
436 * \param pName
437 * \param pWriter
438 * \param pBinary
439 * \param pEncrypted
440 * \param pFileHeaderInfo
441 * \return \c true on success, \c false otherwise.
442 */
443 bool ProjectCreate(const char* pName, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
444
445 /** Create a project.
446 * \param pStream
447 * \param pStreamData
448 * \param pWriter
449 * \param pBinary
450 * \param pEncrypted
451 * \param pFileHeaderInfo
452 * \return \c true on success, \c false otherwise.
453 */
454 bool ProjectCreate(FbxStream* pStream, void* pStreamData, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
455
456 /** Create a project without necessary an .fbx extension.
457 * \param pName
458 * \param pWriter
459 * \param pBinary
460 * \param pEncrypted
461 * \param pFileHeaderInfo
462 * \return \c true on success, \c false otherwise.
463 */
464 bool ProjectCreateDirect(const char* pName, FbxWriter* pWriter, bool pBinary, bool pEncrypted, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
465
466 /** Create a project, without writing out the header (yet)
467 * \param pName
468 * \param pWriter
469 * \param pVersion
470 * \param pBinary
471 * \param pEncrypted
472 * \return \c true on success, \c false otherwise.
473 */
474 bool ProjectCreateEmpty(const char* pName, FbxWriter* pWriter, int pVersion, bool pBinary, bool pEncrypted);
475
476 /** Create a project, without writing out the header (yet)
477 * \param pStream
478 * \param pStreamData
479 * \param pWriter
480 * \param pVersion
481 * \param pBinary
482 * \param pEncrypted
483 * \return \c true on success, \c false otherwise.
484 */
485 bool ProjectCreateEmpty(FbxStream* pStream, void* pStreamData, FbxWriter* pWriter, int pVersion, bool pBinary, bool pEncrypted);
486
487 /** Write FBX signature at the top of the file, prepare file for writing header information
488 * \return \c true on success, \c false otherwise.
489 */
490 bool ProjectWrite_BeginFileHeader();
491
492 /** Open up the 'extended header'
493 * \return \c true on success, \c false otherwise.
494 */
495 bool ProjectWrite_BeginExtendedHeader();
496
497 /** Write the contents of the extended header
498 * \param pExtendedHeader
499 * \return \c true on success, \c false otherwise.
500 */
501 bool ProjectWrite_WriteExtendedHeader(const FbxIOFileHeaderInfo* pExtendedHeader);
502
503 /** Close the extended header
504 * \return \c true on success, \c false otherwise.
505 */
506 bool ProjectWrite_EndExtendedHeader();
507
508 /** Close up the header, prepare file for payload write.
509 * \return \c true on success, \c false otherwise.
510 */
511 bool ProjectWrite_EndFileHeader();
512
513 /** Close the project.
514 * \param pData
515 * \param pSize
516 * \return \c true on success, \c false otherwise.
517 */
518 bool ProjectClose(void** pData=0, size_t* pSize=0);
519
520 /** Provide the XRef Manager to use to create the .fbm folder.
521 * \remarks If NULL is used, the old behavior (using the .fbx's folder) is used instead.
522 */
523 void ProjectSetXRefManager(const FbxXRefManager*);
524
525 /** Get the XRef Manager to use.
526 * \return NULL if no XRef manager has been set.
527 */
528 const FbxXRefManager* ProjectGetXRefManager() const;
529
530 /** Select (and create) a folder to store embedded files (the .fbm
531 * file folder). Takes into account the settings from the XRef Manager.
532 * \param pXRefManager
533 * \param pCreatedFolder
534 * \param pUserDefinedFolder User defined "working folder"
535 * \return \c true on success, \c false otherwise.
536 * \remarks If this already been called successfully, uses the path
537 * previously created.
538 *
539 * Client application is responsible for cleaning up this folder.
540 *
541 * This will be automatically called if ProjectSetXRefManager()
542 * has been called before the .fbm folder needs to be created.
543 */
544 bool ProjectCreateEmbeddedFolder(const FbxXRefManager& pXRefManager, FbxString& pCreatedFolder, const char* pUserDefinedFolder = NULL);
545
546 /** On store event, use this function to tell if we are embedding.
547 * \param pValue
548 */
549 void SetEmbedded(bool pValue);
550
551 /** Explicitly set the embedding extraction folder. If this is never called, the FBX SDK will determine the best folder to extract embedded files.
552 * \param pExtractionFolder The file path name where the embedded files should be extracted.
553 */
554 void SetEmbeddingExtractionFolder(const char* pExtractionFolder);
555
556 /** Retrieve the current folder destination where the embedded files will be extracted. This might not be initialized until file I/O is performed.
557 */
558 const char* GetEmbeddingExtractionFolder();
559
560 /** Check if file is embedded or not.
561 * \return \c true if file is embedded, false otherwise.
562 */
563 bool IsEmbedded() const;
564
565 /** Check if file is binary or ASCII
566 * \return \c true if file is binary, false otherwise.
567 */
568 bool IsBinary() const;
569
570 /** Return if binary file is encrypted
571 * \return \c true if file is encrypted, false otherwise.
572 */
573 bool IsEncrypted () const;
574
575 /** Check CRC code. File must be open, binary and encrypted.
576 * \return \c true if CRC code is valid or file is not open, binary and encrypted.
577 */
578 bool CheckCRC();
579
580 /** Return the file version number
581 * \return the file version number
582 */
583 FbxUInt32 GetFileVersionNumber() const;
584
585 /** Set the cache size for accelerated IO
586 * \param pCacheSize cache size to set (Kilo Byte)
587 */
588 void CacheSize(FbxUInt32 pCacheSize);
589
590 /** Return the current cache size
591 * \return the current cache size
592 */
593 FbxUInt32 CacheSize() const;
594
595 //@}
596
597 /**
598 * \name FBX 7 Format specific functions.
599
600 The FBX 7 format can compress internal arrays to make the file smaller.
601 The writer may decide not to compress all arrays, or it may even decide
602 not to compress anyway. Flags are written in the file to help the FBX7 reader
603 to know if a decompression is required, on a per-array basis.
604 The following functions address specific topics of the FBX 7 file format.
605 */
606 //@{
607
608 //! \return Current state of the flag.
609 bool Fbx7Support() const;
610
611 /** Set the flag state to tell the parser to handle FBX7 files.
612 * \param pSupport New flag state.
613 */
614 void Fbx7Support(bool pSupport);
615
616 //! \return Current State of the flag.
617 bool CompressArrays() const;
618
619 /** Set the flag state.
620 * \param pCompress New flag state.
621 */
622 void CompressArrays(bool pCompress);
623
624 //! \return Current compression minimum size.
625 int CompressMinimumSize() const;
626
627 /** Set the compression minimum size.
628 * \param pSize Threshold at which compression may embark.
629 */
630 void CompressMinimumSize(int pSize);
631
632 //! \return Current compression level.
633 int CompressLevel() const;
634
635 /** Set the compression level.
636 * \param pLevel Value of the desired compression.
637 * \remarks The allowed range for pLevel is [0-9] where 0 equals no compression and
638 * 9 is as-much-as-we-can.
639 */
640 void CompressLevel(int pLevel);
641 //@}
642
643 /**
644 * \name Project related functions used to navigate on particular
645 * sections.
646 */
647 //@{
648
649 /** Open the main section of a project.
650 * \return \c true on success, \c false otherwise.
651 */
652 bool ProjectOpenMainSection();
653
654 /** Get the number of extension sections of a project.
655 * \return the number of extension sections of a project.
656 */
657 int ProjectGetExtensionSectionCount() const;
658
659 /** Open an extension section of a project.
660 * \param pExtensionSectionIndex
661 * \return \c true on success, \c false otherwise.
662 */
663 bool ProjectOpenExtensionSection(int pExtensionSectionIndex);
664
665 /** Create an extension section in a project, not allowed in ASCII and encrypted modes.
666 * \param pOverwriteLastExtensionSection
667 * \return \c true on success, \c false otherwise.
668 */
669 bool ProjectCreateExtensionSection(bool pOverwriteLastExtensionSection = false);
670
671 /** Close current section.
672 */
673 void ProjectCloseSection();
674
675 /** Get current section.
676 * \return the current section.
677 */
678 int ProjectGetCurrentSection() const;
679
680 /** Get current section mode.
681 * \return the current section mode.
682 */
683 int ProjectGetCurrentSectionMode() const;
684
685 /** Get current section version.
686 * \return the current section version.
687 */
688 int ProjectGetCurrentSectionVersion() const;
689
690 /** Get the version number of a section.
691 * \param pSection
692 * \return the version number of a section.
693 * \remarks For main section it can be either 1000, 2000, 2001, 3000, 3001, 4000, 4001 or 4050.
694 * For the extension section it can be either 4000, 4001 or 4050.
695 * Returns 0 if section number does not exist.
696 */
697 int ProjectGetSectionVersion(int pSection) const;
698
699 /** Split a version number into major, minor and revision numbers.
700 * \param pVersion Version number to split.
701 * \param pMajor Integer to receive major version number.
702 * \param pMinor Integer to receive minor version number.
703 * \param pRevision Integer to receive revision version number.
704 */
705 static void ProjectConvertVersionNumber(int pVersion, int& pMajor, int& pMinor, int& pRevision);
706
707 /** Check the password protection flag.
708 * \return \c true if the current section has a password, \c false otherwise.
709 */
710 bool IsPasswordProtected() const;
711
712 /** Set password protection flag to \c false if the argument matches the password stored in the section.
713 * \param pPassword
714 * \return \c true if the argument matches the password stored in the section, \c false otherwise.
715 * \remarks This function only works in read mode.
716 */
717 bool CheckPassword(const char* pPassword);
718
719 /** Encrypt and store password in a section.
720 * \param pPassword
721 * \return \c true on success, \c false otherwise.
722 * \remarks This function only works in write mode and out of any enclosing block.
723 * \remarks This function must not be called more than once per section.
724 */
725 bool WritePassword(const char* pPassword);
726
727 //@}
728
729 /**
730 * \name Directory related functions used to get or set file path information.
731 */
732 //@{
733
734 /** Get project file name.
735 * \return project file name.
736 */
737 const char* GetFilename() const;
738
739 /** Get project data directory name.
740 * \param pAutoCreate
741 * \return project data directory name.
742 */
743 FbxString GetDataDirectory(bool pAutoCreate = true);
744
745 /** Get the current embedded folder used by this object.
746 * \param pCreate Whether create the media or not if no such folder is found
747 * \param pUserDefinedFolder User define working folder
748 * \return the current embedded folder used by this object.
749 * \remarks If ProjectCreateEmbeddedFolder has never been called this will
750 * return an empty string, unless we're explicitly asked to
751 * create it.
752 */
753 FbxString GetMediaDirectory(bool pCreate = false, const char* pUserDefinedFolder = NULL);
754
755 /** Get the full path of the directory to extract the template file.
756 * \param pTemplateName
757 * \param pCreate
758 * \return the full path of the directory to extract the template file.
759 */
760 FbxString GetContainerTemplateDirectory(const char* pTemplateName, bool pCreate);
761
762 /** Get the path relative to project directory.
763 * \param pPath
764 * \return the path relative to project directory.
765 */
766 char* GetRelativePath(const char* pPath);
767
768 /** Get the file path relative to project directory.
769 * \param pFilePath
770 * \return the file path relative to project directory.
771 */
772 char* GetRelativeFilePath(const char* pFilePath);
773
774 /** Get the full path of path relative to project directory.
775 * \param pRelativePath
776 * \return the full path of path relative to project directory.
777 */
778 char* GetFullPath(const char* pRelativePath);
779
780 /** Get the full file path of path relative to project directory.
781 * \param pRelativeFilePath
782 * \return the full file path of path relative to project directory.
783 */
784 char* GetFullFilePath(const char* pRelativeFilePath);
785
786 /** Get the temporary project name.
787 * \param pName
788 * \return the temporary project name.
789 */
790 char* GetTmpProjectName(const char* pName) const;
791
792 /** Swap from temporary project.
793 * \param pName
794 * \param pError
795 * \param pErrorSize
796 * \return \c true on success, \c false otherwise.
797 */
798 bool SwapFromTmpProject(const char* pName, char* pError=NULL, int pErrorSize=0);
799
800 //@}
801
802 /**
803 * \name Read related functions used to get information of a field or a group of fields.
804 * Can be used to get the field content data or to navigate from field to field.
805 */
806 //@{
807
808 /** Reset the field read position.
809 */
810 void FieldReadResetPosition();
811
812 /** Get the number of fields.
813 * \return the number of fields.
814 */
815 int FieldGetCount() const;
816
817 /** Get the name of field indexed pFieldIndex.
818 * \param pFieldIndex
819 * \return the name of field indexed pFieldIndex.
820 */
821 const char* FieldGetName(int pFieldIndex) const;
822
823 /** Get number of instance field pFieldName has.
824 * \param pFieldName
825 * \return the number of instance field pFieldName has.
826 */
827 int FieldGetInstanceCount(const char* pFieldName) const;
828
829 /** Start to read field instance referred by field indexed pFieldIndex, instance indexed pInstance.
830 * \param pFieldIndex
831 * \param pInstance
832 * \return \c true on success, \c false otherwise.
833 */
834 bool FieldReadBegin(int pFieldIndex, int pInstance);
835
836 /** Start to read field pFieldName.
837 * \param pFieldName
838 * \return \c true on success, \c false otherwise.
839 */
840 bool FieldReadBegin(const char* pFieldName);
841
842 /** Start to read field instance referred field pFieldName, instance indexed pInstance.
843 * \param pFieldName
844 * \param pInstance
845 * \return \c true on success, \c false otherwise.
846 */
847 bool FieldReadBegin(const char* pFieldName, int pInstance);
848
849 //! Stop to read the current field.
850 void FieldReadEnd();
851
852 //! Return if current field is a block.
853 bool FieldReadIsBlock();
854
855 //! Start to read a field block.
856 bool FieldReadBlockBegin();
857
858 //! Stop to read a field block.
859 void FieldReadBlockEnd();
860
861 //! Return the number of read field.
862 int FieldReadGetCount() const;
863
864 //! Return the number of field remaining to be read.
865 int FieldReadGetRemain() const;
866
867 //! Return current field value type.
868 char FieldReadGetType() const;
869
870 //! Return current field value as a char.
871 char FieldReadCH();
872
873 /** Return field pFieldName's value as a char.
874 * \param pFieldName
875 * \param pDefault
876 */
877 char FieldReadCH(const char* pFieldName, char pDefault=0);
878
879 //! Return current field value as a char pointer.
880 const char* FieldReadC();
881
882 /** Return field pFieldName's value as a char pointer.
883 * \param pFieldName
884 * \param pDefault
885 */
886 const char* FieldReadC(const char* pFieldName, const char* pDefault="");
887
888 //! Return current field value as a string (a char pointer).
889 const char* FieldReadS();
890
891 /** Return field pFieldName's value as a char pointer.
892 * \param pFieldName
893 * \param pDefault
894 */
895 const char* FieldReadS(const char* pFieldName, const char* pDefault="");
896
897 //! Return current field value as an bool.
898 bool FieldReadB();
899
900 /** Return field pFieldName's value as an integer.
901 * \param pFieldName
902 * \param pDefault
903 */
904 bool FieldReadB(const char* pFieldName, bool pDefault = false);
905
906 //! Return current field value as an integer.
907 int FieldReadI();
908
909 /** Return field pFieldName's value as an integer.
910 * \param pFieldName
911 * \param pDefault
912 */int FieldReadI(const char* pFieldName, int pDefault=0);
913
914 //! Return current field value as an integer.
915 FbxLongLong FieldReadLL();
916
917 /** Return field pFieldName's value as an integer.
918 * \param pFieldName
919 * \param pDefault
920 */
921 FbxLongLong FieldReadLL(const char* pFieldName, FbxLongLong pDefault=0);
922
923 //! Return current field value as a float.
924 float FieldReadF();
925
926 /** Return field pFieldName's value as a float.
927 * \param pFieldName
928 * \param pDefault
929 */
930 float FieldReadF(const char* pFieldName, float pDefault=0);
931
932 //! Return current field value as a double.
933 double FieldReadD();
934
935 /** Return field pFieldName's value as a double.
936 * \param pFieldName
937 * \param pDefault
938 */
939 double FieldReadD(const char* pFieldName, double pDefault=0);
940
941 /** Return field pFieldName's value as a time value.
942 * \param pFieldName
943 */
944 FbxTime FieldReadT(const char* pFieldName);
945
946 //! Return field pFieldName's value as a time value.
947 FbxTime FieldReadT();
948
949 /** Return field pFieldName's value as a timespan value.
950 * \param pFieldName
951 */
952 FbxTimeSpan FieldReadTS(const char* pFieldName);
953
954 //! Return field pFieldName's value as a timespan value.
955 FbxTimeSpan FieldReadTS();
956
957 /** Return current field value as a n floats array.
958 * \param pValue
959 * \param pn
960 */
961 void FieldReadFn(float* pValue, FbxUInt pn);
962
963 /** Return current field value as a 3 floats array.
964 * \param pValue
965 */
966 void FieldRead3F(float* pValue);
967
968 /** Return current field value as a 4 floats array.
969 * \param pValue
970 */
971 void FieldRead4F(float* pValue);
972
973 /** Return field pFieldName's value as n floats array.
974 * \param pFieldName
975 * \param pValue
976 * \param pDefault
977 * \param pn
978 */
979 void FieldReadFn(const char* pFieldName, float* pValue, const float *pDefault, FbxUInt pn);
980
981 /** Return field pFieldName's value as 4 floats array.
982 * \param pFieldName
983 * \param pValue
984 * \param pDefault
985 */
986 void FieldRead3F(const char* pFieldName, float* pValue, const float* pDefault=NULL);
987
988 /** Return field pFieldName's value as 3 floats array.
989 * \param pFieldName
990 * \param pValue
991 * \param pDefault
992 */
993 void FieldRead4F(const char* pFieldName, float* pValue, const float* pDefault=NULL);
994
995 /** Return current field value as a n doubles array.
996 * \param pValue
997 * \param pn
998 */
999 void FieldReadDn(double* pValue, FbxUInt pn);
1000
1001 /** Return current field value as a 3 doubles array.
1002 * \param pValue
1003 */
1004 void FieldRead3D(double* pValue);
1005
1006 /** Return current field value as a 4 doubles array.
1007 * \param pValue
1008 */
1009 void FieldRead4D(double* pValue);
1010
1011 /** Return field pFieldName's value as n doubles array.
1012 * \param pFieldName
1013 * \param pValue
1014 * \param pDefault
1015 * \param pn
1016 */
1017 void FieldReadDn(const char* pFieldName, double* pValue, const double *pDefault, FbxUInt pn);
1018
1019 /** Return field pFieldName's value as 4 doubles array.
1020 * \param pFieldName
1021 * \param pValue
1022 * \param pDefault
1023 */
1024 void FieldRead3D(const char* pFieldName, double* pValue, const double* pDefault=NULL);
1025
1026 /** Return field pFieldName's value as 3 doubles array.
1027 * \param pFieldName
1028 * \param pValue
1029 * \param pDefault
1030 */
1031 void FieldRead4D(const char* pFieldName, double* pValue, const double* pDefault=NULL);
1032
1033 /** Return current field value as raw data.
1034 * \param pByteSize
1035 */
1036 void* FieldReadR(int* pByteSize);
1037
1038 /** Return field pFieldName's value as raw data.
1039 * \param pFieldName
1040 * \param pByteSize
1041 */
1042 void* FieldReadR(const char* pFieldName,int* pByteSize);
1043
1044 /**
1045 * \name FBX SDK 2009.3 and later
1046 */
1047 //@{
1048 //! Return field pFieldName's value as byte.
1049 FbxChar FieldReadByte();
1050
1051 /** Return field pFieldName's value as a byte value.
1052 * \param pFieldName
1053 * \param pDefault
1054 */
1055 FbxChar FieldReadByte(const char* pFieldName, FbxChar pDefault=0);
1056
1057 //! Return field pFieldName's value as unsigned byte.
1058 FbxUChar FieldReadUByte();
1059
1060 /** Return field pFieldName's value as an unsigned byte value.
1061 * \param pFieldName
1062 * \param pDefault
1063 */
1064 FbxUChar FieldReadUByte(const char* pFieldName, FbxUChar pDefault=0);
1065
1066 //! Return field pFieldName's value as short.
1067 FbxShort FieldReadShort();
1068
1069 /** Return field pFieldName's value as a short value.
1070 * \param pFieldName
1071 * \param pDefault
1072 */
1073 FbxShort FieldReadShort(const char* pFieldName, FbxShort pDefault=0);
1074
1075 //! Return field pFieldName's value as unsigned short.
1076 FbxUShort FieldReadUShort();
1077
1078 /** Return field pFieldName's value as an unsigned short value.
1079 * \param pFieldName
1080 * \param pDefault
1081 */
1082 FbxUShort FieldReadUShort(const char* pFieldName, FbxUShort pDefault=0);
1083
1084 //! Return field pFieldName's value as unsigned integer.
1085 unsigned int FieldReadUI();
1086
1087 /** Return field pFieldName's value as an unsigned int as a value.
1088 * \param pFieldName
1089 * \param pDefault
1090 */
1091 unsigned int FieldReadUI(const char* pFieldName, unsigned int pDefault=0);
1092
1093 //! Return field pFieldName's value as 64 bit unsigned integer.
1094 FbxULongLong FieldReadULL();
1095
1096 /** Return field pFieldName's value as an 64 bit unsigned int as a value.
1097 * \param pFieldName
1098 * \param pDefault
1099 */
1100 FbxULongLong FieldReadULL(const char* pFieldName, FbxULongLong pDefault=0);
1101
1102 /** Read the whole array and return the pointer to it.
1103 * \param pCount Nb of items in the array.
1104 */
1105 const FbxChar* FieldReadArraySBytes( int &pCount );
1106 /** Read the whole array and return the pointer to it.
1107 * \param pCount Nb of items in the array.
1108 */
1109 const FbxShort* FieldReadArrayShort ( int &pCount );
1110 /** Read the whole array and return the pointer to it.
1111 * \param pCount Nb of items in the array.
1112 */
1113 const FbxUShort* FieldReadArrayUShort( int &pCount );
1114 /** Read the whole array and return the pointer to it.
1115 * \param pCount Nb of items in the array.
1116 */
1117 const unsigned int* FieldReadArrayUI ( int &pCount );
1118 /** Read the whole array and return the pointer to it.
1119 * \param pCount Nb of items in the array.
1120 */
1121 const FbxULongLong* FieldReadArrayULL ( int &pCount );
1122
1123 /** Read the whole array and return the pointer to it.
1124 * \param pCount Nb of items in the array.
1125 */
1126 const FbxChar* FieldReadArray(int &pCount, const FbxChar*);
1127 /** Read the whole array and return the pointer to it.
1128 * \param pCount Nb of items in the array.
1129 */
1130 /** Read the whole array and return the pointer to it.
1131 * \param pCount Nb of items in the array.
1132 */
1133 const FbxShort* FieldReadArray(int &pCount, const FbxShort*);
1134 /** Read the whole array and return the pointer to it.
1135 * \param pCount Nb of items in the array.
1136 */
1137 const FbxUShort* FieldReadArray(int &pCount, const FbxUShort*);
1138 /** Read the whole array and return the pointer to it.
1139 * \param pCount Nb of items in the array.
1140 */
1141 const unsigned int* FieldReadArray(int &pCount, const unsigned int*);
1142 /** Read the whole array and return the pointer to it.
1143 * \param pCount Nb of items in the array.
1144 */
1145 const FbxULongLong* FieldReadArray(int &pCount, const FbxULongLong*);
1146 //@}
1147
1148 /** Read field and copy it into a file.
1149 * \param pFileName Embedded file full path+name.
1150 *\param pRelativeFileName Relative path+name of the embedded file.
1151 * \param pEmbeddedMediaDirectory Directory of the embedded media.
1152 * \param pIsFileCreated Status of the extraction of the embedded data. Set to \c true if the embedded media is correctly extracted in the media directory.
1153 * \remarks Only works when file is binary. This function is not related to flag mEmbedded.
1154 * \return \c false if operation failed.
1155 */
1156 virtual bool FieldReadEmbeddedFile (FbxString& pFileName, FbxString& pRelativeFileName, const char* pEmbeddedMediaDirectory = "", bool *pIsFileCreated=NULL);
1157
1158 /** Read the whole array and return the pointer to it.
1159 * \param pCount Nb of items in the array.
1160 */
1161 const double* FieldReadArrayD( int &pCount );
1162 /** Read the whole array and return the pointer to it.
1163 * \param pCount Nb of items in the array.
1164 */
1165 const float* FieldReadArrayF( int &pCount );
1166 /** Read the whole array and return the pointer to it.
1167 * \param pCount Nb of items in the array.
1168 */
1169 const int* FieldReadArrayI( int &pCount );
1170 /** Read the whole array and return the pointer to it.
1171 * \param pCount Nb of items in the array.
1172 */
1173 const FbxLongLong*FieldReadArrayLL(int &pCount );
1174 /** Read the whole array and return the pointer to it.
1175 * \param pCount Nb of items in the array.
1176 */
1177 const bool* FieldReadArrayB( int &pCount );
1178 /** Read the whole array and return the pointer to it.
1179 * \param pCount Nb of items in the array.
1180 */
1181 const FbxUChar* FieldReadArrayBytes( int &pCount );
1182
1183 /** Read the whole array and return the pointer to it.
1184 * \param pCount Nb of items in the array.
1185 */
1186 const int* FieldReadArray(int& pCount, const int*);
1187 /** Read the whole array and return the pointer to it.
1188 * \param pCount Nb of items in the array.
1189 */
1190 const float* FieldReadArray(int& pCount, const float*);
1191 /** Read the whole array and return the pointer to it.
1192 * \param pCount Nb of items in the array.
1193 */
1194 const double* FieldReadArray(int& pCount, const double*);
1195 /** Read the whole array and return the pointer to it.
1196 * \param pCount Nb of items in the array.
1197 */
1198 const FbxLongLong* FieldReadArray(int& pCount, const FbxLongLong*);
1199 /** Read the whole array and return the pointer to it.
1200 * \param pCount Nb of items in the array.
1201 */
1202 const bool* FieldReadArray(int& pCount, const bool*);
1203 /** Read the whole array and return the pointer to it.
1204 * \param pCount Nb of items in the array.
1205 */
1206 const FbxUChar* FieldReadArray(int& pCount, const FbxUChar*);
1207
1208 //@}
1209
1210 /**
1211 * \name Write related functions used to write information of a field or a group of fields.
1212 * Can be used to write the field content data or to navigate from field to field.
1213 */
1214 //@{
1215
1216 /** Start to write a field called pFieldName.
1217 * \param pFieldName
1218 */
1219 void FieldWriteBegin(const char* pFieldName);
1220
1221 //! Stop to write the current field.
1222 void FieldWriteEnd();
1223
1224 //! Start to write a field block.
1225 void FieldWriteBlockBegin();
1226
1227 /** Start to write an object reference field.
1228 * \param pObjectType
1229 * \param pName
1230 * \param pSubType
1231 */
1232 void FieldWriteObjectBegin(const char* pObjectType, const char* pName, const char* pSubType=NULL);
1233
1234 //! Stop to write an object reference field.
1235 void FieldWriteObjectEnd();
1236
1237 /** Start to write a field block in file pFileName.
1238 * \param pFileName
1239 * \remarks This function is disabled but kept accessible for the FBX SDK.
1240 */
1241 void FieldWriteBlockBegin(const char* pFileName);
1242
1243 //! Stop to write a block of field.
1244 void FieldWriteBlockEnd ();
1245
1246 /** Write field value as a char.
1247 * \param pValue
1248 */
1249 void FieldWriteCH(char pValue);
1250
1251 /** Write field pFieldName field with a char as a value.
1252 * \param pFieldName
1253 * \param pValue
1254 */
1255 void FieldWriteCH(const char* pFieldName, char pValue);
1256
1257 /** Write field value as char pointer pValue.
1258 * \param pValue
1259 */
1260 void FieldWriteC(const char* pValue);
1261
1262 /** Write field pFieldName with a char pointer as a value.
1263 * \param pFieldName
1264 * \param pValue
1265 */
1266 void FieldWriteC(const char* pFieldName, const char* pValue);
1267
1268 /** Write field value as FbxString pValue.
1269 * \param pValue
1270 */
1271 void FieldWriteS(const char* pValue);
1272
1273 /** Write field value as FbxString pValue.
1274 * \param pValue
1275 */
1276 void FieldWriteS(const FbxString& pValue);
1277
1278 /** Write field pFieldName field with a FbxString as a value.
1279 * \param pFieldName
1280 * \param pValue
1281 */
1282 void FieldWriteS(const char* pFieldName, const char* pValue);
1283
1284 /** Write field pFieldName field with a FbxString as a value.
1285 * \param pFieldName
1286 * \param pValue
1287 */
1288 void FieldWriteS(const char* pFieldName, const FbxString& pValue);
1289
1290 /** Write field value as bool.
1291 * \param pValue
1292 */
1293 void FieldWriteB(bool pValue);
1294
1295 /** Write field pFieldName field with a bool value.
1296 * \param pFieldName
1297 * \param pValue
1298 */
1299 void FieldWriteB(const char* pFieldName, bool pValue);
1300
1301 /** Write field value as integer.
1302 * \param pValue
1303 */
1304 void FieldWriteI(int pValue);
1305
1306 /** Write field pFieldName field with an int as a value.
1307 * \param pFieldName
1308 * \param pValue
1309 */
1310 void FieldWriteI(const char* pFieldName, int pValue);
1311
1312 /** Write field value as 64 bit integer.
1313 * \param pValue
1314 */
1315 void FieldWriteLL(FbxLongLong pValue);
1316
1317 /** Write field pFieldName field with an 64 bit int as a value.
1318 * \param pFieldName
1319 * \param pValue
1320 */
1321 void FieldWriteLL(const char* pFieldName, FbxLongLong pValue);
1322
1323 /** Write field value as float.
1324 * \param pValue
1325 * \remarks Only compatible with 1) MotionBuilder 4.0 and later 2) FBX SDK 3.6.1 and later.
1326 */
1327 void FieldWriteF(float pValue);
1328
1329 /** Write field pFieldName field with a float as a value.
1330 * \param pFieldName
1331 * \param pValue
1332 * \remarks Only compatible with 1) MotionBuilder 4.0 and later 2) FBX SDK 3.6.1 and later.
1333 */
1334 void FieldWriteF(const char* pFieldName, float pValue);
1335
1336 /** Write field value as double.
1337 * \param pValue
1338 */
1339 void FieldWriteD(double pValue);
1340
1341 /** Write field pFieldName field with a double as a value.
1342 * \param pFieldName
1343 * \param pValue
1344 */
1345 void FieldWriteD(const char* pFieldName, double pValue);
1346
1347 /** Write field value as time value.
1348 * \param pTime
1349 */
1350 void FieldWriteT(FbxTime pTime);
1351
1352 /** Write field pFieldName field with a time as a value.
1353 * \param pFieldName
1354 * \param pValue
1355 */
1356 void FieldWriteT(const char* pFieldName,FbxTime pValue);
1357
1358 /** Write field value as timespan value.
1359 * \param pTimeSpan
1360 */
1361 void FieldWriteTS(FbxTimeSpan pTimeSpan);
1362
1363 /** Write field pFieldName field with a timespan as a value.
1364 * \param pFieldName
1365 * \param pValue
1366 */
1367 void FieldWriteTS(const char* pFieldName,FbxTimeSpan pValue);
1368
1369 /** Write field value as an array of n floats (nF vector).
1370 * \param pValue
1371 * \param pn
1372 */
1373 void FieldWriteFn(const float* pValue, FbxUInt pn);
1374
1375 /** Write field pFieldName field with a array of n floats as a value.
1376 * \param pFieldName
1377 * \param pValue
1378 * \param pn
1379 */
1380 void FieldWriteFn(const char* pFieldName, const float* pValue, FbxUInt pn);
1381
1382 /** Write field value as an array of 3 floats (3F vector).
1383 * \param pValue
1384 */
1385 void FieldWrite3F(const float* pValue);
1386
1387 /** Write field pFieldName field with a array of 3 floats as a value.
1388 * \param pFieldName
1389 * \param pValue
1390 */
1391 void FieldWrite3F(const char* pFieldName, const float* pValue);
1392
1393 /** Write field value as an array of 4 floats (4F vector).
1394 * \param pValue
1395 */
1396 void FieldWrite4F(const float* pValue);
1397
1398 /** Write field pFieldName field with a array of 4 floats as a value.
1399 * \param pFieldName
1400 * \param pValue
1401 */
1402 void FieldWrite4F(const char* pFieldName, const float* pValue);
1403
1404 /** Write field value as an array of n doubles (nD vector).
1405 * \param pValue
1406 * \param pn
1407 */
1408 void FieldWriteDn(const double* pValue, FbxUInt pn);
1409
1410 /** Write field pFieldName field with a array of n doubles as a value.
1411 * \param pFieldName
1412 * \param pValue
1413 * \param pn
1414 */
1415 void FieldWriteDn(const char* pFieldName, const double* pValue, FbxUInt pn);
1416
1417 /** Write field value as an array of 3 doubles (3D vector).
1418 * \param pValue
1419 */
1420 void FieldWrite3D(const double* pValue);
1421
1422 /** Write field pFieldName field with a array of 3 doubles as a value.
1423 * \param pFieldName
1424 * \param pValue
1425 */
1426 void FieldWrite3D(const char* pFieldName, const double* pValue);
1427
1428 /** Write field value as an array of 4 doubles (4D vector).
1429 * \param pValue
1430 */
1431 void FieldWrite4D(const double* pValue);
1432
1433 /** Write field pFieldName field with a array of 4 doubles as a value.
1434 * \param pFieldName
1435 * \param pValue
1436 */
1437 void FieldWrite4D(const char* pFieldName, const double* pValue);
1438
1439 // The maximum number of value entries is, in theory, 2**32. In practice it should be a lot less than that.
1440 // pSize is the number of values to write from each pointer location, and stride is how much we
1441 // advance to get to the next value; if the stride is zero, values are tighly packed together.
1442 // So in total we'll write n * pSize items.
1443
1444 /** Write array to file.
1445 * \param n Nb of items in the array.
1446 * \param pValue Pointer to the data.
1447 * \param pSize Size of each item in the array.
1448 * \param pStride Array stride.
1449 */
1450 void FieldWriteArrayD( int n, const double* pValue, int pSize = 1, int pStride = 0 );
1451 /** Write array to file.
1452 * \param n Nb of items in the array.
1453 * \param pValue Pointer to the data.
1454 * \param pSize Size of each item in the array.
1455 * \param pStride Array stride.
1456 */
1457 void FieldWriteArrayF( int n, const float* pValue, int pSize = 1, int pStride = 0 );
1458 /** Write array to file.
1459 * \param n Nb of items in the array.
1460 * \param pValue Pointer to the data.
1461 * \param pSize Size of each item in the array.
1462 * \param pStride Array stride.
1463 */
1464 void FieldWriteArrayI( int n, const int* pValue, int pSize = 1, int pStride = 0 );
1465 /** Write array to file.
1466 * \param n Nb of items in the array.
1467 * \param pValue Pointer to the data.
1468 * \param pSize Size of each item in the array.
1469 * \param pStride Array stride.
1470 */
1471 void FieldWriteArrayLL(int n, const FbxLongLong* pValue, int pSize = 1, int pStride = 0 );
1472 /** Write array to file.
1473 * \param n Nb of items in the array.
1474 * \param pValue Pointer to the data.
1475 * \param pSize Size of each item in the array.
1476 * \param pStride Array stride.
1477 */
1478 void FieldWriteArrayB( int n, const bool* pValue, int pSize = 1, int pStride = 0 );
1479 /** Write array to file.
1480 * \param n Nb of items in the array.
1481 * \param pValue Pointer to the data.
1482 * \param pSize Size of each item in the array.
1483 * \param pStride Array stride.
1484 */
1485 void FieldWriteArrayBytes( int n, const FbxUChar* pValue, int pSize = 1, int pStride = 0 );
1486
1487 /** Write field value as a raw data.
1488 * \param pRawData
1489 * \param pByteSize
1490 */
1491 void FieldWriteR(const void* pRawData, int pByteSize);
1492
1493 /** Write field pFieldName field with raw data as a value.
1494 * \param pFieldName
1495 * \param pRawData
1496 * \param pByteSize
1497 */
1498 void FieldWriteR(const char* pFieldName, const void* pRawData, int pByteSize);
1499
1500 /**
1501 * \name FBX SDK 2009.3 and later
1502 */
1503 //@{
1504
1505 /** Write field value as byte.
1506 * \param pValue
1507 */
1508 void FieldWriteByte(FbxChar pValue);
1509
1510 /** Write field pFieldName field with a byte value.
1511 * \param pFieldName
1512 * \param pValue
1513 */
1514 void FieldWriteByte(const char* pFieldName, FbxChar pValue);
1515
1516 /** Write field value as unsigned byte.
1517 * \param pValue
1518 */
1519 void FieldWriteUByte(FbxUChar pValue);
1520
1521 /** Write field pFieldName field with an unsigned byte value.
1522 * \param pFieldName
1523 * \param pValue
1524 */
1525 void FieldWriteUByte(const char* pFieldName, FbxUChar pValue);
1526
1527 /** Write field value as short.
1528 * \param pValue
1529 */
1530 void FieldWriteShort(FbxShort pValue);
1531
1532 /** Write field pFieldName field with a short value.
1533 * \param pFieldName
1534 * \param pValue
1535 */
1536 void FieldWriteShort(const char* pFieldName, FbxShort pValue);
1537
1538 /** Write field value as unsigned short.
1539 * \param pValue
1540 */
1541 void FieldWriteUShort(FbxUShort pValue);
1542
1543 /** Write field pFieldName field with an unsigned short value.
1544 * \param pFieldName
1545 * \param pValue
1546 */
1547 void FieldWriteUShort(const char* pFieldName, FbxUShort pValue);
1548
1549 /** Write field value as an unsigned integer.
1550 * \param pValue
1551 */
1552 void FieldWriteUI(unsigned int pValue);
1553
1554 /** Write field pFieldName field with an unsigned int as a value.
1555 * \param pFieldName
1556 * \param pValue
1557 */
1558 void FieldWriteUI(const char* pFieldName, unsigned int pValue);
1559
1560 /** Write field value as 64 bit unsigned integer.
1561 * \param pValue
1562 */
1563 void FieldWriteULL(FbxULongLong pValue);
1564
1565 /** Write field pFieldName field with an 64 bit unsigned int as a value.
1566 * \param pFieldName
1567 * \param pValue
1568 * \return void
1569 */
1570 void FieldWriteULL(const char* pFieldName, FbxULongLong pValue);
1571
1572 /** Write array to file.
1573 * \param n Nb of items in the array.
1574 * \param pValue Pointer to the data.
1575 * \param pSize Size of each item in the array.
1576 * \param pStride Array stride.
1577 */
1578 void FieldWriteArraySBytes( int n, const FbxChar* pValue, int pSize = 1, int pStride = 0 );
1579 /** Write array to file.
1580 * \param n Nb of items in the array.
1581 * \param pValue Pointer to the data.
1582 * \param pSize Size of each item in the array.
1583 * \param pStride Array stride.
1584 */
1585 void FieldWriteArrayShort( int n, const FbxShort* pValue, int pSize = 1, int pStride = 0 );
1586 /** Write array to file.
1587 * \param n Nb of items in the array.
1588 * \param pValue Pointer to the data.
1589 * \param pSize Size of each item in the array.
1590 * \param pStride Array stride.
1591 */
1592 void FieldWriteArrayUShort( int n, const FbxUShort* pValue, int pSize = 1, int pStride = 0 );
1593 /** Write array to file.
1594 * \param n Nb of items in the array.
1595 * \param pValue Pointer to the data.
1596 * \param pSize Size of each item in the array.
1597 * \param pStride Array stride.
1598 */
1599 void FieldWriteArrayUI( int n, const unsigned int* pValue, int pSize = 1, int pStride = 0 );
1600 /** Write array to file.
1601 * \param n Nb of items in the array.
1602 * \param pValue Pointer to the data.
1603 * \param pSize Size of each item in the array.
1604 * \param pStride Array stride.
1605 */
1606 void FieldWriteArrayULL(int n, const FbxULongLong* pValue, int pSize = 1, int pStride = 0 );
1607 //@}
1608
1609 /** ASCII files may limit how big you can write your raw data, forcing you to break it down into chunks.
1610 * \return int
1611 */
1612 int GetFieldRMaxChunkSize() const;
1613
1614 /** Write object reference pName in the current field.
1615 * \param pName
1616 */
1617 void FieldWriteObjectReference(const char* pName);
1618
1619 /** Write object reference pName in field pFieldName.
1620 * \param pFieldName
1621 * \param pName
1622 */
1623 void FieldWriteObjectReference(const char* pFieldName, const char* pName);
1624
1625 /** Write field with file content as a value.
1626 * \param pFileName
1627 * \param pRelativeFileName
1628 * \remarks Only works when file is binary. This function is not related to flag mEmbedded.
1629 * \return \c false if operation failed.
1630 */
1631 bool FieldWriteEmbeddedFile (FbxString pFileName, FbxString pRelativeFileName);
1632
1633 /** Write comments, only effective in ASCII mode.
1634 * \param pFieldName
1635 */
1636 void WriteComments(const char* pFieldName);
1637
1638 //@}
1639
1640#ifdef _DEBUG
1641 // Dump function for debugging purpose only
1642 void StdoutDump();
1643#endif
1644
1645 /** Get if the embedded file is currently loaded
1646 * \return true if loaded, false otherwise
1647 * \remarks An embedded file is a file like a JPEG image used for texture or an AVI file for video.
1648 * When files are embedded, the size of the FBX file can be very large since other files are embedded in it.
1649 * FBX Version 6 and lower cannot embed files when saved in ASCII.
1650 * FBX Version 7 and over can embed files even when saved in ASCII mode.
1651 */
1652 bool GetHaveLoadedEmbededFile() const;
1653
1654 /** Get the maximum byte count written
1655 * \param pMemPtr The address of the memory file
1656 * \param[out] pSize Stores the maximum byte count written
1657 */
1658 void GetMemoryFileInfo(void** pMemPtr, size_t& pSize) const;
1659
1660 /** Get a internal flag to manage pre FBX version 6 data format
1661 * Used for backwards compatibility
1662 */
1663 bool IsBeforeVersion6() const;
1664
1665 /** Set a internal flag to manage pre FBX version 6 data format
1666 * Used for backwards compatibility
1667 */
1668 void SetIsBeforeVersion6(bool pIsBeforeVersion6);
1669
1670/*****************************************************************************************************************************
1671** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
1672*****************************************************************************************************************************/
1673#ifndef DOXYGEN_SHOULD_SKIP_THIS
1674 bool ProjectOpen (FbxFile * pFile, FbxReader* pReader, bool pCheckCRC = false, bool pOpenMainSection = true, FbxIOFileHeaderInfo* pFileHeaderInfo = NULL);
1675
1676private:
1677 // to resolve warning C4512: 'class' : assignment operator could not be generated
1678 FbxIO& operator=(const FbxIO& pOther);
1679
1680 FbxStatus& mStatus;
1681
1682 struct InternalImpl;
1683 struct InternalImpl32;
1684 struct InternalImpl64;
1685 InternalImpl* mImpl;
1686
1687 //! Project Global
1688
1689 void ProjectClear();
1690 void ProjectReset();
1691
1692 bool ProjectReadHeader(bool pCheckASCIIHeader, bool pCheckCRC, bool pOpenMainSection, FbxIOFileHeaderInfo* pFileHeaderInfo);
1693 bool ProjectReadExtendedHeader(FbxInt64& pExtendedHeaderEnd, FbxIOFileHeaderInfo* pFileHeaderInfo);
1694 bool BinaryReadHeader();
1695 bool BinaryReadSectionPosition();
1696 bool ASCIIReadHeader();
1697 bool ASCIIReadSectionPosition();
1698
1699 bool ProjectWriteHeader(FbxIOFileHeaderInfo* pFileHeaderInfo);
1700 bool ProjectWriteExtendedHeader(FbxIOFileHeaderInfo* pFileHeaderInfo);
1701 void BinaryWriteHeader();
1702 void ASCIIWriteHeader();
1703
1704 void ReadEncryptionKey(char* pEncryptionKey);
1705 void WriteEncryptionKey(char* pEncryptionKey);
1706
1707 //! Project Section
1708
1709 bool ProjectClearSection();
1710 bool ProjectOpenSection(int pSection);
1711 bool BinaryReadSectionHeader();
1712 FbxInt64 BinaryReadSectionFooter(char* pSourceCheck);
1713 bool BinaryReadExtensionCode(FbxInt64 pFollowingSectionStart, FbxInt64& pSectionStart, FbxUInt32& pSectionVersion);
1714 void BinaryReadSectionPassword();
1715
1716 bool ProjectWriteSectionHeader();
1717 void BinaryWriteSectionFooter();
1718 bool BinaryWriteExtensionCode(FbxInt64 pSectionStart, FbxUInt32 pSectionVersion);
1719
1720 FbxString GetCreationTime() const;
1721 void SetCreationTime(FbxString pCreationTime);
1722 void CreateSourceCheck(char* lSourceCheck);
1723 bool TestSourceCheck(char* pSourceCheck, char* pSourceCompany);
1724 FbxString GetMangledCreationTime();
1725 void EncryptSourceCheck(char* pSourceCheck, char* pEncryptionData);
1726 void DecryptSourceCheck(char* pSourceCheck, const char* pEncryptionData);
1727
1728 void EncryptPasswordV1(FbxString pOriginalPassword, FbxString &pEncryptedPassword);
1729 void DecryptPasswordV1(FbxString pEncryptedPassword, FbxString &pDecryptedPassword);
1730
1731 //! Read
1732
1733 void CheckValidityOfFieldName(const char* pFieldName);
1734 void GetUnusedEmbeddedName(const FbxString& pDirectory, const FbxString& pName, FbxString& pResult, bool pCreateSubdirectory);
1735
1736 //! Get project media directory name
1737 FbxString GetDirectory(bool pAutoCreate, const char* pExtension);
1738#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
1739};
1740
1741#include <fbxsdk/fbxsdk_nsend.h>
1742
1743#endif /* _FBXSDK_FILEIO_FBX_IO_H_ */
1744