vrshoot

view libs/assimp/BlenderScene.cpp @ 2:334d17aed7de

visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 18:36:38 +0200
parents
children
line source
1 /*
2 Open Asset Import Library (ASSIMP)
3 ----------------------------------------------------------------------
5 Copyright (c) 2006-2010, ASSIMP Development Team
6 All rights reserved.
8 Redistribution and use of this software in source and binary forms,
9 with or without modification, are permitted provided that the
10 following conditions are met:
12 * Redistributions of source code must retain the above
13 copyright notice, this list of conditions and the
14 following disclaimer.
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.
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.
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ----------------------------------------------------------------------
39 */
41 /** @file BlenderScene.cpp
42 * @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
43 */
44 #include "AssimpPCH.h"
45 #ifndef AI_BUILD_NO_BLEND_IMPORTER
47 #include "BlenderDNA.h"
48 #include "BlenderScene.h"
49 #include "BlenderSceneGen.h"
51 using namespace Assimp;
52 using namespace Assimp::Blender;
54 //--------------------------------------------------------------------------------
55 template <> void Structure :: Convert<Object> (
56 Object& dest,
57 const FileDatabase& db
58 ) const
59 {
61 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
62 ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db);
63 ReadFieldArray2<ErrorPolicy_Warn>(dest.obmat,"obmat",db);
64 ReadFieldArray2<ErrorPolicy_Warn>(dest.parentinv,"parentinv",db);
65 ReadFieldArray<ErrorPolicy_Warn>(dest.parsubstr,"parsubstr",db);
66 {
67 boost::shared_ptr<Object> parent;
68 ReadFieldPtr<ErrorPolicy_Warn>(parent,"*parent",db);
69 dest.parent = parent.get();
70 }
71 ReadFieldPtr<ErrorPolicy_Warn>(dest.track,"*track",db);
72 ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy,"*proxy",db);
73 ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy_from,"*proxy_from",db);
74 ReadFieldPtr<ErrorPolicy_Warn>(dest.proxy_group,"*proxy_group",db);
75 ReadFieldPtr<ErrorPolicy_Warn>(dest.dup_group,"*dup_group",db);
76 ReadFieldPtr<ErrorPolicy_Fail>(dest.data,"*data",db);
77 ReadField<ErrorPolicy_Igno>(dest.modifiers,"modifiers",db);
79 db.reader->IncPtr(size);
80 }
82 //--------------------------------------------------------------------------------
83 template <> void Structure :: Convert<Group> (
84 Group& dest,
85 const FileDatabase& db
86 ) const
87 {
89 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
90 ReadField<ErrorPolicy_Igno>(dest.layer,"layer",db);
91 ReadFieldPtr<ErrorPolicy_Igno>(dest.gobject,"*gobject",db);
93 db.reader->IncPtr(size);
94 }
96 //--------------------------------------------------------------------------------
97 template <> void Structure :: Convert<MTex> (
98 MTex& dest,
99 const FileDatabase& db
100 ) const
101 {
103 ReadField<ErrorPolicy_Igno>((int&)dest.blendtype,"blendtype",db);
104 ReadFieldPtr<ErrorPolicy_Igno>(dest.object,"*object",db);
105 ReadFieldPtr<ErrorPolicy_Igno>(dest.tex,"*tex",db);
106 ReadFieldArray<ErrorPolicy_Igno>(dest.uvname,"uvname",db);
107 ReadField<ErrorPolicy_Igno>((int&)dest.projx,"projx",db);
108 ReadField<ErrorPolicy_Igno>((int&)dest.projy,"projy",db);
109 ReadField<ErrorPolicy_Igno>((int&)dest.projz,"projz",db);
110 ReadField<ErrorPolicy_Igno>(dest.mapping,"mapping",db);
111 ReadFieldArray<ErrorPolicy_Igno>(dest.ofs,"ofs",db);
112 ReadFieldArray<ErrorPolicy_Igno>(dest.size,"size",db);
113 ReadField<ErrorPolicy_Igno>(dest.rot,"rot",db);
114 ReadField<ErrorPolicy_Igno>(dest.texflag,"texflag",db);
115 ReadField<ErrorPolicy_Igno>(dest.colormodel,"colormodel",db);
116 ReadField<ErrorPolicy_Igno>(dest.pmapto,"pmapto",db);
117 ReadField<ErrorPolicy_Igno>(dest.pmaptoneg,"pmaptoneg",db);
118 ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
119 ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
120 ReadField<ErrorPolicy_Warn>(dest.b,"b",db);
121 ReadField<ErrorPolicy_Warn>(dest.k,"k",db);
122 ReadField<ErrorPolicy_Igno>(dest.colspecfac,"colspecfac",db);
123 ReadField<ErrorPolicy_Igno>(dest.mirrfac,"mirrfac",db);
124 ReadField<ErrorPolicy_Igno>(dest.alphafac,"alphafac",db);
125 ReadField<ErrorPolicy_Igno>(dest.difffac,"difffac",db);
126 ReadField<ErrorPolicy_Igno>(dest.specfac,"specfac",db);
127 ReadField<ErrorPolicy_Igno>(dest.emitfac,"emitfac",db);
128 ReadField<ErrorPolicy_Igno>(dest.hardfac,"hardfac",db);
130 db.reader->IncPtr(size);
131 }
133 //--------------------------------------------------------------------------------
134 template <> void Structure :: Convert<TFace> (
135 TFace& dest,
136 const FileDatabase& db
137 ) const
138 {
140 ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db);
141 ReadFieldArray<ErrorPolicy_Fail>(dest.col,"col",db);
142 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
143 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
144 ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
145 ReadField<ErrorPolicy_Igno>(dest.unwrap,"unwrap",db);
147 db.reader->IncPtr(size);
148 }
150 //--------------------------------------------------------------------------------
151 template <> void Structure :: Convert<SubsurfModifierData> (
152 SubsurfModifierData& dest,
153 const FileDatabase& db
154 ) const
155 {
157 ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db);
158 ReadField<ErrorPolicy_Warn>(dest.subdivType,"subdivType",db);
159 ReadField<ErrorPolicy_Fail>(dest.levels,"levels",db);
160 ReadField<ErrorPolicy_Igno>(dest.renderLevels,"renderLevels",db);
161 ReadField<ErrorPolicy_Igno>(dest.flags,"flags",db);
163 db.reader->IncPtr(size);
164 }
166 //--------------------------------------------------------------------------------
167 template <> void Structure :: Convert<MFace> (
168 MFace& dest,
169 const FileDatabase& db
170 ) const
171 {
173 ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db);
174 ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db);
175 ReadField<ErrorPolicy_Fail>(dest.v3,"v3",db);
176 ReadField<ErrorPolicy_Fail>(dest.v4,"v4",db);
177 ReadField<ErrorPolicy_Fail>(dest.mat_nr,"mat_nr",db);
178 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
180 db.reader->IncPtr(size);
181 }
183 //--------------------------------------------------------------------------------
184 template <> void Structure :: Convert<Lamp> (
185 Lamp& dest,
186 const FileDatabase& db
187 ) const
188 {
190 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
191 ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db);
192 ReadField<ErrorPolicy_Igno>(dest.flags,"flags",db);
193 ReadField<ErrorPolicy_Igno>(dest.colormodel,"colormodel",db);
194 ReadField<ErrorPolicy_Igno>(dest.totex,"totex",db);
195 ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
196 ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
197 ReadField<ErrorPolicy_Warn>(dest.b,"b",db);
198 ReadField<ErrorPolicy_Warn>(dest.k,"k",db);
199 ReadField<ErrorPolicy_Igno>(dest.energy,"energy",db);
200 ReadField<ErrorPolicy_Igno>(dest.dist,"dist",db);
201 ReadField<ErrorPolicy_Igno>(dest.spotsize,"spotsize",db);
202 ReadField<ErrorPolicy_Igno>(dest.spotblend,"spotblend",db);
203 ReadField<ErrorPolicy_Igno>(dest.att1,"att1",db);
204 ReadField<ErrorPolicy_Igno>(dest.att2,"att2",db);
205 ReadField<ErrorPolicy_Igno>((int&)dest.falloff_type,"falloff_type",db);
206 ReadField<ErrorPolicy_Igno>(dest.sun_brightness,"sun_brightness",db);
208 db.reader->IncPtr(size);
209 }
211 //--------------------------------------------------------------------------------
212 template <> void Structure :: Convert<MDeformWeight> (
213 MDeformWeight& dest,
214 const FileDatabase& db
215 ) const
216 {
218 ReadField<ErrorPolicy_Fail>(dest.def_nr,"def_nr",db);
219 ReadField<ErrorPolicy_Fail>(dest.weight,"weight",db);
221 db.reader->IncPtr(size);
222 }
224 //--------------------------------------------------------------------------------
225 template <> void Structure :: Convert<PackedFile> (
226 PackedFile& dest,
227 const FileDatabase& db
228 ) const
229 {
231 ReadField<ErrorPolicy_Warn>(dest.size,"size",db);
232 ReadField<ErrorPolicy_Warn>(dest.seek,"seek",db);
233 ReadFieldPtr<ErrorPolicy_Warn>(dest.data,"*data",db);
235 db.reader->IncPtr(size);
236 }
238 //--------------------------------------------------------------------------------
239 template <> void Structure :: Convert<Base> (
240 Base& dest,
241 const FileDatabase& db
242 ) const
243 {
245 {
246 boost::shared_ptr<Base> prev;
247 ReadFieldPtr<ErrorPolicy_Warn>(prev,"*prev",db);
248 dest.prev = prev.get();
249 }
250 ReadFieldPtr<ErrorPolicy_Warn>(dest.next,"*next",db);
251 ReadFieldPtr<ErrorPolicy_Warn>(dest.object,"*object",db);
253 db.reader->IncPtr(size);
254 }
256 //--------------------------------------------------------------------------------
257 template <> void Structure :: Convert<MTFace> (
258 MTFace& dest,
259 const FileDatabase& db
260 ) const
261 {
263 ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db);
264 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
265 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
266 ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
267 ReadField<ErrorPolicy_Igno>(dest.unwrap,"unwrap",db);
269 db.reader->IncPtr(size);
270 }
272 //--------------------------------------------------------------------------------
273 template <> void Structure :: Convert<Material> (
274 Material& dest,
275 const FileDatabase& db
276 ) const
277 {
279 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
280 ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
281 ReadField<ErrorPolicy_Warn>(dest.g,"g",db);
282 ReadField<ErrorPolicy_Warn>(dest.b,"b",db);
283 ReadField<ErrorPolicy_Warn>(dest.specr,"specr",db);
284 ReadField<ErrorPolicy_Warn>(dest.specg,"specg",db);
285 ReadField<ErrorPolicy_Warn>(dest.specb,"specb",db);
286 ReadField<ErrorPolicy_Igno>(dest.har,"har",db);
287 ReadField<ErrorPolicy_Warn>(dest.ambr,"ambr",db);
288 ReadField<ErrorPolicy_Warn>(dest.ambg,"ambg",db);
289 ReadField<ErrorPolicy_Warn>(dest.ambb,"ambb",db);
290 ReadField<ErrorPolicy_Igno>(dest.mirr,"mirr",db);
291 ReadField<ErrorPolicy_Igno>(dest.mirg,"mirg",db);
292 ReadField<ErrorPolicy_Igno>(dest.mirb,"mirb",db);
293 ReadField<ErrorPolicy_Warn>(dest.emit,"emit",db);
294 ReadField<ErrorPolicy_Warn>(dest.alpha,"alpha",db);
295 ReadField<ErrorPolicy_Igno>(dest.ref,"ref",db);
296 ReadField<ErrorPolicy_Igno>(dest.translucency,"translucency",db);
297 ReadField<ErrorPolicy_Igno>(dest.roughness,"roughness",db);
298 ReadField<ErrorPolicy_Igno>(dest.darkness,"darkness",db);
299 ReadField<ErrorPolicy_Igno>(dest.refrac,"refrac",db);
300 ReadFieldPtr<ErrorPolicy_Igno>(dest.group,"*group",db);
301 ReadField<ErrorPolicy_Warn>(dest.diff_shader,"diff_shader",db);
302 ReadField<ErrorPolicy_Warn>(dest.spec_shader,"spec_shader",db);
303 ReadFieldPtr<ErrorPolicy_Igno>(dest.mtex,"*mtex",db);
305 db.reader->IncPtr(size);
306 }
308 //--------------------------------------------------------------------------------
309 template <> void Structure :: Convert<MTexPoly> (
310 MTexPoly& dest,
311 const FileDatabase& db
312 ) const
313 {
315 {
316 boost::shared_ptr<Image> tpage;
317 ReadFieldPtr<ErrorPolicy_Igno>(tpage,"*tpage",db);
318 dest.tpage = tpage.get();
319 }
320 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
321 ReadField<ErrorPolicy_Igno>(dest.transp,"transp",db);
322 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
323 ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
324 ReadField<ErrorPolicy_Igno>(dest.pad,"pad",db);
326 db.reader->IncPtr(size);
327 }
329 //--------------------------------------------------------------------------------
330 template <> void Structure :: Convert<Mesh> (
331 Mesh& dest,
332 const FileDatabase& db
333 ) const
334 {
336 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
337 ReadField<ErrorPolicy_Fail>(dest.totface,"totface",db);
338 ReadField<ErrorPolicy_Fail>(dest.totedge,"totedge",db);
339 ReadField<ErrorPolicy_Fail>(dest.totvert,"totvert",db);
340 ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db);
341 ReadField<ErrorPolicy_Igno>(dest.totpoly,"totpoly",db);
342 ReadField<ErrorPolicy_Igno>(dest.subdiv,"subdiv",db);
343 ReadField<ErrorPolicy_Igno>(dest.subdivr,"subdivr",db);
344 ReadField<ErrorPolicy_Igno>(dest.subsurftype,"subsurftype",db);
345 ReadField<ErrorPolicy_Igno>(dest.smoothresh,"smoothresh",db);
346 ReadFieldPtr<ErrorPolicy_Fail>(dest.mface,"*mface",db);
347 ReadFieldPtr<ErrorPolicy_Igno>(dest.mtface,"*mtface",db);
348 ReadFieldPtr<ErrorPolicy_Igno>(dest.tface,"*tface",db);
349 ReadFieldPtr<ErrorPolicy_Fail>(dest.mvert,"*mvert",db);
350 ReadFieldPtr<ErrorPolicy_Warn>(dest.medge,"*medge",db);
351 ReadFieldPtr<ErrorPolicy_Igno>(dest.mloop,"*mloop",db);
352 ReadFieldPtr<ErrorPolicy_Igno>(dest.mloopuv,"*mloopuv",db);
353 ReadFieldPtr<ErrorPolicy_Igno>(dest.mloopcol,"*mloopcol",db);
354 ReadFieldPtr<ErrorPolicy_Igno>(dest.mpoly,"*mpoly",db);
355 ReadFieldPtr<ErrorPolicy_Igno>(dest.mtpoly,"*mtpoly",db);
356 ReadFieldPtr<ErrorPolicy_Igno>(dest.dvert,"*dvert",db);
357 ReadFieldPtr<ErrorPolicy_Igno>(dest.mcol,"*mcol",db);
358 ReadFieldPtr<ErrorPolicy_Fail>(dest.mat,"**mat",db);
360 db.reader->IncPtr(size);
361 }
363 //--------------------------------------------------------------------------------
364 template <> void Structure :: Convert<MDeformVert> (
365 MDeformVert& dest,
366 const FileDatabase& db
367 ) const
368 {
370 ReadFieldPtr<ErrorPolicy_Warn>(dest.dw,"*dw",db);
371 ReadField<ErrorPolicy_Igno>(dest.totweight,"totweight",db);
373 db.reader->IncPtr(size);
374 }
376 //--------------------------------------------------------------------------------
377 template <> void Structure :: Convert<World> (
378 World& dest,
379 const FileDatabase& db
380 ) const
381 {
383 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
385 db.reader->IncPtr(size);
386 }
388 //--------------------------------------------------------------------------------
389 template <> void Structure :: Convert<MLoopCol> (
390 MLoopCol& dest,
391 const FileDatabase& db
392 ) const
393 {
395 ReadField<ErrorPolicy_Igno>(dest.r,"r",db);
396 ReadField<ErrorPolicy_Igno>(dest.g,"g",db);
397 ReadField<ErrorPolicy_Igno>(dest.b,"b",db);
398 ReadField<ErrorPolicy_Igno>(dest.a,"a",db);
400 db.reader->IncPtr(size);
401 }
403 //--------------------------------------------------------------------------------
404 template <> void Structure :: Convert<MVert> (
405 MVert& dest,
406 const FileDatabase& db
407 ) const
408 {
410 ReadFieldArray<ErrorPolicy_Fail>(dest.co,"co",db);
411 ReadFieldArray<ErrorPolicy_Fail>(dest.no,"no",db);
412 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
413 ReadField<ErrorPolicy_Warn>(dest.mat_nr,"mat_nr",db);
414 ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
416 db.reader->IncPtr(size);
417 }
419 //--------------------------------------------------------------------------------
420 template <> void Structure :: Convert<MEdge> (
421 MEdge& dest,
422 const FileDatabase& db
423 ) const
424 {
426 ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db);
427 ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db);
428 ReadField<ErrorPolicy_Igno>(dest.crease,"crease",db);
429 ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
430 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
432 db.reader->IncPtr(size);
433 }
435 //--------------------------------------------------------------------------------
436 template <> void Structure :: Convert<MLoopUV> (
437 MLoopUV& dest,
438 const FileDatabase& db
439 ) const
440 {
442 ReadFieldArray<ErrorPolicy_Igno>(dest.uv,"uv",db);
443 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
445 db.reader->IncPtr(size);
446 }
448 //--------------------------------------------------------------------------------
449 template <> void Structure :: Convert<GroupObject> (
450 GroupObject& dest,
451 const FileDatabase& db
452 ) const
453 {
455 ReadFieldPtr<ErrorPolicy_Fail>(dest.prev,"*prev",db);
456 ReadFieldPtr<ErrorPolicy_Fail>(dest.next,"*next",db);
457 ReadFieldPtr<ErrorPolicy_Igno>(dest.ob,"*ob",db);
459 db.reader->IncPtr(size);
460 }
462 //--------------------------------------------------------------------------------
463 template <> void Structure :: Convert<ListBase> (
464 ListBase& dest,
465 const FileDatabase& db
466 ) const
467 {
469 ReadFieldPtr<ErrorPolicy_Igno>(dest.first,"*first",db);
470 ReadFieldPtr<ErrorPolicy_Igno>(dest.last,"*last",db);
472 db.reader->IncPtr(size);
473 }
475 //--------------------------------------------------------------------------------
476 template <> void Structure :: Convert<MLoop> (
477 MLoop& dest,
478 const FileDatabase& db
479 ) const
480 {
482 ReadField<ErrorPolicy_Igno>(dest.v,"v",db);
483 ReadField<ErrorPolicy_Igno>(dest.e,"e",db);
485 db.reader->IncPtr(size);
486 }
488 //--------------------------------------------------------------------------------
489 template <> void Structure :: Convert<ModifierData> (
490 ModifierData& dest,
491 const FileDatabase& db
492 ) const
493 {
495 ReadFieldPtr<ErrorPolicy_Warn>(dest.next,"*next",db);
496 ReadFieldPtr<ErrorPolicy_Warn>(dest.prev,"*prev",db);
497 ReadField<ErrorPolicy_Igno>(dest.type,"type",db);
498 ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
499 ReadFieldArray<ErrorPolicy_Igno>(dest.name,"name",db);
501 db.reader->IncPtr(size);
502 }
504 //--------------------------------------------------------------------------------
505 template <> void Structure :: Convert<ID> (
506 ID& dest,
507 const FileDatabase& db
508 ) const
509 {
511 ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
512 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
514 db.reader->IncPtr(size);
515 }
517 //--------------------------------------------------------------------------------
518 template <> void Structure :: Convert<MCol> (
519 MCol& dest,
520 const FileDatabase& db
521 ) const
522 {
524 ReadField<ErrorPolicy_Fail>(dest.r,"r",db);
525 ReadField<ErrorPolicy_Fail>(dest.g,"g",db);
526 ReadField<ErrorPolicy_Fail>(dest.b,"b",db);
527 ReadField<ErrorPolicy_Fail>(dest.a,"a",db);
529 db.reader->IncPtr(size);
530 }
532 //--------------------------------------------------------------------------------
533 template <> void Structure :: Convert<MPoly> (
534 MPoly& dest,
535 const FileDatabase& db
536 ) const
537 {
539 ReadField<ErrorPolicy_Igno>(dest.loopstart,"loopstart",db);
540 ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db);
541 ReadField<ErrorPolicy_Igno>(dest.mat_nr,"mat_nr",db);
542 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
544 db.reader->IncPtr(size);
545 }
547 //--------------------------------------------------------------------------------
548 template <> void Structure :: Convert<Scene> (
549 Scene& dest,
550 const FileDatabase& db
551 ) const
552 {
554 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
555 ReadFieldPtr<ErrorPolicy_Warn>(dest.camera,"*camera",db);
556 ReadFieldPtr<ErrorPolicy_Warn>(dest.world,"*world",db);
557 ReadFieldPtr<ErrorPolicy_Warn>(dest.basact,"*basact",db);
558 ReadField<ErrorPolicy_Igno>(dest.base,"base",db);
560 db.reader->IncPtr(size);
561 }
563 //--------------------------------------------------------------------------------
564 template <> void Structure :: Convert<Library> (
565 Library& dest,
566 const FileDatabase& db
567 ) const
568 {
570 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
571 ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
572 ReadFieldArray<ErrorPolicy_Fail>(dest.filename,"filename",db);
573 ReadFieldPtr<ErrorPolicy_Warn>(dest.parent,"*parent",db);
575 db.reader->IncPtr(size);
576 }
578 //--------------------------------------------------------------------------------
579 template <> void Structure :: Convert<Tex> (
580 Tex& dest,
581 const FileDatabase& db
582 ) const
583 {
585 ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db);
586 ReadFieldPtr<ErrorPolicy_Warn>(dest.ima,"*ima",db);
588 db.reader->IncPtr(size);
589 }
591 //--------------------------------------------------------------------------------
592 template <> void Structure :: Convert<Camera> (
593 Camera& dest,
594 const FileDatabase& db
595 ) const
596 {
598 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
599 ReadField<ErrorPolicy_Warn>((int&)dest.type,"type",db);
600 ReadField<ErrorPolicy_Warn>((int&)dest.flag,"flag",db);
601 ReadField<ErrorPolicy_Warn>(dest.angle,"angle",db);
603 db.reader->IncPtr(size);
604 }
606 //--------------------------------------------------------------------------------
607 template <> void Structure :: Convert<MirrorModifierData> (
608 MirrorModifierData& dest,
609 const FileDatabase& db
610 ) const
611 {
613 ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db);
614 ReadField<ErrorPolicy_Igno>(dest.axis,"axis",db);
615 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
616 ReadField<ErrorPolicy_Igno>(dest.tolerance,"tolerance",db);
617 ReadFieldPtr<ErrorPolicy_Igno>(dest.mirror_ob,"*mirror_ob",db);
619 db.reader->IncPtr(size);
620 }
622 //--------------------------------------------------------------------------------
623 template <> void Structure :: Convert<Image> (
624 Image& dest,
625 const FileDatabase& db
626 ) const
627 {
629 ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
630 ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
631 ReadField<ErrorPolicy_Igno>(dest.ok,"ok",db);
632 ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
633 ReadField<ErrorPolicy_Igno>(dest.source,"source",db);
634 ReadField<ErrorPolicy_Igno>(dest.type,"type",db);
635 ReadField<ErrorPolicy_Igno>(dest.pad,"pad",db);
636 ReadField<ErrorPolicy_Igno>(dest.pad1,"pad1",db);
637 ReadField<ErrorPolicy_Igno>(dest.lastframe,"lastframe",db);
638 ReadField<ErrorPolicy_Igno>(dest.tpageflag,"tpageflag",db);
639 ReadField<ErrorPolicy_Igno>(dest.totbind,"totbind",db);
640 ReadField<ErrorPolicy_Igno>(dest.xrep,"xrep",db);
641 ReadField<ErrorPolicy_Igno>(dest.yrep,"yrep",db);
642 ReadField<ErrorPolicy_Igno>(dest.twsta,"twsta",db);
643 ReadField<ErrorPolicy_Igno>(dest.twend,"twend",db);
644 ReadFieldPtr<ErrorPolicy_Igno>(dest.packedfile,"*packedfile",db);
645 ReadField<ErrorPolicy_Igno>(dest.lastupdate,"lastupdate",db);
646 ReadField<ErrorPolicy_Igno>(dest.lastused,"lastused",db);
647 ReadField<ErrorPolicy_Igno>(dest.animspeed,"animspeed",db);
648 ReadField<ErrorPolicy_Igno>(dest.gen_x,"gen_x",db);
649 ReadField<ErrorPolicy_Igno>(dest.gen_y,"gen_y",db);
650 ReadField<ErrorPolicy_Igno>(dest.gen_type,"gen_type",db);
652 db.reader->IncPtr(size);
653 }
655 //--------------------------------------------------------------------------------
656 void DNA::RegisterConverters() {
658 converters["Object"] = DNA::FactoryPair( &Structure::Allocate<Object>, &Structure::Convert<Object> );
659 converters["Group"] = DNA::FactoryPair( &Structure::Allocate<Group>, &Structure::Convert<Group> );
660 converters["MTex"] = DNA::FactoryPair( &Structure::Allocate<MTex>, &Structure::Convert<MTex> );
661 converters["TFace"] = DNA::FactoryPair( &Structure::Allocate<TFace>, &Structure::Convert<TFace> );
662 converters["SubsurfModifierData"] = DNA::FactoryPair( &Structure::Allocate<SubsurfModifierData>, &Structure::Convert<SubsurfModifierData> );
663 converters["MFace"] = DNA::FactoryPair( &Structure::Allocate<MFace>, &Structure::Convert<MFace> );
664 converters["Lamp"] = DNA::FactoryPair( &Structure::Allocate<Lamp>, &Structure::Convert<Lamp> );
665 converters["MDeformWeight"] = DNA::FactoryPair( &Structure::Allocate<MDeformWeight>, &Structure::Convert<MDeformWeight> );
666 converters["PackedFile"] = DNA::FactoryPair( &Structure::Allocate<PackedFile>, &Structure::Convert<PackedFile> );
667 converters["Base"] = DNA::FactoryPair( &Structure::Allocate<Base>, &Structure::Convert<Base> );
668 converters["MTFace"] = DNA::FactoryPair( &Structure::Allocate<MTFace>, &Structure::Convert<MTFace> );
669 converters["Material"] = DNA::FactoryPair( &Structure::Allocate<Material>, &Structure::Convert<Material> );
670 converters["MTexPoly"] = DNA::FactoryPair( &Structure::Allocate<MTexPoly>, &Structure::Convert<MTexPoly> );
671 converters["Mesh"] = DNA::FactoryPair( &Structure::Allocate<Mesh>, &Structure::Convert<Mesh> );
672 converters["MDeformVert"] = DNA::FactoryPair( &Structure::Allocate<MDeformVert>, &Structure::Convert<MDeformVert> );
673 converters["World"] = DNA::FactoryPair( &Structure::Allocate<World>, &Structure::Convert<World> );
674 converters["MLoopCol"] = DNA::FactoryPair( &Structure::Allocate<MLoopCol>, &Structure::Convert<MLoopCol> );
675 converters["MVert"] = DNA::FactoryPair( &Structure::Allocate<MVert>, &Structure::Convert<MVert> );
676 converters["MEdge"] = DNA::FactoryPair( &Structure::Allocate<MEdge>, &Structure::Convert<MEdge> );
677 converters["MLoopUV"] = DNA::FactoryPair( &Structure::Allocate<MLoopUV>, &Structure::Convert<MLoopUV> );
678 converters["GroupObject"] = DNA::FactoryPair( &Structure::Allocate<GroupObject>, &Structure::Convert<GroupObject> );
679 converters["ListBase"] = DNA::FactoryPair( &Structure::Allocate<ListBase>, &Structure::Convert<ListBase> );
680 converters["MLoop"] = DNA::FactoryPair( &Structure::Allocate<MLoop>, &Structure::Convert<MLoop> );
681 converters["ModifierData"] = DNA::FactoryPair( &Structure::Allocate<ModifierData>, &Structure::Convert<ModifierData> );
682 converters["ID"] = DNA::FactoryPair( &Structure::Allocate<ID>, &Structure::Convert<ID> );
683 converters["MCol"] = DNA::FactoryPair( &Structure::Allocate<MCol>, &Structure::Convert<MCol> );
684 converters["MPoly"] = DNA::FactoryPair( &Structure::Allocate<MPoly>, &Structure::Convert<MPoly> );
685 converters["Scene"] = DNA::FactoryPair( &Structure::Allocate<Scene>, &Structure::Convert<Scene> );
686 converters["Library"] = DNA::FactoryPair( &Structure::Allocate<Library>, &Structure::Convert<Library> );
687 converters["Tex"] = DNA::FactoryPair( &Structure::Allocate<Tex>, &Structure::Convert<Tex> );
688 converters["Camera"] = DNA::FactoryPair( &Structure::Allocate<Camera>, &Structure::Convert<Camera> );
689 converters["MirrorModifierData"] = DNA::FactoryPair( &Structure::Allocate<MirrorModifierData>, &Structure::Convert<MirrorModifierData> );
690 converters["Image"] = DNA::FactoryPair( &Structure::Allocate<Image>, &Structure::Convert<Image> );
691 }
694 #endif