Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
Io3dmgr.h
Go to the documentation of this file.
1//! @file Io3dmgr.h
2//! @brief 3D import / export classes definitions
3//!
4//////////////////////////////////////////////////////////////////////////////////////////
5
6#ifndef IO3DMGR_H
7#define IO3DMGR_H
8
9#include "IoCommon.h"
10
11BEGIN_MOOTOOLS_NAMESPACE
12
13//////////////////////////////////////////////////////////////////////////////////////////
14//! @name Common import/export options
15//! @{
16#define COMMON_IMPORT_COPY_EMBED_TO_DIR MAKE_CUSTOM_ID('C', 'Y', 'E', 'M') //!< String: a path where to copy the embedded textures (use by FBX/SKP/GLTF). When use the embeded media are extracted and not deleted. Otherwise embeded content is extracted on scene opening and deleted when scene is released
17#define COMMON_IMPORT_FROM_MEMORY_DATA MAKE_CUSTOM_ID('I', 'M', 'M', 'D') //!< Binary: a memory block containing the data file that is used for parsing (GLTF/SKP). Note, that the filename is required because it defined the memory block format as well as a path that can be useful for textures, or default name.
18#define COMMON_EXPORT_TO_MEMORY MAKE_CUSTOM_ID('E', 'X', 'M', 'M') //!< Bool: false by default, set to true if you require an export to a memory data block (GLTF). Once output performed, the memory data block can be retrieved thourgh the parser options COMMON_EXPORT_MEMORY_DATA. filename is required as it defined the output format.
19#define COMMON_EXPORT_MEMORY_DATA MAKE_CUSTOM_ID('E', 'M', 'M', 'D') //!< Binary: a memory data block that is used for parsing the specific file format instead of the provided filename. Note, that the filename is required as it defined the memory block format as well as a a file path that can be used for textures, or default name.
20
21//! @}
22
23//! @name FBX import / export options
24//! @{
25#define FBX_EXPORT_OPTION_EMBEDDED_MEDIA MAKE_CUSTOM_ID('E', 'M', 'B', 'D') //!< Bool: Write optionBoolean options for embedded media. If set to true, FBX will embed media when writting
26#define FBX_IO_OPTION_PASSWORD MAKE_CUSTOM_ID('P', 'S', 'W', 'D') //!< CXString: String that contains a password to read/write the fbx
27#define FBX_EXPORT_OPTION_SAVE_MATID MAKE_CUSTOM_ID('M', 'T', 'I', 'D') //!< Unsigned int: Save material ID in properties (not used)
28#define FBX_EXPORT_OPTION_FBX_VERSION MAKE_CUSTOM_ID('F', 'X', 'V', 'S') //!< Unsigned int (FbxExportVersion): The fbx target version to use
29#define FBX_EXPORT_OPTION_FBX_ASCII MAKE_CUSTOM_ID('F', 'X', 'I', 'I') //!< bool: set to true to export in ASCII
30#define FBX_EXPORT_CONVERT_MATERIAL_TO_STANDARD MAKE_CUSTOM_ID('C', 'V', 'S', 'T') //!< bool: true convert pbr material to standard material
31#define FBX_EXPORT_KEEP_PBR_FORMAT MAKE_CUSTOM_ID('K', 'P', 'P', 'B') //!< bool: keep the input PBR format if defined (max or Maya)
32#define FBX_EXPORT_PBR_FORMAT MAKE_CUSTOM_ID('C', 'V', 'P', 'B') //!< UInt: 0: 3ds max PBR format, 1: Maya PBR format
33
34//! @enum FbxExportVersion
35//! Defines the FBX file version to use with FBX_EXPORT_OPTION_FBX_VERSION
36typedef enum FbxExportVersion XEnumType(unsigned int)
37{
38 FBX_2010 = 2010,
39 FBX_2011 = 2011,
40 FBX_2012 = 2012,
41 FBX_2013 = 2013,
42 FBX_2014 = 2014,
43 FBX_2016 = 2016,
44 FBX_2018 = 2018,
45 FBX_2019 = 2019,
46 FBX_2020 = 2020,
47 FBX_MOST_RECENT = 0, //!< The native fbx version of the Fbx SDK
48 FBX_DEFAULT_VERSION = FBX_MOST_RECENT,
50
51//! @}
52
53//! @name JT import / export options
54//! @{
55#define JT_IO_OPTION_SIEMENS_ID MAKE_CUSTOM_ID('S', 'I', 'E', 'M') //!< Unsigned Integer that contains a password to register siemens toolkit. If not defined, evaluation scheme is used, meaning that the parser will fails once evaluation period is over
56#define JT_IO_OPTION_FLAGS MAKE_CUSTOM_ID('J', 'T', 'F', 'G') //!< Unsigned int : flags for control on import / export, Cf. JTIoFlags
57#define JT_IMPORT_OPTION_SPECIFIC_LOD MAKE_CUSTOM_ID('S', 'L', 'O', 'D') //!< Unsigned int : define a specific LOD to load
58
59//! @enum JTIoFlags
60//! Use these flags to keep control on the JT import / export process using settings JT_IO_FLAGS through CSceneExportOptions::GetData / CSceneImportOptions::GetData
61typedef enum JTIoFlags XEnumType(unsigned int)
62{
63 JT_UNDEFINED_FLAGS = 0x00,
64
65 // Import options
66 JT_IMPORT_CONCATENATE = 0x01, //!< Concatenate meshes that are part of the same assembly
67 JT_IMPORT_LOAD_LOD = 0x02, //!< Load a specific lod meshes, which is defined by JT_IO_SPECIFIC_LOD
68
69 // Private flags do not use these flags
70 JT_PRIVATE_FLAGS = 0xFF000000,
71 JT_UPDATE_STORE = 0x01000000,
72 JT_DO_UPDATE = 0x02000000,
73} JTIoFlags;
74
75//! @}
76
77//! @name Sketchup import / export options
78//! @{
79#define SKP_IMPORT_TRIANGULATE MAKE_CUSTOM_ID('T', 'R', 'I', 'A') //!< Bool: always uses internal sketchup trianguler
80#define SKP_IMPORT_FORCE_AFFINE_UV MAKE_CUSTOM_ID('A', 'F', 'U', 'V') //!< Bool: true by default - Reduce the number of texture by considering that all transformation are affine. Provide the parameter with false to get an accurate projection which might result in a large texture file amount.
81#define SKP_IMPORT_FORCE_TEXTURE_FORMAT MAKE_CUSTOM_ID('T', 'X', 'T', 'F') //!< Unsigned int: 0 (default): native sketchup texture format. 1: texture are converted to PNG format. 2: Texture are converted to JPG format (transparency loss)
82#define SKP_IMPORT_COLLAPSE_LIVECOMPONENT MAKE_CUSTOM_ID('L', 'V', 'C', 'L') //!< Bool: Concatenate live component sub hierarchy to a single node
83#define SKP_IMPORT_COLLAPSE_DEFINITION MAKE_CUSTOM_ID('S', 'M', 'Y', 'D') //!< Bool: collapse definition
84#define SKP_IMPORT_COLLAPSE_GROUP MAKE_CUSTOM_ID('S', 'M', 'Y', 'G') //!< Bool: collapse group
85#define SKP_IMPORT_SKIP_CURVE MAKE_CUSTOM_ID('S', 'K', 'C', 'R') //!< Bool: skip curves
86#define SKP_IMPORT_TRACK_SKPID MAKE_CUSTOM_ID('S', 'K', 'T', 'K') //!< Bool: track skp ids to know what id is in mootools object
87#define SKP_EXPORT_VERSION MAKE_CUSTOM_ID('S', 'K', 'V', 'R') //!< UInt: version to export:
88
89//! @enum SkpExportVersion
90//! Defines the Sketchup file version to use with SKP_EXPORT_VERSION
91typedef enum SkpExportVersion XEnumType(unsigned int)
92{
93 SKP_2013 = 2013,
94 SKP_2014 = 2014,
95 SKP_2015 = 2015,
96 SKP_2016 = 2016,
97 SKP_2017 = 2017,
98 SKP_2018 = 2018,
99 SKP_2019 = 2019,
100 SKP_2020 = 2020,
101 SKP_2021 = 2021,
102 SKP_MOST_RECENT = 0, // The native skp version of the SKP SDK
103 SKP_DEFAULT_VERSION = SKP_MOST_RECENT,
105
106//! @}
107
108//! @name GLTF import / export options
109//! @{
110#define GLTF_IMPORT_WELD_POINTS MAKE_CUSTOM_ID('W', 'E', 'L', 'D') //!< Bool: weld points at import
111#define GLTF_EXPORT_OPTION_EMBEDDED_MEDIA MAKE_CUSTOM_ID('E', 'M', 'B', 'D') //!< Bool: Write optionBoolean options for embedded media. If set to true, GLTF will embed media when writting
112#define GLTF_EXPORT_JPEG_COMPRESSION MAKE_CUSTOM_ID('J', 'G', 'C', 'M') //!< UInt: JPEG compression factor
113#define GLTF_EXPORT_JPEG_MODE MAKE_CUSTOM_ID('J', 'G', 'M', 'D') //!< UInt: false (0): native texture format, 1 : JPG except if transparencies or normal map, 2: JPG except if normal map, 3 : always Jpeg.
114
115//! @}
116
117//! @name Wavefront import / export options
118//! @{
119#define OBJ_IO_FILE_ENCODING MAKE_CUSTOM_ID('W', 'V', 'E', 'N') // UInt: encoding file mode when reading / writing (0: utf8, 1: unicode, 2: ansi), default: 0 under Windows/linux. 2: only available on Windows. If a UTF8/Unicode BOM character is found, the file is read accordingly whatever the mode
120
121//! @}
122
123// Private settings
124#define PRIVATE_IO_SPECIFIC_OPTIONS MAKE_CUSTOM_ID('S', 'P', 'C', 'I') // String: a key for defining particular option (private usage)
125
126//! @}
127
128class C3DIo;
129
130//! @class CSceneImportOptions
131//! @brief This class is used to provide some specific options when loading scene file
132class DLL_3DFUNCTION CSceneImportOptions : public CIoOptions
133{
134 friend C3DIo;
135
136public:
137 //! User control on importation (one or more SCENE_IMPORT_FLAGS)
139
140 // Data used internally (filled by the parsers)
141 unsigned int swapmode;
142 UP_AXIS_MODE axismode;
143 longuint neededflags;
144 longuint defaultflags;
145
146 CSceneImportOptions(unsigned int flags = SCENE_IMPORT_DEFAULT);
147
148protected:
149 virtual void InheritFromDefault(const CSceneImportOptions& defaultOptions); // Some parsers have constraints. Inherits theses constraints from the defaultOptions of the parser
150 virtual void InitFromSavedPrefs(const CCustomData& data); // Load settings from a saved preference file
151 virtual const CCustomData& SaveToSavedPrefs(); // Converts settings to be saved to preference file
152};
153
154//! @class CSceneExportOptions
155//! @brief This class is used to provide some specific options when exporting a 3D scene
156class DLL_3DFUNCTION CSceneExportOptions : public CIoOptions
157{
158 friend C3DScene;
159 friend C3DIo;
160
161private:
162 CHashMap<CXString, CXString, CXString> textureMap; // Map to avoid duplicating the same texture
163 CHashTable<CXString> textureNames; // used textured names for generating single name
164 C3DScene *sceneToDelete; // TODO: made deprecated in futur
165
166 CXString CheckNames(bool makeUnique, const CXString& inname, CHashTable<CXString>& names, unsigned int size, unsigned int options, xStringEncoding encoding, const CXString& defaultName);
167
168public:
169 //! User control on exportation
170 //! Combination of SCENE_EXPORT_FLAGS provided by the caller.\n
171 //! It is used to prepare the scene to be saved. Ie if caller set SCENE_EXPORT_GLOBAL_COORDINATES | SCENE_EXPORT_TRIANGULATE then a triangulated scene with global coordinates will be saved.\n
172 //! When calling C3DIo::Save with options not NULL, provided flags are used completed with the parser specified neededflags
174
175 //! @name Data used internally (filled by the parsers and option dialogs)
176 //! @{
177 unsigned int swapmode;
178 UP_AXIS_MODE axismode;
179 longuint neededflags; //!< Fill by the parser. A combination of SCENE_EXPORT_FLAGS that are absolutely required.
180 longuint defaultflags; //!< Fill by the parser. A combination of SCENE_EXPORT_FLAGS that could be used or are better to use, but are not mandatory.
181 UNIT_MODE targetunit; //!< define the I/O required unit
182
183 //! @}
184
185 int ptsLimit, faceLimit; //!< Max number of point & face supported by the I/O
186
187 //! @name The following options are used when a name SCENE_EXPORT_MAKE_UNIQUE_NAME is defined
188 //! @{
189 unsigned int nameLimit; //!< Default: 0 (inactive). Max number of characters for node names. Use SCENE_OPTIONS_MAKE_NAME to define the limit.
190 unsigned int materialNameLimit; //!< Default: 0 (inactive). Max number of characters for node names. Use SCENE_OPTIONS_MAKE_NAME to define the limit.
191 xStringEncoding nameEncoding; //!< Default: xStringDefaultEncoding. Force name to have a specific encoding which guarantee that the texture name (for example ASCII text) will be the same that the file name (which is by default Unicode). Use xStringDefaultEncoding to keep default (unicode)
192 CXString filename; //!< The output filename
193
194 //! @}
195
196 //! @name The following options are used when copying the texture files to a given location (SCENE_EXPORT_COPY_TEXTURES must be set)
197 //! @{
198 CXString texturePath; //!< To be defined. Target path for texture unless textureLocalPathOnly is set to true. In that case, texture are made local to the target scene path.
199 bool textureLocalPathOnly; //!< Default: false. Textures are made local to the target scene path. texturePath is ignored.
200 unsigned int textureNameLimit; //!< Default: 0 (inactive). Max number of characters for filename (ie textures when moved). Use SCENE_OPTIONS_MAKE_NAME to define the limit.
201 xStringEncoding textureNameEncoding; //!< Default: xStringDefaultEncoding. Force texture name to have a specific encoding which guarantee that the texture name (for example ASCII text) will be the same that the file name (which is by default Unicode). Use xStringDefaultEncoding to keep default (unicode)
202
203 //! @}
204
205 //! @name Information about the InitExport process which prepares the scene provided to C3DIo::Save before exportation
206 //! @{
207 CXString previousFilename; //!< The original file path of the scene, which can differs if the file is converted
208 bool saveInDifferentPath; //!< Simple way to know if the saved scene is saved in a different location than the original file. That can be helpful to prevent overwrite some original files
209 bool saveInDifferentFormat; //!< Simple way to know if the saved scene is saved in a different location than the original file. That can be helpful to prevent overwrite some original files
210
211 //! @}
212
213 CSceneExportOptions(unsigned int flags = SCENE_EXPORT_DEFAULT);
214 static CSceneExportOptions *Create(unsigned int flags = SCENE_EXPORT_DEFAULT); //!< Create and allocate a CSceneExportOptions that can be deleted using Delete(). Use xNew internally.
215 bool Delete();
216
217 CXString GetUniqueTextureFilename(const CXString& fullTexturePath, const CXString& suffix = CXString(), bool fileMustNotExist = false); //!< Return a name that comply the io specification (name limit, encoding...). The name is always different than the input name, but this can be a file already existing unless fileMustNotExist = true
218
219protected:
220 virtual void InheritFromDefault(const CSceneExportOptions& defaultOptions); // Some parsers have constraints. Inherits theses constraints from the defaultOptions of the parser
221 virtual void InitFromSavedPrefs(const CCustomData& data); // Load settings from a saved preference file
222 virtual const CCustomData& SaveToSavedPrefs(); // Converts settings to be saved to preference file
223
224 CXString GetPreviousTexturePath(const CXString& fullTexturePath);
225};
226
227//! @class C3DIo
228//! @brief C3DIo class handles reading / writing / updating 3D file.
229//! @details File formats are recocognized using the file extension. C3DIo then select accordingly the C3DParser class which has be registered using fileRegisterFile to handle the file format.
230//! Some options might be provided to specify particular options using CSceneImportOptions / CSceneExportOptions.\n
231//! Cf. #3DIO to get more information on the way to read/write scene
232class DLL_3DFUNCTION C3DIo : public CFileIo
233{
234 private:
235 bool prepareDone;
236
237 CFileParser *InitParser();
238 virtual void CloseParser();
239
240 #ifndef MOOTOOLS_NO_UI
243#if 0
244 IoShowDialog MustShowDialog();
245
246#endif // 0
247#endif
248
249 public:
250 C3DIo(const CFileNameSpec&, unsigned int flags, CXWnd *pParent = NULL);
251 C3DIo(unsigned int fileclass, unsigned int flags, CXWnd *pParent = NULL);
252 virtual ~C3DIo();
253
254 const C3DParser *GetParser() const;
255 C3DParser *GetParser();
256
257 bool GetLoadOptionsPrefs(CSceneImportOptions& options) const; //!< Load some default load options that might have been saved in preferences
258 bool GetSaveOptionsPrefs(CSceneExportOptions& options) const; //!< Load some default save options that might have been saved in preferences
259
260 static void InitLoadOptionsFromPrefsData(unsigned int fileClass, CSceneImportOptions& options, const CCustomData& savedPrefs); //!< Load some default load options that might have been saved in preferences
261 static void InitSaveOptionsFromPrefsData(unsigned int fileClass, CSceneExportOptions& options, const CCustomData& savedPrefs); //!< Load some default load options that might have been saved in preferences
262
263 static bool ReleaseParser(bool readingParser, unsigned int parser, void *parserData);
264 static bool CanUpdate(unsigned int inputFormat, unsigned int outputFormat); //!< Determine in outputformat can handle inputformat update mode (ie gtlf -> glb)
265 static bool CanUpdate(unsigned int fileclass, C3DScene *scene = NULL); //!< Determine if a fileclass is able to update file, and if scene is provided checks that the scene contains the required information to update
266
267 bool PrepareReading(CSceneImportOptions *options = NULL);
268 bool PrepareSaving(CSceneExportOptions *options = NULL);
269
270#ifndef MOOTOOLS_NO_UI
271 static CXString GetParametersInfo(const CCustomData& data, unsigned int fileclass, bool loading);
272 static bool DisplayFormatDialog(unsigned int fileclass, bool loading, CCustomData *data, CXWnd *pParent);
273
274 virtual C3DScene *Read(bool needOptions, CSceneImportOptions *options = NULL, longuint additionalFlags = SCENE_IMPORT_DEFAULT); //!< if options provided, it is used. The dialog can be shown to the user, but the options are not saved to the prefs. If options not specified, additionalFlags allow to set specific flags once the format dialog has been shown to the user and its choice saved to the prefs.
275 virtual bool Save(bool needOptions, C3DScene *, CSceneExportOptions *options = NULL, longuint additionalFlags = SCENE_EXPORT_DEFAULT); //!< if options provided, it is used. The dialog can be shown to the user, but the options are not saved to the prefs. If options not specified, additionalFlags allow to set specific flags once the format dialog has been shown to the user and its choice saved to the prefs.
276
277
278 C3DScene *Read(CSceneImportOptions *options = NULL)
279 {
280 return Read(false, options);
281 }
282
283 bool Save(C3DScene *scene, CSceneExportOptions *options = NULL)
284 {
285 return Save(false, scene, options);
286 }
287#else
288 virtual C3DScene *Read(CSceneImportOptions *options = NULL);
289 virtual bool Save(C3DScene *, CSceneExportOptions *options = NULL);
290#endif
291};
292
293void RegisterIOPlugins();
294void FreeIOPlugins();
295
296class C3DExportSheet;
297
298//! @class C3DParser
299//! @brief Class for reading / writing a specific file format. If is called by C3DIo when extension has been recognized to belong to the parser recognized extension.
300//! @details Cf. #3DPARSER if you intend to implement your own 3D parser
301class DLL_3DFUNCTION C3DParser : public CFileParser
302{
303 protected:
304 C3DScene *ioscene;
305
306 public:
307 C3DParser(CFileIo& io);
308 virtual ~C3DParser() {};
309
310 void SetScene(C3DScene *scene) { ioscene = scene; } //!< This is the scene to save. When update or save is called, this scene has been prepared accordingly to the CSceneExportOptions. Before that (ie. when the options dialog is called, the scene is the original input scene to save). Parser should not release this scene
311 C3DScene *GetScene() { return ioscene; } //!< When reading, this is the read scene, when saving, this is the input scene or the scene prepared with InitExport
312#if 0
313 virtual IoShowDialog MustShowDialog()
314 {
315 return CFileParser::MustShowDialog();
316 }
317
318#endif // 0
319
320 //! @name Reading a 3D file related methods
321 //! @{
322 virtual void LoadDefaultOptions(CSceneImportOptions& options) const {};
323#ifndef MOOTOOLS_NO_UI
324 virtual bool LoadOptionsDialog(CSceneImportOptions& options) { return true; }
325 virtual CXString GetLoadParametersInfo(CSceneImportOptions& options); //!< Return a string that describe the reading settings
326#endif
327 virtual C3DScene *Read(const CXString& filename, CSceneImportOptions& options) //!< options might be modified by the parser to specify some CheckoutImport specific requirements (ie. SCENE_IMPORT_KEEP_GUID might be set if GUID are found)
328 {
329 return NULL;
330 };
331
332 //! @}
333
334 //! @name Writing a 3D scene related methods
335 //! @{
336 virtual void SaveDefaultOptions(CSceneExportOptions& options) const {};
337 virtual void CheckSaveOptions(C3DScene *scene, CSceneExportOptions& options) const {}; //!< Last way to check possible mutual exclusive flags considering the scene before export (ie embed media and copy textures)
338#ifndef MOOTOOLS_NO_UI
339 virtual bool SaveOptionsDialog(CSceneExportOptions& options); //!< Overrides the default dialog if needed
340 virtual CXString GetSaveParametersInfo(CSceneExportOptions& options); //!< Return a string that describe the saving settings
341#endif
342 virtual bool Save(const CXString& filename, C3DScene *scene, CSceneExportOptions& options) //!< options might be modified by the parser (futur usage)
343 {
344 io->SetIoError(IO_FILE_UNKNOWN_FILE_TYPE);
345 return false;
346 }
347
348 //! @}
349
350 //! @name Update mechanism.
351 //!
352 //! if parserClass != UNKNOWN_CLASS we are testing if the parser has update ability for the given format.\n
353 //! It is the class of the parser that generate parserData. Some parser might register several class, ie for binary and ascii version of the same format.\n
354 //!
355 //! CanUpdate must verify that the parserClass is one of the recognized class and if so it can return true, so Update method is allowed to be called.\n
356 //! if parserData = NULL && parserClass == UNKNOWN_CLASS, returns true if the parser is able to update, false if not.\n
357 //! if parserData != NULL => parserClass != UNKNOWN_CLASS, parserData MUST HAVE BEEN generated by the parser itself, to correctly cast the content of the data.\n
358 //! In this case, the parser checks that provided data allows to perform the update.\n
359 //! Some parser stores data, but these data does not contains the information needed to perform the update.\n
360 //! Ie. Jt parser can contains both temporary texture path to delete once scene closed but also contains data for updating.\n
361 //! @{
362 virtual bool CanUpdate(unsigned int parserClass = UNKNOWN_CLASS, void *parserData = NULL) const
363 {
364 return false;
365 }
366
367 virtual bool Update(const CXString& filename, C3DScene *scene, void *parserScene, CSceneExportOptions& options)
368 {
369 io->SetIoError(IO_FILE_UNKNOWN_FILE_TYPE);
370 return false;
371 }
372 //! @}
373
374 //! @name Parser specific information
375 //! Some specific information might be attached to the scene using an opaque pointer and C3DScene::SetParserData.\n
376 //! When the scene is destroyed, the C3DParser::ReleaseParser is called with the opaque pointer, so some clean up can be done.\n
377 //! For example the information can contain some information about where embed textures were extracted and give a chance to delete the texture file.\n
378 //! This can be a pointer to an internal scene for the update mechanism (Collada)\n
379 //! This can be some information to release once the scene is destroyed (Kmz)\n
380 //! In most of case, this mechanism is used when reading, rarely when saving...
381 virtual bool ReleaseParser(bool readingParser, void *parserScene)
382 {
383 return false;
384 }
385};
386
387END_MOOTOOLS_NAMESPACE
388
389#endif /* IO3DMGR_H */
@ SCENE_IMPORT_DEFAULT
Use default parser flags.
Definition 3DType.h:292
@ SCENE_EXPORT_DEFAULT
Use default parser flags.
Definition 3DType.h:241
UP_AXIS_MODE
Definition 3DType.h:360
FbxExportVersion
Definition Io3dmgr.h:37
@ FBX_MOST_RECENT
The native fbx version of the Fbx SDK.
Definition Io3dmgr.h:47
SkpExportVersion
Definition Io3dmgr.h:92
JTIoFlags
Definition Io3dmgr.h:62
@ JT_IMPORT_LOAD_LOD
Load a specific lod meshes, which is defined by JT_IO_SPECIFIC_LOD.
Definition Io3dmgr.h:67
@ JT_IMPORT_CONCATENATE
Concatenate meshes that are part of the same assembly.
Definition Io3dmgr.h:66
CXTString< TCHAR > CXString
CXString depend on the target OS. Could be CXStringW (Windows) or CXStringA (Linux / Macos)
Definition XString.h:118
C3DIo class handles reading / writing / updating 3D file.
Definition Io3dmgr.h:233
static void InitLoadOptionsFromPrefsData(unsigned int fileClass, CSceneImportOptions &options, const CCustomData &savedPrefs)
Load some default load options that might have been saved in preferences.
static bool CanUpdate(unsigned int inputFormat, unsigned int outputFormat)
Determine in outputformat can handle inputformat update mode (ie gtlf -> glb)
bool GetSaveOptionsPrefs(CSceneExportOptions &options) const
Load some default save options that might have been saved in preferences.
static bool CanUpdate(unsigned int fileclass, C3DScene *scene=NULL)
Determine if a fileclass is able to update file, and if scene is provided checks that the scene conta...
bool GetLoadOptionsPrefs(CSceneImportOptions &options) const
Load some default load options that might have been saved in preferences.
static void InitSaveOptionsFromPrefsData(unsigned int fileClass, CSceneExportOptions &options, const CCustomData &savedPrefs)
Load some default load options that might have been saved in preferences.
Class for reading / writing a specific file format. If is called by C3DIo when extension has been rec...
Definition Io3dmgr.h:302
virtual bool Save(const CXString &filename, C3DScene *scene, CSceneExportOptions &options)
Last way to check possible mutual exclusive flags considering the scene before export (ie embed media...
Definition Io3dmgr.h:342
void SetScene(C3DScene *scene)
This is the scene to save. When update or save is called, this scene has been prepared accordingly to...
Definition Io3dmgr.h:310
C3DScene * GetScene()
When reading, this is the read scene, when saving, this is the input scene or the scene prepared with...
Definition Io3dmgr.h:311
virtual C3DScene * Read(const CXString &filename, CSceneImportOptions &options)
Definition Io3dmgr.h:327
The class allows to get access to the scene graph, node hierarchy, material.
Definition 3DScene.h:306
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
CCustomData is a handly class for storing any kind of data.
Definition CustomData.h:106
Definition IoCommon.h:150
A given extension may match several formats. In case of conflict CFileNameSpec is a way to indicate t...
Definition FileInfo.h:156
Definition IoCommon.h:130
Definition IoCommon.h:64
This class is used to provide some specific options when exporting a 3D scene.
Definition Io3dmgr.h:157
longuint neededflags
Fill by the parser. A combination of SCENE_EXPORT_FLAGS that are absolutely required.
Definition Io3dmgr.h:179
bool saveInDifferentPath
Simple way to know if the saved scene is saved in a different location than the original file....
Definition Io3dmgr.h:208
bool textureLocalPathOnly
Default: false. Textures are made local to the target scene path. texturePath is ignored.
Definition Io3dmgr.h:199
unsigned int textureNameLimit
Default: 0 (inactive). Max number of characters for filename (ie textures when moved)....
Definition Io3dmgr.h:200
longuint defaultflags
Fill by the parser. A combination of SCENE_EXPORT_FLAGS that could be used or are better to use,...
Definition Io3dmgr.h:180
CXString filename
The output filename.
Definition Io3dmgr.h:192
UNIT_MODE targetunit
define the I/O required unit
Definition Io3dmgr.h:181
CXString previousFilename
The original file path of the scene, which can differs if the file is converted.
Definition Io3dmgr.h:207
xStringEncoding nameEncoding
Default: xStringDefaultEncoding. Force name to have a specific encoding which guarantee that the text...
Definition Io3dmgr.h:191
xStringEncoding textureNameEncoding
Default: xStringDefaultEncoding. Force texture name to have a specific encoding which guarantee that ...
Definition Io3dmgr.h:201
CXString texturePath
To be defined. Target path for texture unless textureLocalPathOnly is set to true....
Definition Io3dmgr.h:198
unsigned int materialNameLimit
Default: 0 (inactive). Max number of characters for node names. Use SCENE_OPTIONS_MAKE_NAME to define...
Definition Io3dmgr.h:190
bool saveInDifferentFormat
Simple way to know if the saved scene is saved in a different location than the original file....
Definition Io3dmgr.h:209
longuint flags
Definition Io3dmgr.h:173
int faceLimit
Max number of point & face supported by the I/O.
Definition Io3dmgr.h:185
CXString GetUniqueTextureFilename(const CXString &fullTexturePath, const CXString &suffix=CXString(), bool fileMustNotExist=false)
Return a name that comply the io specification (name limit, encoding...). The name is always differen...
static CSceneExportOptions * Create(unsigned int flags=SCENE_EXPORT_DEFAULT)
Create and allocate a CSceneExportOptions that can be deleted using Delete(). Use xNew internally.
unsigned int nameLimit
Default: 0 (inactive). Max number of characters for node names. Use SCENE_OPTIONS_MAKE_NAME to define...
Definition Io3dmgr.h:189
This class is used to provide some specific options when loading scene file.
Definition Io3dmgr.h:133
longuint flags
User control on importation (one or more SCENE_IMPORT_FLAGS)
Definition Io3dmgr.h:138