1/*
2Open Asset Import Library (ASSIMP)
3----------------------------------------------------------------------
4
5Copyright (c) 2006-2016, ASSIMP Development Team
6All rights reserved.
7
8Redistribution and use of this software in source and binary forms,
9with or without modification, are permitted provided that the
10following conditions are met:
11
12* Redistributions of source code must retain the above
13 copyright notice, this list of conditions and the
14 following disclaimer.
15
16* Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the
18 following disclaimer in the documentation and/or other
19 materials provided with the distribution.
20
21* Neither the name of the ASSIMP team, nor the names of its
22 contributors may be used to endorse or promote products
23 derived from this software without specific prior
24 written permission of the ASSIMP Development Team.
25
26THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
38----------------------------------------------------------------------
39*/
40
41/** @file BlenderScene.cpp
42 * @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
43 */
44
45#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
46
47#include "BlenderScene.h"
48#include "BlenderSceneGen.h"
49#include "BlenderDNA.h"
50
51using namespace Assimp;
52using namespace Assimp::Blender;
53
54//--------------------------------------------------------------------------------
55template <> void Structure :: Convert<Object> (
56 Object& dest,
57 const FileDatabase& db
58 ) const
59{
60
61 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
62 int temp = 0;
63 ReadField<ErrorPolicy_Fail>(temp,"type",db);
64 dest.type = static_cast<Assimp::Blender::Object::Type>(temp);
65 ReadFieldArray2<ErrorPolicy_Warn>(dest.obmat,"obmat",db);
66 ReadFieldArray2<ErrorPolicy_Warn>(dest.parentinv,"parentinv",db);
67 ReadFieldArray<ErrorPolicy_Warn>(dest.parsubstr,"parsubstr",db);
68 {
69 std::shared_ptr<Object> parent;
70 ReadFieldPtr<ErrorPolicy_Warn>(parent,"*parent",db);
71 dest.parent = parent.get();
72 }
73 ReadFieldPtr<ErrorPolicy_Warn>(dest.track,"*track",db);
74 ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy,"*proxy",db);
75 ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy_from,"*proxy_from",db);
76 ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy_group,"*proxy_group",db);
77 ReadFieldPtr<ErrorPolicy_Warn>(dest.dup_group,"*dup_group",db);
78 ReadFieldPtr<ErrorPolicy_Fail>(dest.data,"*data",db);
79 ReadField<ErrorPolicy_Igno>(dest.modifiers,"modifiers",db);
80
81 db.reader->IncPtr(size);
82}
83
84//--------------------------------------------------------------------------------
85template <> void Structure :: Convert<Group> (
86 Group& dest,
87 const FileDatabase& db
88 ) const
89{
90
91 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
92 ReadField<ErrorPolicy_Igno>(dest.layer,"layer",db);
93 ReadFieldPtr<ErrorPolicy_Igno>(dest.gobject,"*gobject",db);
94
95 db.reader->IncPtr(size);
96}
97
98//--------------------------------------------------------------------------------
99template <> void Structure :: Convert<MTex> (
100 MTex& dest,
101 const FileDatabase& db
102 ) const
103{
104
105 int temp_short = 0;
106 ReadField<ErrorPolicy_Igno>(temp_short,"mapto",db);
107 dest.mapto = static_cast<Assimp::Blender::MTex::MapType>(temp_short);
108 int temp = 0;
109 ReadField<ErrorPolicy_Igno>(temp,"blendtype",db);
110 dest.blendtype = static_cast<Assimp::Blender::MTex::BlendType>(temp);
111 ReadFieldPtr<ErrorPolicy_Igno>(dest.object,"*object",db);
112 ReadFieldPtr<ErrorPolicy_Igno>(dest.tex,"*tex",db);
113 ReadFieldArray<ErrorPolicy_Igno>(dest.uvname,"uvname",db);
114 ReadField<ErrorPolicy_Igno>(temp,"projx",db);
115 dest.projx = static_cast<Assimp::Blender::MTex::Projection>(temp);
116 ReadField<ErrorPolicy_Igno>(temp,"projy",db);
117 dest.projy = static_cast<Assimp::Blender::MTex::Projection>(temp);
118 ReadField<ErrorPolicy_Igno>(temp,"projz",db);
119 dest.projx = static_cast<Assimp::Blender::MTex::Projection>(temp);
120 ReadField<ErrorPolicy_Igno>(dest.mapping,"mapping",db);
121 ReadFieldArray<ErrorPolicy_Igno>(dest.ofs,"ofs",db);
122 ReadFieldArray<ErrorPolicy_Igno>(dest.size,"size",db);
123 ReadField<ErrorPolicy_Igno>(dest.rot,"rot",db);
124 ReadField<ErrorPolicy_Igno>(dest.texflag,"texflag",db);
125 ReadField<ErrorPolicy_Igno>(dest.colormodel,"colormodel",db);
126 ReadField<ErrorPolicy_Igno>(dest.pmapto,"pmapto",db);
127 ReadField<ErrorPolicy_Igno>(dest.pmaptoneg,"pmaptoneg",db);
128 ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
129 ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
130 ReadField<ErrorPolicy_Warn>(dest.b,"b",db);
131 ReadField<ErrorPolicy_Warn>(dest.k,"k",db);
132 ReadField<ErrorPolicy_Igno>(dest.colspecfac,"colspecfac",db);
133 ReadField<ErrorPolicy_Igno>(dest.mirrfac,"mirrfac",db);
134 ReadField<ErrorPolicy_Igno>(dest.alphafac,"alphafac",db);
135 ReadField<ErrorPolicy_Igno>(dest.difffac,"difffac",db);
136 ReadField<ErrorPolicy_Igno>(dest.specfac,"specfac",db);
137 ReadField<ErrorPolicy_Igno>(dest.emitfac,"emitfac",db);
138 ReadField<ErrorPolicy_Igno>(dest.hardfac,"hardfac",db);
139 ReadField<ErrorPolicy_Igno>(dest.norfac,"norfac",db);
140
141 db.reader->IncPtr(size);
142}
143
144//--------------------------------------------------------------------------------
145template <> void Structure :: Convert<TFace> (
146 TFace& dest,
147 const FileDatabase& db
148 ) const
149{
150
151 ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db);
152 ReadFieldArray<ErrorPolicy_Fail>(dest.col,"col",db);
153 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
154 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
155 ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
156 ReadField<ErrorPolicy_Igno>(dest.unwrap,"unwrap",db);
157
158 db.reader->IncPtr(size);
159}
160
161//--------------------------------------------------------------------------------
162template <> void Structure :: Convert<SubsurfModifierData> (
163 SubsurfModifierData& dest,
164 const FileDatabase& db
165 ) const
166{
167
168 ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db);
169 ReadField<ErrorPolicy_Warn>(dest.subdivType,"subdivType",db);
170 ReadField<ErrorPolicy_Fail>(dest.levels,"levels",db);
171 ReadField<ErrorPolicy_Igno>(dest.renderLevels,"renderLevels",db);
172 ReadField<ErrorPolicy_Igno>(dest.flags,"flags",db);
173
174 db.reader->IncPtr(size);
175}
176
177//--------------------------------------------------------------------------------
178template <> void Structure :: Convert<MFace> (
179 MFace& dest,
180 const FileDatabase& db
181 ) const
182{
183
184 ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db);
185 ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db);
186 ReadField<ErrorPolicy_Fail>(dest.v3,"v3",db);
187 ReadField<ErrorPolicy_Fail>(dest.v4,"v4",db);
188 ReadField<ErrorPolicy_Fail>(dest.mat_nr,"mat_nr",db);
189 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
190
191 db.reader->IncPtr(size);
192}
193
194//--------------------------------------------------------------------------------
195template <> void Structure :: Convert<Lamp> (
196 Lamp& dest,
197 const FileDatabase& db
198 ) const
199{
200
201 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
202 int temp = 0;
203 ReadField<ErrorPolicy_Fail>(temp,"type",db);
204 dest.type = static_cast<Assimp::Blender::Lamp::Type>(temp);
205 ReadField<ErrorPolicy_Igno>(dest.flags,"flags",db);
206 ReadField<ErrorPolicy_Igno>(dest.colormodel,"colormodel",db);
207 ReadField<ErrorPolicy_Igno>(dest.totex,"totex",db);
208 ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
209 ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
210 ReadField<ErrorPolicy_Warn>(dest.b,"b",db);
211 ReadField<ErrorPolicy_Warn>(dest.k,"k",db);
212 ReadField<ErrorPolicy_Igno>(dest.energy,"energy",db);
213 ReadField<ErrorPolicy_Igno>(dest.dist,"dist",db);
214 ReadField<ErrorPolicy_Igno>(dest.spotsize,"spotsize",db);
215 ReadField<ErrorPolicy_Igno>(dest.spotblend,"spotblend",db);
216 ReadField<ErrorPolicy_Igno>(dest.att1,"att1",db);
217 ReadField<ErrorPolicy_Igno>(dest.att2,"att2",db);
218 ReadField<ErrorPolicy_Igno>(temp,"falloff_type",db);
219 dest.falloff_type = static_cast<Assimp::Blender::Lamp::FalloffType>(temp);
220 ReadField<ErrorPolicy_Igno>(dest.sun_brightness,"sun_brightness",db);
221 ReadField<ErrorPolicy_Igno>(dest.area_size,"area_size",db);
222 ReadField<ErrorPolicy_Igno>(dest.area_sizey,"area_sizey",db);
223 ReadField<ErrorPolicy_Igno>(dest.area_sizez,"area_sizez",db);
224 ReadField<ErrorPolicy_Igno>(dest.area_shape,"area_shape",db);
225
226 db.reader->IncPtr(size);
227}
228
229//--------------------------------------------------------------------------------
230template <> void Structure :: Convert<MDeformWeight> (
231 MDeformWeight& dest,
232 const FileDatabase& db
233 ) const
234{
235
236 ReadField<ErrorPolicy_Fail>(dest.def_nr,"def_nr",db);
237 ReadField<ErrorPolicy_Fail>(dest.weight,"weight",db);
238
239 db.reader->IncPtr(size);
240}
241
242//--------------------------------------------------------------------------------
243template <> void Structure :: Convert<PackedFile> (
244 PackedFile& dest,
245 const FileDatabase& db
246 ) const
247{
248
249 ReadField<ErrorPolicy_Warn>(dest.size,"size",db);
250 ReadField<ErrorPolicy_Warn>(dest.seek,"seek",db);
251 ReadFieldPtr<ErrorPolicy_Warn>(dest.data,"*data",db);
252
253 db.reader->IncPtr(size);
254}
255
256//--------------------------------------------------------------------------------
257template <> void Structure :: Convert<Base> (
258 Base& dest,
259 const FileDatabase& db
260 ) const
261{
262 // note: as per https://github.com/assimp/assimp/issues/128,
263 // reading the Object linked list recursively is prone to stack overflow.
264 // This structure converter is therefore an hand-written exception that
265 // does it iteratively.
266
267 const int initial_pos = db.reader->GetCurrentPos();
268
269 std::pair<Base*, int> todo = std::make_pair(&dest, initial_pos);
270 for ( ;; ) {
271
272 Base& cur_dest = *todo.first;
273 db.reader->SetCurrentPos(todo.second);
274
275 // we know that this is a double-linked, circular list which we never
276 // traverse backwards, so don't bother resolving the back links.
277 cur_dest.prev = NULL;
278
279 ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.object,"*object",db);
280
281 // the return value of ReadFieldPtr indicates whether the object
282 // was already cached. In this case, we don't need to resolve
283 // it again.
284 if(!ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.next,"*next",db, true) && cur_dest.next) {
285 todo = std::make_pair(&*cur_dest.next, db.reader->GetCurrentPos());
286 continue;
287 }
288 break;
289 }
290
291 db.reader->SetCurrentPos(initial_pos + size);
292}
293
294//--------------------------------------------------------------------------------
295template <> void Structure :: Convert<MTFace> (
296 MTFace& dest,
297 const FileDatabase& db
298 ) const
299{
300
301 ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db);
302 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
303 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
304 ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
305 ReadField<ErrorPolicy_Igno>(dest.unwrap,"unwrap",db);
306
307 db.reader->IncPtr(size);
308}
309
310//--------------------------------------------------------------------------------
311template <> void Structure :: Convert<Material> (
312 Material& dest,
313 const FileDatabase& db
314 ) const
315{
316 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
317 ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
318 ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
319 ReadField<ErrorPolicy_Warn>(dest.b,"b",db);
320 ReadField<ErrorPolicy_Warn>(dest.specr,"specr",db);
321 ReadField<ErrorPolicy_Warn>(dest.specg,"specg",db);
322 ReadField<ErrorPolicy_Warn>(dest.specb,"specb",db);
323 ReadField<ErrorPolicy_Igno>(dest.har,"har",db);
324 ReadField<ErrorPolicy_Warn>(dest.ambr,"ambr",db);
325 ReadField<ErrorPolicy_Warn>(dest.ambg,"ambg",db);
326 ReadField<ErrorPolicy_Warn>(dest.ambb,"ambb",db);
327 ReadField<ErrorPolicy_Igno>(dest.mirr,"mirr",db);
328 ReadField<ErrorPolicy_Igno>(dest.mirg,"mirg",db);
329 ReadField<ErrorPolicy_Igno>(dest.mirb,"mirb",db);
330 ReadField<ErrorPolicy_Warn>(dest.emit,"emit",db);
331 ReadField<ErrorPolicy_Igno>(dest.ray_mirror,"ray_mirror",db);
332 ReadField<ErrorPolicy_Warn>(dest.alpha,"alpha",db);
333 ReadField<ErrorPolicy_Igno>(dest.ref,"ref",db);
334 ReadField<ErrorPolicy_Igno>(dest.translucency,"translucency",db);
335 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
336 ReadField<ErrorPolicy_Igno>(dest.roughness,"roughness",db);
337 ReadField<ErrorPolicy_Igno>(dest.darkness,"darkness",db);
338 ReadField<ErrorPolicy_Igno>(dest.refrac,"refrac",db);
339 ReadFieldPtr<ErrorPolicy_Igno>(dest.group,"*group",db);
340 ReadField<ErrorPolicy_Warn>(dest.diff_shader,"diff_shader",db);
341 ReadField<ErrorPolicy_Warn>(dest.spec_shader,"spec_shader",db);
342 ReadFieldPtr<ErrorPolicy_Igno>(dest.mtex,"*mtex",db);
343
344
345 ReadField<ErrorPolicy_Igno>(dest.amb, "amb", db);
346 ReadField<ErrorPolicy_Igno>(dest.ang, "ang", db);
347 ReadField<ErrorPolicy_Igno>(dest.spectra, "spectra", db);
348 ReadField<ErrorPolicy_Igno>(dest.spec, "spec", db);
349 ReadField<ErrorPolicy_Igno>(dest.zoffs, "zoffs", db);
350 ReadField<ErrorPolicy_Igno>(dest.add, "add", db);
351 ReadField<ErrorPolicy_Igno>(dest.fresnel_mir, "fresnel_mir", db);
352 ReadField<ErrorPolicy_Igno>(dest.fresnel_mir_i, "fresnel_mir_i", db);
353 ReadField<ErrorPolicy_Igno>(dest.fresnel_tra, "fresnel_tra", db);
354 ReadField<ErrorPolicy_Igno>(dest.fresnel_tra_i, "fresnel_tra_i", db);
355 ReadField<ErrorPolicy_Igno>(dest.filter, "filter", db);
356 ReadField<ErrorPolicy_Igno>(dest.tx_limit, "tx_limit", db);
357 ReadField<ErrorPolicy_Igno>(dest.tx_falloff, "tx_falloff", db);
358 ReadField<ErrorPolicy_Igno>(dest.gloss_mir, "gloss_mir", db);
359 ReadField<ErrorPolicy_Igno>(dest.gloss_tra, "gloss_tra", db);
360 ReadField<ErrorPolicy_Igno>(dest.adapt_thresh_mir, "adapt_thresh_mir", db);
361 ReadField<ErrorPolicy_Igno>(dest.adapt_thresh_tra, "adapt_thresh_tra", db);
362 ReadField<ErrorPolicy_Igno>(dest.aniso_gloss_mir, "aniso_gloss_mir", db);
363 ReadField<ErrorPolicy_Igno>(dest.dist_mir, "dist_mir", db);
364 ReadField<ErrorPolicy_Igno>(dest.hasize, "hasize", db);
365 ReadField<ErrorPolicy_Igno>(dest.flaresize, "flaresize", db);
366 ReadField<ErrorPolicy_Igno>(dest.subsize, "subsize", db);
367 ReadField<ErrorPolicy_Igno>(dest.flareboost, "flareboost", db);
368 ReadField<ErrorPolicy_Igno>(dest.strand_sta, "strand_sta", db);
369 ReadField<ErrorPolicy_Igno>(dest.strand_end, "strand_end", db);
370 ReadField<ErrorPolicy_Igno>(dest.strand_ease, "strand_ease", db);
371 ReadField<ErrorPolicy_Igno>(dest.strand_surfnor, "strand_surfnor", db);
372 ReadField<ErrorPolicy_Igno>(dest.strand_min, "strand_min", db);
373 ReadField<ErrorPolicy_Igno>(dest.strand_widthfade, "strand_widthfade", db);
374 ReadField<ErrorPolicy_Igno>(dest.sbias, "sbias", db);
375 ReadField<ErrorPolicy_Igno>(dest.lbias, "lbias", db);
376 ReadField<ErrorPolicy_Igno>(dest.shad_alpha, "shad_alpha", db);
377 ReadField<ErrorPolicy_Igno>(dest.param, "param", db);
378 ReadField<ErrorPolicy_Igno>(dest.rms, "rms", db);
379 ReadField<ErrorPolicy_Igno>(dest.rampfac_col, "rampfac_col", db);
380 ReadField<ErrorPolicy_Igno>(dest.rampfac_spec, "rampfac_spec", db);
381 ReadField<ErrorPolicy_Igno>(dest.friction, "friction", db);
382 ReadField<ErrorPolicy_Igno>(dest.fh, "fh", db);
383 ReadField<ErrorPolicy_Igno>(dest.reflect, "reflect", db);
384 ReadField<ErrorPolicy_Igno>(dest.fhdist, "fhdist", db);
385 ReadField<ErrorPolicy_Igno>(dest.xyfrict, "xyfrict", db);
386 ReadField<ErrorPolicy_Igno>(dest.sss_radius, "sss_radius", db);
387 ReadField<ErrorPolicy_Igno>(dest.sss_col, "sss_col", db);
388 ReadField<ErrorPolicy_Igno>(dest.sss_error, "sss_error", db);
389 ReadField<ErrorPolicy_Igno>(dest.sss_scale, "sss_scale", db);
390 ReadField<ErrorPolicy_Igno>(dest.sss_ior, "sss_ior", db);
391 ReadField<ErrorPolicy_Igno>(dest.sss_colfac, "sss_colfac", db);
392 ReadField<ErrorPolicy_Igno>(dest.sss_texfac, "sss_texfac", db);
393 ReadField<ErrorPolicy_Igno>(dest.sss_front, "sss_front", db);
394 ReadField<ErrorPolicy_Igno>(dest.sss_back, "sss_back", db);
395
396 ReadField<ErrorPolicy_Igno>(dest.material_type, "material_type", db);
397 ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
398 ReadField<ErrorPolicy_Igno>(dest.ray_depth, "ray_depth", db);
399 ReadField<ErrorPolicy_Igno>(dest.ray_depth_tra, "ray_depth_tra", db);
400 ReadField<ErrorPolicy_Igno>(dest.samp_gloss_mir, "samp_gloss_mir", db);
401 ReadField<ErrorPolicy_Igno>(dest.samp_gloss_tra, "samp_gloss_tra", db);
402 ReadField<ErrorPolicy_Igno>(dest.fadeto_mir, "fadeto_mir", db);
403 ReadField<ErrorPolicy_Igno>(dest.shade_flag, "shade_flag", db);
404 ReadField<ErrorPolicy_Igno>(dest.flarec, "flarec", db);
405 ReadField<ErrorPolicy_Igno>(dest.starc, "starc", db);
406 ReadField<ErrorPolicy_Igno>(dest.linec, "linec", db);
407 ReadField<ErrorPolicy_Igno>(dest.ringc, "ringc", db);
408 ReadField<ErrorPolicy_Igno>(dest.pr_lamp, "pr_lamp", db);
409 ReadField<ErrorPolicy_Igno>(dest.pr_texture, "pr_texture", db);
410 ReadField<ErrorPolicy_Igno>(dest.ml_flag, "ml_flag", db);
411 ReadField<ErrorPolicy_Igno>(dest.diff_shader, "diff_shader", db);
412 ReadField<ErrorPolicy_Igno>(dest.spec_shader, "spec_shader", db);
413 ReadField<ErrorPolicy_Igno>(dest.texco, "texco", db);
414 ReadField<ErrorPolicy_Igno>(dest.mapto, "mapto", db);
415 ReadField<ErrorPolicy_Igno>(dest.ramp_show, "ramp_show", db);
416 ReadField<ErrorPolicy_Igno>(dest.pad3, "pad3", db);
417 ReadField<ErrorPolicy_Igno>(dest.dynamode, "dynamode", db);
418 ReadField<ErrorPolicy_Igno>(dest.pad2, "pad2", db);
419 ReadField<ErrorPolicy_Igno>(dest.sss_flag, "sss_flag", db);
420 ReadField<ErrorPolicy_Igno>(dest.sss_preset, "sss_preset", db);
421 ReadField<ErrorPolicy_Igno>(dest.shadowonly_flag, "shadowonly_flag", db);
422 ReadField<ErrorPolicy_Igno>(dest.index, "index", db);
423 ReadField<ErrorPolicy_Igno>(dest.vcol_alpha, "vcol_alpha", db);
424 ReadField<ErrorPolicy_Igno>(dest.pad4, "pad4", db);
425
426 ReadField<ErrorPolicy_Igno>(dest.seed1, "seed1", db);
427 ReadField<ErrorPolicy_Igno>(dest.seed2, "seed2", db);
428
429 db.reader->IncPtr(size);
430}
431
432//--------------------------------------------------------------------------------
433template <> void Structure :: Convert<MTexPoly> (
434 MTexPoly& dest,
435 const FileDatabase& db
436 ) const
437{
438
439 {
440 std::shared_ptr<Image> tpage;
441 ReadFieldPtr<ErrorPolicy_Igno>(tpage,"*tpage",db);
442 dest.tpage = tpage.get();
443 }
444 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
445 ReadField<ErrorPolicy_Igno>(dest.transp,"transp",db);
446 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
447 ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
448 ReadField<ErrorPolicy_Igno>(dest.pad,"pad",db);
449
450 db.reader->IncPtr(size);
451}
452
453//--------------------------------------------------------------------------------
454template <> void Structure :: Convert<Mesh> (
455 Mesh& dest,
456 const FileDatabase& db
457 ) const
458{
459
460 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
461 ReadField<ErrorPolicy_Fail>(dest.totface,"totface",db);
462 ReadField<ErrorPolicy_Fail>(dest.totedge,"totedge",db);
463 ReadField<ErrorPolicy_Fail>(dest.totvert,"totvert",db);
464 ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db);
465 ReadField<ErrorPolicy_Igno>(dest.totpoly,"totpoly",db);
466 ReadField<ErrorPolicy_Igno>(dest.subdiv,"subdiv",db);
467 ReadField<ErrorPolicy_Igno>(dest.subdivr,"subdivr",db);
468 ReadField<ErrorPolicy_Igno>(dest.subsurftype,"subsurftype",db);
469 ReadField<ErrorPolicy_Igno>(dest.smoothresh,"smoothresh",db);
470 ReadFieldPtr<ErrorPolicy_Fail>(dest.mface,"*mface",db);
471 ReadFieldPtr<ErrorPolicy_Igno>(dest.mtface,"*mtface",db);
472 ReadFieldPtr<ErrorPolicy_Igno>(dest.tface,"*tface",db);
473 ReadFieldPtr<ErrorPolicy_Fail>(dest.mvert,"*mvert",db);
474 ReadFieldPtr<ErrorPolicy_Warn>(dest.medge,"*medge",db);
475 ReadFieldPtr<ErrorPolicy_Igno>(dest.mloop,"*mloop",db);
476 ReadFieldPtr<ErrorPolicy_Igno>(dest.mloopuv,"*mloopuv",db);
477 ReadFieldPtr<ErrorPolicy_Igno>(dest.mloopcol,"*mloopcol",db);
478 ReadFieldPtr<ErrorPolicy_Igno>(dest.mpoly,"*mpoly",db);
479 ReadFieldPtr<ErrorPolicy_Igno>(dest.mtpoly,"*mtpoly",db);
480 ReadFieldPtr<ErrorPolicy_Igno>(dest.dvert,"*dvert",db);
481 ReadFieldPtr<ErrorPolicy_Igno>(dest.mcol,"*mcol",db);
482 ReadFieldPtr<ErrorPolicy_Fail>(dest.mat,"**mat",db);
483
484 db.reader->IncPtr(size);
485}
486
487//--------------------------------------------------------------------------------
488template <> void Structure :: Convert<MDeformVert> (
489 MDeformVert& dest,
490 const FileDatabase& db
491 ) const
492{
493
494 ReadFieldPtr<ErrorPolicy_Warn>(dest.dw,"*dw",db);
495 ReadField<ErrorPolicy_Igno>(dest.totweight,"totweight",db);
496
497 db.reader->IncPtr(size);
498}
499
500//--------------------------------------------------------------------------------
501template <> void Structure :: Convert<World> (
502 World& dest,
503 const FileDatabase& db
504 ) const
505{
506
507 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
508
509 db.reader->IncPtr(size);
510}
511
512//--------------------------------------------------------------------------------
513template <> void Structure :: Convert<MLoopCol> (
514 MLoopCol& dest,
515 const FileDatabase& db
516 ) const
517{
518
519 ReadField<ErrorPolicy_Igno>(dest.r,"r",db);
520 ReadField<ErrorPolicy_Igno>(dest.g,"g",db);
521 ReadField<ErrorPolicy_Igno>(dest.b,"b",db);
522 ReadField<ErrorPolicy_Igno>(dest.a,"a",db);
523
524 db.reader->IncPtr(size);
525}
526
527//--------------------------------------------------------------------------------
528template <> void Structure :: Convert<MVert> (
529 MVert& dest,
530 const FileDatabase& db
531 ) const
532{
533
534 ReadFieldArray<ErrorPolicy_Fail>(dest.co,"co",db);
535 ReadFieldArray<ErrorPolicy_Fail>(dest.no,"no",db);
536 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
537 //ReadField<ErrorPolicy_Warn>(dest.mat_nr,"mat_nr",db);
538 ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
539
540 db.reader->IncPtr(size);
541}
542
543//--------------------------------------------------------------------------------
544template <> void Structure :: Convert<MEdge> (
545 MEdge& dest,
546 const FileDatabase& db
547 ) const
548{
549
550 ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db);
551 ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db);
552 ReadField<ErrorPolicy_Igno>(dest.crease,"crease",db);
553 ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
554 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
555
556 db.reader->IncPtr(size);
557}
558
559//--------------------------------------------------------------------------------
560template <> void Structure :: Convert<MLoopUV> (
561 MLoopUV& dest,
562 const FileDatabase& db
563 ) const
564{
565
566 ReadFieldArray<ErrorPolicy_Igno>(dest.uv,"uv",db);
567 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
568
569 db.reader->IncPtr(size);
570}
571
572//--------------------------------------------------------------------------------
573template <> void Structure :: Convert<GroupObject> (
574 GroupObject& dest,
575 const FileDatabase& db
576 ) const
577{
578
579 ReadFieldPtr<ErrorPolicy_Fail>(dest.prev,"*prev",db);
580 ReadFieldPtr<ErrorPolicy_Fail>(dest.next,"*next",db);
581 ReadFieldPtr<ErrorPolicy_Igno>(dest.ob,"*ob",db);
582
583 db.reader->IncPtr(size);
584}
585
586//--------------------------------------------------------------------------------
587template <> void Structure :: Convert<ListBase> (
588 ListBase& dest,
589 const FileDatabase& db
590 ) const
591{
592
593 ReadFieldPtr<ErrorPolicy_Igno>(dest.first,"*first",db);
594 ReadFieldPtr<ErrorPolicy_Igno>(dest.last,"*last",db);
595
596 db.reader->IncPtr(size);
597}
598
599//--------------------------------------------------------------------------------
600template <> void Structure :: Convert<MLoop> (
601 MLoop& dest,
602 const FileDatabase& db
603 ) const
604{
605
606 ReadField<ErrorPolicy_Igno>(dest.v,"v",db);
607 ReadField<ErrorPolicy_Igno>(dest.e,"e",db);
608
609 db.reader->IncPtr(size);
610}
611
612//--------------------------------------------------------------------------------
613template <> void Structure :: Convert<ModifierData> (
614 ModifierData& dest,
615 const FileDatabase& db
616 ) const
617{
618
619 ReadFieldPtr<ErrorPolicy_Warn>(dest.next,"*next",db);
620 ReadFieldPtr<ErrorPolicy_Warn>(dest.prev,"*prev",db);
621 ReadField<ErrorPolicy_Igno>(dest.type,"type",db);
622 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
623 ReadFieldArray<ErrorPolicy_Igno>(dest.name,"name",db);
624
625 db.reader->IncPtr(size);
626}
627
628//--------------------------------------------------------------------------------
629template <> void Structure :: Convert<ID> (
630 ID& dest,
631 const FileDatabase& db
632 ) const
633{
634
635 ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
636 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
637
638 db.reader->IncPtr(size);
639}
640
641//--------------------------------------------------------------------------------
642template <> void Structure :: Convert<MCol> (
643 MCol& dest,
644 const FileDatabase& db
645 ) const
646{
647
648 ReadField<ErrorPolicy_Fail>(dest.r,"r",db);
649 ReadField<ErrorPolicy_Fail>(dest.g,"g",db);
650 ReadField<ErrorPolicy_Fail>(dest.b,"b",db);
651 ReadField<ErrorPolicy_Fail>(dest.a,"a",db);
652
653 db.reader->IncPtr(size);
654}
655
656//--------------------------------------------------------------------------------
657template <> void Structure :: Convert<MPoly> (
658 MPoly& dest,
659 const FileDatabase& db
660 ) const
661{
662
663 ReadField<ErrorPolicy_Igno>(dest.loopstart,"loopstart",db);
664 ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db);
665 ReadField<ErrorPolicy_Igno>(dest.mat_nr,"mat_nr",db);
666 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
667
668 db.reader->IncPtr(size);
669}
670
671//--------------------------------------------------------------------------------
672template <> void Structure :: Convert<Scene> (
673 Scene& dest,
674 const FileDatabase& db
675 ) const
676{
677
678 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
679 ReadFieldPtr<ErrorPolicy_Warn>(dest.camera,"*camera",db);
680 ReadFieldPtr<ErrorPolicy_Warn>(dest.world,"*world",db);
681 ReadFieldPtr<ErrorPolicy_Warn>(dest.basact,"*basact",db);
682 ReadField<ErrorPolicy_Igno>(dest.base,"base",db);
683
684 db.reader->IncPtr(size);
685}
686
687//--------------------------------------------------------------------------------
688template <> void Structure :: Convert<Library> (
689 Library& dest,
690 const FileDatabase& db
691 ) const
692{
693
694 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
695 ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
696 ReadFieldArray<ErrorPolicy_Fail>(dest.filename,"filename",db);
697 ReadFieldPtr<ErrorPolicy_Warn>(dest.parent,"*parent",db);
698
699 db.reader->IncPtr(size);
700}
701
702//--------------------------------------------------------------------------------
703template <> void Structure :: Convert<Tex> (
704 Tex& dest,
705 const FileDatabase& db
706 ) const
707{
708 short temp_short = 0;
709 ReadField<ErrorPolicy_Igno>(temp_short,"imaflag",db);
710 dest.imaflag = static_cast<Assimp::Blender::Tex::ImageFlags>(temp_short);
711 int temp = 0;
712 ReadField<ErrorPolicy_Fail>(temp,"type",db);
713 dest.type = static_cast<Assimp::Blender::Tex::Type>(temp);
714 ReadFieldPtr<ErrorPolicy_Warn>(dest.ima,"*ima",db);
715
716 db.reader->IncPtr(size);
717}
718
719//--------------------------------------------------------------------------------
720template <> void Structure :: Convert<Camera> (
721 Camera& dest,
722 const FileDatabase& db
723 ) const
724{
725
726 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
727 int temp = 0;
728 ReadField<ErrorPolicy_Warn>(temp,"type",db);
729 dest.type = static_cast<Assimp::Blender::Camera::Type>(temp);
730 ReadField<ErrorPolicy_Warn>(temp,"flag",db);
731 dest.flag = static_cast<Assimp::Blender::Camera::Type>(temp);
732 ReadField<ErrorPolicy_Warn>(dest.lens,"lens",db);
733 ReadField<ErrorPolicy_Warn>(dest.sensor_x,"sensor_x",db);
734 ReadField<ErrorPolicy_Igno>(dest.clipsta,"clipsta",db);
735 ReadField<ErrorPolicy_Igno>(dest.clipend,"clipend",db);
736
737 db.reader->IncPtr(size);
738}
739
740//--------------------------------------------------------------------------------
741template <> void Structure :: Convert<MirrorModifierData> (
742 MirrorModifierData& dest,
743 const FileDatabase& db
744 ) const
745{
746
747 ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db);
748 ReadField<ErrorPolicy_Igno>(dest.axis,"axis",db);
749 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
750 ReadField<ErrorPolicy_Igno>(dest.tolerance,"tolerance",db);
751 ReadFieldPtr<ErrorPolicy_Igno>(dest.mirror_ob,"*mirror_ob",db);
752
753 db.reader->IncPtr(size);
754}
755
756//--------------------------------------------------------------------------------
757template <> void Structure :: Convert<Image> (
758 Image& dest,
759 const FileDatabase& db
760 ) const
761{
762
763 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
764 ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
765 ReadField<ErrorPolicy_Igno>(dest.ok,"ok",db);
766 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
767 ReadField<ErrorPolicy_Igno>(dest.source,"source",db);
768 ReadField<ErrorPolicy_Igno>(dest.type,"type",db);
769 ReadField<ErrorPolicy_Igno>(dest.pad,"pad",db);
770 ReadField<ErrorPolicy_Igno>(dest.pad1,"pad1",db);
771 ReadField<ErrorPolicy_Igno>(dest.lastframe,"lastframe",db);
772 ReadField<ErrorPolicy_Igno>(dest.tpageflag,"tpageflag",db);
773 ReadField<ErrorPolicy_Igno>(dest.totbind,"totbind",db);
774 ReadField<ErrorPolicy_Igno>(dest.xrep,"xrep",db);
775 ReadField<ErrorPolicy_Igno>(dest.yrep,"yrep",db);
776 ReadField<ErrorPolicy_Igno>(dest.twsta,"twsta",db);
777 ReadField<ErrorPolicy_Igno>(dest.twend,"twend",db);
778 ReadFieldPtr<ErrorPolicy_Igno>(dest.packedfile,"*packedfile",db);
779 ReadField<ErrorPolicy_Igno>(dest.lastupdate,"lastupdate",db);
780 ReadField<ErrorPolicy_Igno>(dest.lastused,"lastused",db);
781 ReadField<ErrorPolicy_Igno>(dest.animspeed,"animspeed",db);
782 ReadField<ErrorPolicy_Igno>(dest.gen_x,"gen_x",db);
783 ReadField<ErrorPolicy_Igno>(dest.gen_y,"gen_y",db);
784 ReadField<ErrorPolicy_Igno>(dest.gen_type,"gen_type",db);
785
786 db.reader->IncPtr(size);
787}
788
789//--------------------------------------------------------------------------------
790void DNA::RegisterConverters() {
791
792 converters["Object"] = DNA::FactoryPair( &Structure::Allocate<Object>, &Structure::Convert<Object> );
793 converters["Group"] = DNA::FactoryPair( &Structure::Allocate<Group>, &Structure::Convert<Group> );
794 converters["MTex"] = DNA::FactoryPair( &Structure::Allocate<MTex>, &Structure::Convert<MTex> );
795 converters["TFace"] = DNA::FactoryPair( &Structure::Allocate<TFace>, &Structure::Convert<TFace> );
796 converters["SubsurfModifierData"] = DNA::FactoryPair( &Structure::Allocate<SubsurfModifierData>, &Structure::Convert<SubsurfModifierData> );
797 converters["MFace"] = DNA::FactoryPair( &Structure::Allocate<MFace>, &Structure::Convert<MFace> );
798 converters["Lamp"] = DNA::FactoryPair( &Structure::Allocate<Lamp>, &Structure::Convert<Lamp> );
799 converters["MDeformWeight"] = DNA::FactoryPair( &Structure::Allocate<MDeformWeight>, &Structure::Convert<MDeformWeight> );
800 converters["PackedFile"] = DNA::FactoryPair( &Structure::Allocate<PackedFile>, &Structure::Convert<PackedFile> );
801 converters["Base"] = DNA::FactoryPair( &Structure::Allocate<Base>, &Structure::Convert<Base> );
802 converters["MTFace"] = DNA::FactoryPair( &Structure::Allocate<MTFace>, &Structure::Convert<MTFace> );
803 converters["Material"] = DNA::FactoryPair( &Structure::Allocate<Material>, &Structure::Convert<Material> );
804 converters["MTexPoly"] = DNA::FactoryPair( &Structure::Allocate<MTexPoly>, &Structure::Convert<MTexPoly> );
805 converters["Mesh"] = DNA::FactoryPair( &Structure::Allocate<Mesh>, &Structure::Convert<Mesh> );
806 converters["MDeformVert"] = DNA::FactoryPair( &Structure::Allocate<MDeformVert>, &Structure::Convert<MDeformVert> );
807 converters["World"] = DNA::FactoryPair( &Structure::Allocate<World>, &Structure::Convert<World> );
808 converters["MLoopCol"] = DNA::FactoryPair( &Structure::Allocate<MLoopCol>, &Structure::Convert<MLoopCol> );
809 converters["MVert"] = DNA::FactoryPair( &Structure::Allocate<MVert>, &Structure::Convert<MVert> );
810 converters["MEdge"] = DNA::FactoryPair( &Structure::Allocate<MEdge>, &Structure::Convert<MEdge> );
811 converters["MLoopUV"] = DNA::FactoryPair( &Structure::Allocate<MLoopUV>, &Structure::Convert<MLoopUV> );
812 converters["GroupObject"] = DNA::FactoryPair( &Structure::Allocate<GroupObject>, &Structure::Convert<GroupObject> );
813 converters["ListBase"] = DNA::FactoryPair( &Structure::Allocate<ListBase>, &Structure::Convert<ListBase> );
814 converters["MLoop"] = DNA::FactoryPair( &Structure::Allocate<MLoop>, &Structure::Convert<MLoop> );
815 converters["ModifierData"] = DNA::FactoryPair( &Structure::Allocate<ModifierData>, &Structure::Convert<ModifierData> );
816 converters["ID"] = DNA::FactoryPair( &Structure::Allocate<ID>, &Structure::Convert<ID> );
817 converters["MCol"] = DNA::FactoryPair( &Structure::Allocate<MCol>, &Structure::Convert<MCol> );
818 converters["MPoly"] = DNA::FactoryPair( &Structure::Allocate<MPoly>, &Structure::Convert<MPoly> );
819 converters["Scene"] = DNA::FactoryPair( &Structure::Allocate<Scene>, &Structure::Convert<Scene> );
820 converters["Library"] = DNA::FactoryPair( &Structure::Allocate<Library>, &Structure::Convert<Library> );
821 converters["Tex"] = DNA::FactoryPair( &Structure::Allocate<Tex>, &Structure::Convert<Tex> );
822 converters["Camera"] = DNA::FactoryPair( &Structure::Allocate<Camera>, &Structure::Convert<Camera> );
823 converters["MirrorModifierData"] = DNA::FactoryPair( &Structure::Allocate<MirrorModifierData>, &Structure::Convert<MirrorModifierData> );
824 converters["Image"] = DNA::FactoryPair( &Structure::Allocate<Image>, &Structure::Convert<Image> );
825}
826
827#endif // ASSIMP_BUILD_NO_BLEND_IMPORTER
828
829