From 058f98a63658dc1a2579826ba167fd61bed1e21f Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 4 Mar 2022 10:47:15 -0600 Subject: add assimp submodule --- .../code/AssetLib/Blender/BlenderScene.cpp | 891 +++++++++++++++++++++ 1 file changed, 891 insertions(+) create mode 100644 src/mesh/assimp-master/code/AssetLib/Blender/BlenderScene.cpp (limited to 'src/mesh/assimp-master/code/AssetLib/Blender/BlenderScene.cpp') diff --git a/src/mesh/assimp-master/code/AssetLib/Blender/BlenderScene.cpp b/src/mesh/assimp-master/code/AssetLib/Blender/BlenderScene.cpp new file mode 100644 index 0000000..9ad086f --- /dev/null +++ b/src/mesh/assimp-master/code/AssetLib/Blender/BlenderScene.cpp @@ -0,0 +1,891 @@ +/* +Open Asset Import Library (ASSIMP) +---------------------------------------------------------------------- + +Copyright (c) 2006-2020, ASSIMP Development Team +All rights reserved. + +Redistribution and use of this software in source and binary forms, +with or without modification, are permitted provided that the +following conditions are met: + +* Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + +* Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + +* Neither the name of the ASSIMP team, nor the names of its + contributors may be used to endorse or promote products + derived from this software without specific prior + written permission of the ASSIMP Development Team. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- +*/ + +/** @file BlenderScene.cpp + * @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py + */ + +#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER + +#include "BlenderScene.h" +#include "BlenderCustomData.h" +#include "BlenderDNA.h" +#include "BlenderSceneGen.h" + +namespace Assimp { +namespace Blender { + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Object &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + int temp = 0; + ReadField(temp, "type", db); + dest.type = static_cast(temp); + ReadFieldArray2(dest.obmat, "obmat", db); + ReadFieldArray2(dest.parentinv, "parentinv", db); + ReadFieldArray(dest.parsubstr, "parsubstr", db); + { + std::shared_ptr parent; + ReadFieldPtr(parent, "*parent", db); + dest.parent = parent.get(); + } + ReadFieldPtr(dest.track, "*track", db); + ReadFieldPtr(dest.proxy, "*proxy", db); + ReadFieldPtr(dest.proxy_from, "*proxy_from", db); + ReadFieldPtr(dest.proxy_group, "*proxy_group", db); + ReadFieldPtr(dest.dup_group, "*dup_group", db); + ReadFieldPtr(dest.data, "*data", db); + ReadField(dest.modifiers, "modifiers", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Group &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + ReadField(dest.layer, "layer", db); + ReadFieldPtr(dest.gobject, "*gobject", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure::Convert( + CollectionObject &dest, + const FileDatabase &db) const { + + ReadFieldPtr(dest.next, "*next", db); + { + //std::shared_ptr prev; + //ReadFieldPtr(prev, "*prev", db); + //dest.prev = prev.get(); + + std::shared_ptr ob; + ReadFieldPtr(ob, "*ob", db); + dest.ob = ob.get(); + } + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure::Convert( + CollectionChild &dest, + const FileDatabase &db) const { + + ReadFieldPtr(dest.prev, "*prev", db); + ReadFieldPtr(dest.next, "*next", db); + ReadFieldPtr(dest.collection, "*collection", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure::Convert( + Collection &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + ReadField(dest.gobject, "gobject", db); + ReadField(dest.children, "children", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MTex &dest, + const FileDatabase &db) const { + + int temp_short = 0; + ReadField(temp_short, "mapto", db); + dest.mapto = static_cast(temp_short); + int temp = 0; + ReadField(temp, "blendtype", db); + dest.blendtype = static_cast(temp); + ReadFieldPtr(dest.object, "*object", db); + ReadFieldPtr(dest.tex, "*tex", db); + ReadFieldArray(dest.uvname, "uvname", db); + ReadField(temp, "projx", db); + dest.projx = static_cast(temp); + ReadField(temp, "projy", db); + dest.projy = static_cast(temp); + ReadField(temp, "projz", db); + dest.projz = static_cast(temp); + ReadField(dest.mapping, "mapping", db); + ReadFieldArray(dest.ofs, "ofs", db); + ReadFieldArray(dest.size, "size", db); + ReadField(dest.rot, "rot", db); + ReadField(dest.texflag, "texflag", db); + ReadField(dest.colormodel, "colormodel", db); + ReadField(dest.pmapto, "pmapto", db); + ReadField(dest.pmaptoneg, "pmaptoneg", db); + ReadField(dest.r, "r", db); + ReadField(dest.g, "g", db); + ReadField(dest.b, "b", db); + ReadField(dest.k, "k", db); + ReadField(dest.colspecfac, "colspecfac", db); + ReadField(dest.mirrfac, "mirrfac", db); + ReadField(dest.alphafac, "alphafac", db); + ReadField(dest.difffac, "difffac", db); + ReadField(dest.specfac, "specfac", db); + ReadField(dest.emitfac, "emitfac", db); + ReadField(dest.hardfac, "hardfac", db); + ReadField(dest.norfac, "norfac", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + TFace &dest, + const FileDatabase &db) const { + + ReadFieldArray2(dest.uv, "uv", db); + ReadFieldArray(dest.col, "col", db); + ReadField(dest.flag, "flag", db); + ReadField(dest.mode, "mode", db); + ReadField(dest.tile, "tile", db); + ReadField(dest.unwrap, "unwrap", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + SubsurfModifierData &dest, + const FileDatabase &db) const { + + ReadField(dest.modifier, "modifier", db); + ReadField(dest.subdivType, "subdivType", db); + ReadField(dest.levels, "levels", db); + ReadField(dest.renderLevels, "renderLevels", db); + ReadField(dest.flags, "flags", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MFace &dest, + const FileDatabase &db) const { + + ReadField(dest.v1, "v1", db); + ReadField(dest.v2, "v2", db); + ReadField(dest.v3, "v3", db); + ReadField(dest.v4, "v4", db); + ReadField(dest.mat_nr, "mat_nr", db); + ReadField(dest.flag, "flag", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Lamp &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + int temp = 0; + ReadField(temp, "type", db); + dest.type = static_cast(temp); + ReadField(dest.flags, "flag", db); + ReadField(dest.colormodel, "colormodel", db); + ReadField(dest.totex, "totex", db); + ReadField(dest.r, "r", db); + ReadField(dest.g, "g", db); + ReadField(dest.b, "b", db); + ReadField(dest.k, "k", db); + ReadField(dest.energy, "energy", db); + ReadField(dest.dist, "dist", db); + ReadField(dest.spotsize, "spotsize", db); + ReadField(dest.spotblend, "spotblend", db); + ReadField(dest.constant_coefficient, "coeff_const", db); + ReadField(dest.linear_coefficient, "coeff_lin", db); + ReadField(dest.quadratic_coefficient, "coeff_quad", db); + ReadField(dest.att1, "att1", db); + ReadField(dest.att2, "att2", db); + ReadField(temp, "falloff_type", db); + dest.falloff_type = static_cast(temp); + ReadField(dest.sun_brightness, "sun_brightness", db); + ReadField(dest.area_size, "area_size", db); + ReadField(dest.area_sizey, "area_sizey", db); + ReadField(dest.area_sizez, "area_sizez", db); + ReadField(dest.area_shape, "area_shape", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MDeformWeight &dest, + const FileDatabase &db) const { + + ReadField(dest.def_nr, "def_nr", db); + ReadField(dest.weight, "weight", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + PackedFile &dest, + const FileDatabase &db) const { + + ReadField(dest.size, "size", db); + ReadField(dest.seek, "seek", db); + ReadFieldPtr(dest.data, "*data", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Base &dest, + const FileDatabase &db) const { + // note: as per https://github.com/assimp/assimp/issues/128, + // reading the Object linked list recursively is prone to stack overflow. + // This structure converter is therefore an hand-written exception that + // does it iteratively. + + const int initial_pos = db.reader->GetCurrentPos(); + + std::pair todo = std::make_pair(&dest, initial_pos); + for (;;) { + + Base &cur_dest = *todo.first; + db.reader->SetCurrentPos(todo.second); + + // we know that this is a double-linked, circular list which we never + // traverse backwards, so don't bother resolving the back links. + cur_dest.prev = nullptr; + + ReadFieldPtr(cur_dest.object, "*object", db); + + // the return value of ReadFieldPtr indicates whether the object + // was already cached. In this case, we don't need to resolve + // it again. + if (!ReadFieldPtr(cur_dest.next, "*next", db, true) && cur_dest.next) { + todo = std::make_pair(&*cur_dest.next, db.reader->GetCurrentPos()); + continue; + } + break; + } + + db.reader->SetCurrentPos(initial_pos + size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MTFace &dest, + const FileDatabase &db) const { + + ReadFieldArray2(dest.uv, "uv", db); + ReadField(dest.flag, "flag", db); + ReadField(dest.mode, "mode", db); + ReadField(dest.tile, "tile", db); + ReadField(dest.unwrap, "unwrap", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Material &dest, + const FileDatabase &db) const { + ReadField(dest.id, "id", db); + ReadField(dest.r, "r", db); + ReadField(dest.g, "g", db); + ReadField(dest.b, "b", db); + ReadField(dest.specr, "specr", db); + ReadField(dest.specg, "specg", db); + ReadField(dest.specb, "specb", db); + ReadField(dest.har, "har", db); + ReadField(dest.ambr, "ambr", db); + ReadField(dest.ambg, "ambg", db); + ReadField(dest.ambb, "ambb", db); + ReadField(dest.mirr, "mirr", db); + ReadField(dest.mirg, "mirg", db); + ReadField(dest.mirb, "mirb", db); + ReadField(dest.emit, "emit", db); + ReadField(dest.ray_mirror, "ray_mirror", db); + ReadField(dest.alpha, "alpha", db); + ReadField(dest.ref, "ref", db); + ReadField(dest.translucency, "translucency", db); + ReadField(dest.mode, "mode", db); + ReadField(dest.roughness, "roughness", db); + ReadField(dest.darkness, "darkness", db); + ReadField(dest.refrac, "refrac", db); + ReadFieldPtr(dest.group, "*group", db); + ReadField(dest.diff_shader, "diff_shader", db); + ReadField(dest.spec_shader, "spec_shader", db); + ReadFieldPtr(dest.mtex, "*mtex", db); + + ReadField(dest.amb, "amb", db); + ReadField(dest.ang, "ang", db); + ReadField(dest.spectra, "spectra", db); + ReadField(dest.spec, "spec", db); + ReadField(dest.zoffs, "zoffs", db); + ReadField(dest.add, "add", db); + ReadField(dest.fresnel_mir, "fresnel_mir", db); + ReadField(dest.fresnel_mir_i, "fresnel_mir_i", db); + ReadField(dest.fresnel_tra, "fresnel_tra", db); + ReadField(dest.fresnel_tra_i, "fresnel_tra_i", db); + ReadField(dest.filter, "filter", db); + ReadField(dest.tx_limit, "tx_limit", db); + ReadField(dest.tx_falloff, "tx_falloff", db); + ReadField(dest.gloss_mir, "gloss_mir", db); + ReadField(dest.gloss_tra, "gloss_tra", db); + ReadField(dest.adapt_thresh_mir, "adapt_thresh_mir", db); + ReadField(dest.adapt_thresh_tra, "adapt_thresh_tra", db); + ReadField(dest.aniso_gloss_mir, "aniso_gloss_mir", db); + ReadField(dest.dist_mir, "dist_mir", db); + ReadField(dest.hasize, "hasize", db); + ReadField(dest.flaresize, "flaresize", db); + ReadField(dest.subsize, "subsize", db); + ReadField(dest.flareboost, "flareboost", db); + ReadField(dest.strand_sta, "strand_sta", db); + ReadField(dest.strand_end, "strand_end", db); + ReadField(dest.strand_ease, "strand_ease", db); + ReadField(dest.strand_surfnor, "strand_surfnor", db); + ReadField(dest.strand_min, "strand_min", db); + ReadField(dest.strand_widthfade, "strand_widthfade", db); + ReadField(dest.sbias, "sbias", db); + ReadField(dest.lbias, "lbias", db); + ReadField(dest.shad_alpha, "shad_alpha", db); + ReadField(dest.param, "param", db); + ReadField(dest.rms, "rms", db); + ReadField(dest.rampfac_col, "rampfac_col", db); + ReadField(dest.rampfac_spec, "rampfac_spec", db); + ReadField(dest.friction, "friction", db); + ReadField(dest.fh, "fh", db); + ReadField(dest.reflect, "reflect", db); + ReadField(dest.fhdist, "fhdist", db); + ReadField(dest.xyfrict, "xyfrict", db); + ReadField(dest.sss_radius, "sss_radius", db); + ReadField(dest.sss_col, "sss_col", db); + ReadField(dest.sss_error, "sss_error", db); + ReadField(dest.sss_scale, "sss_scale", db); + ReadField(dest.sss_ior, "sss_ior", db); + ReadField(dest.sss_colfac, "sss_colfac", db); + ReadField(dest.sss_texfac, "sss_texfac", db); + ReadField(dest.sss_front, "sss_front", db); + ReadField(dest.sss_back, "sss_back", db); + + ReadField(dest.material_type, "material_type", db); + ReadField(dest.flag, "flag", db); + ReadField(dest.ray_depth, "ray_depth", db); + ReadField(dest.ray_depth_tra, "ray_depth_tra", db); + ReadField(dest.samp_gloss_mir, "samp_gloss_mir", db); + ReadField(dest.samp_gloss_tra, "samp_gloss_tra", db); + ReadField(dest.fadeto_mir, "fadeto_mir", db); + ReadField(dest.shade_flag, "shade_flag", db); + ReadField(dest.flarec, "flarec", db); + ReadField(dest.starc, "starc", db); + ReadField(dest.linec, "linec", db); + ReadField(dest.ringc, "ringc", db); + ReadField(dest.pr_lamp, "pr_lamp", db); + ReadField(dest.pr_texture, "pr_texture", db); + ReadField(dest.ml_flag, "ml_flag", db); + ReadField(dest.diff_shader, "diff_shader", db); + ReadField(dest.spec_shader, "spec_shader", db); + ReadField(dest.texco, "texco", db); + ReadField(dest.mapto, "mapto", db); + ReadField(dest.ramp_show, "ramp_show", db); + ReadField(dest.pad3, "pad3", db); + ReadField(dest.dynamode, "dynamode", db); + ReadField(dest.pad2, "pad2", db); + ReadField(dest.sss_flag, "sss_flag", db); + ReadField(dest.sss_preset, "sss_preset", db); + ReadField(dest.shadowonly_flag, "shadowonly_flag", db); + ReadField(dest.index, "index", db); + ReadField(dest.vcol_alpha, "vcol_alpha", db); + ReadField(dest.pad4, "pad4", db); + + ReadField(dest.seed1, "seed1", db); + ReadField(dest.seed2, "seed2", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MTexPoly &dest, + const FileDatabase &db) const { + + { + std::shared_ptr tpage; + ReadFieldPtr(tpage, "*tpage", db); + dest.tpage = tpage.get(); + } + ReadField(dest.flag, "flag", db); + ReadField(dest.transp, "transp", db); + ReadField(dest.mode, "mode", db); + ReadField(dest.tile, "tile", db); + ReadField(dest.pad, "pad", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Mesh &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + ReadField(dest.totface, "totface", db); + ReadField(dest.totedge, "totedge", db); + ReadField(dest.totvert, "totvert", db); + ReadField(dest.totloop, "totloop", db); + ReadField(dest.totpoly, "totpoly", db); + ReadField(dest.subdiv, "subdiv", db); + ReadField(dest.subdivr, "subdivr", db); + ReadField(dest.subsurftype, "subsurftype", db); + ReadField(dest.smoothresh, "smoothresh", db); + ReadFieldPtr(dest.mface, "*mface", db); + ReadFieldPtr(dest.mtface, "*mtface", db); + ReadFieldPtr(dest.tface, "*tface", db); + ReadFieldPtr(dest.mvert, "*mvert", db); + ReadFieldPtr(dest.medge, "*medge", db); + ReadFieldPtr(dest.mloop, "*mloop", db); + ReadFieldPtr(dest.mloopuv, "*mloopuv", db); + ReadFieldPtr(dest.mloopcol, "*mloopcol", db); + ReadFieldPtr(dest.mpoly, "*mpoly", db); + ReadFieldPtr(dest.mtpoly, "*mtpoly", db); + ReadFieldPtr(dest.dvert, "*dvert", db); + ReadFieldPtr(dest.mcol, "*mcol", db); + ReadFieldPtr(dest.mat, "**mat", db); + + ReadField(dest.vdata, "vdata", db); + ReadField(dest.edata, "edata", db); + ReadField(dest.fdata, "fdata", db); + ReadField(dest.pdata, "pdata", db); + ReadField(dest.ldata, "ldata", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MDeformVert &dest, + const FileDatabase &db) const { + + ReadFieldPtr(dest.dw, "*dw", db); + ReadField(dest.totweight, "totweight", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + World &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MLoopCol &dest, + const FileDatabase &db) const { + + ReadField(dest.r, "r", db); + ReadField(dest.g, "g", db); + ReadField(dest.b, "b", db); + ReadField(dest.a, "a", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MVert &dest, + const FileDatabase &db) const { + + ReadFieldArray(dest.co, "co", db); + ReadFieldArray(dest.no, "no", db); + ReadField(dest.flag, "flag", db); + //ReadField(dest.mat_nr,"mat_nr",db); + ReadField(dest.bweight, "bweight", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MEdge &dest, + const FileDatabase &db) const { + + ReadField(dest.v1, "v1", db); + ReadField(dest.v2, "v2", db); + ReadField(dest.crease, "crease", db); + ReadField(dest.bweight, "bweight", db); + ReadField(dest.flag, "flag", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MLoopUV &dest, + const FileDatabase &db) const { + + ReadFieldArray(dest.uv, "uv", db); + ReadField(dest.flag, "flag", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + GroupObject &dest, + const FileDatabase &db) const { + + ReadFieldPtr(dest.prev, "*prev", db); + ReadFieldPtr(dest.next, "*next", db); + ReadFieldPtr(dest.ob, "*ob", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + ListBase &dest, + const FileDatabase &db) const { + + ReadFieldPtr(dest.first, "*first", db); + ReadFieldPtr(dest.last, "*last", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MLoop &dest, + const FileDatabase &db) const { + + ReadField(dest.v, "v", db); + ReadField(dest.e, "e", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + ModifierData &dest, + const FileDatabase &db) const { + + ReadFieldPtr(dest.next, "*next", db); + ReadFieldPtr(dest.prev, "*prev", db); + ReadField(dest.type, "type", db); + ReadField(dest.mode, "mode", db); + ReadFieldArray(dest.name, "name", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + ID &dest, + const FileDatabase &db) const { + + ReadFieldArray(dest.name, "name", db); + ReadField(dest.flag, "flag", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MCol &dest, + const FileDatabase &db) const { + + ReadField(dest.r, "r", db); + ReadField(dest.g, "g", db); + ReadField(dest.b, "b", db); + ReadField(dest.a, "a", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MPoly &dest, + const FileDatabase &db) const { + + ReadField(dest.loopstart, "loopstart", db); + ReadField(dest.totloop, "totloop", db); + ReadField(dest.mat_nr, "mat_nr", db); + ReadField(dest.flag, "flag", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Scene &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + ReadFieldPtr(dest.camera, "*camera", db); + ReadFieldPtr(dest.world, "*world", db); + ReadFieldPtr(dest.basact, "*basact", db); + ReadFieldPtr(dest.master_collection, "*master_collection", db); + ReadField(dest.base, "base", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Library &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + ReadFieldArray(dest.name, "name", db); + ReadFieldArray(dest.filename, "filename", db); + ReadFieldPtr(dest.parent, "*parent", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Tex &dest, + const FileDatabase &db) const { + short temp_short = 0; + ReadField(temp_short, "imaflag", db); + dest.imaflag = static_cast(temp_short); + int temp = 0; + ReadField(temp, "type", db); + dest.type = static_cast(temp); + ReadFieldPtr(dest.ima, "*ima", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Camera &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + int temp = 0; + ReadField(temp, "type", db); + dest.type = static_cast(temp); + ReadField(temp, "flag", db); + dest.flag = static_cast(temp); + ReadField(dest.lens, "lens", db); + ReadField(dest.sensor_x, "sensor_x", db); + ReadField(dest.clipsta, "clipsta", db); + ReadField(dest.clipend, "clipend", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + MirrorModifierData &dest, + const FileDatabase &db) const { + + ReadField(dest.modifier, "modifier", db); + ReadField(dest.axis, "axis", db); + ReadField(dest.flag, "flag", db); + ReadField(dest.tolerance, "tolerance", db); + ReadFieldPtr(dest.mirror_ob, "*mirror_ob", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure ::Convert( + Image &dest, + const FileDatabase &db) const { + + ReadField(dest.id, "id", db); + ReadFieldArray(dest.name, "name", db); + ReadField(dest.ok, "ok", db); + ReadField(dest.flag, "flag", db); + ReadField(dest.source, "source", db); + ReadField(dest.type, "type", db); + ReadField(dest.pad, "pad", db); + ReadField(dest.pad1, "pad1", db); + ReadField(dest.lastframe, "lastframe", db); + ReadField(dest.tpageflag, "tpageflag", db); + ReadField(dest.totbind, "totbind", db); + ReadField(dest.xrep, "xrep", db); + ReadField(dest.yrep, "yrep", db); + ReadField(dest.twsta, "twsta", db); + ReadField(dest.twend, "twend", db); + ReadFieldPtr(dest.packedfile, "*packedfile", db); + ReadField(dest.lastupdate, "lastupdate", db); + ReadField(dest.lastused, "lastused", db); + ReadField(dest.animspeed, "animspeed", db); + ReadField(dest.gen_x, "gen_x", db); + ReadField(dest.gen_y, "gen_y", db); + ReadField(dest.gen_type, "gen_type", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure::Convert( + CustomData &dest, + const FileDatabase &db) const { + ReadFieldArray(dest.typemap, "typemap", db); + ReadField(dest.totlayer, "totlayer", db); + ReadField(dest.maxlayer, "maxlayer", db); + ReadField(dest.totsize, "totsize", db); + ReadFieldPtrVector(dest.layers, "*layers", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +template <> +void Structure::Convert( + CustomDataLayer &dest, + const FileDatabase &db) const { + ReadField(dest.type, "type", db); + ReadField(dest.offset, "offset", db); + ReadField(dest.flag, "flag", db); + ReadField(dest.active, "active", db); + ReadField(dest.active_rnd, "active_rnd", db); + ReadField(dest.active_clone, "active_clone", db); + ReadField(dest.active_mask, "active_mask", db); + ReadField(dest.uid, "uid", db); + ReadFieldArray(dest.name, "name", db); + ReadCustomDataPtr(dest.data, dest.type, "*data", db); + + db.reader->IncPtr(size); +} + +//-------------------------------------------------------------------------------- +void DNA::RegisterConverters() { + + converters["Object"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Group"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MTex"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["TFace"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["SubsurfModifierData"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MFace"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Lamp"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MDeformWeight"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["PackedFile"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Base"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MTFace"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Material"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MTexPoly"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Mesh"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MDeformVert"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["World"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MLoopCol"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MVert"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MEdge"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MLoopUV"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["GroupObject"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["ListBase"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MLoop"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["ModifierData"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["ID"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MCol"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MPoly"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Scene"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Library"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Tex"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Camera"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["MirrorModifierData"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Image"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["CustomData"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["CustomDataLayer"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["Collection"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["CollectionChild"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); + converters["CollectionObject"] = DNA::FactoryPair(&Structure::Allocate, &Structure::Convert); +} + +} // namespace Blender +} //namespace Assimp + +#endif // ASSIMP_BUILD_NO_BLEND_IMPORTER -- cgit v1.2.1