From 3cf20b605dc553d0d69bacb1f71f29e14ad85fc6 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Fri, 21 May 2010 22:39:31 +0000 Subject: [PATCH] blender loader now loads material assignments. blender loader no longer produces randomized output in some scenarious. nice side effect of less asthetic diversity: less segfaults. assimpview is no longer topmost. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@732 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/BlenderDNA.h | 55 +++- code/BlenderDNA.inl | 198 +++++++++------ code/BlenderLoader.cpp | 321 +++++++++++++++++++----- code/BlenderLoader.h | 9 +- code/BlenderScene.cpp | 177 ++++++------- code/BlenderScene.h | 18 +- scripts/BlenderImporter/genblenddna.py | 42 ++-- test/models/BLEND/4Cubes4Mats_248.blend | Bin 0 -> 136684 bytes tools/assimp_view/assimp_view.rc | 2 +- 9 files changed, 545 insertions(+), 277 deletions(-) create mode 100644 test/models/BLEND/4Cubes4Mats_248.blend diff --git a/code/BlenderDNA.h b/code/BlenderDNA.h index 174291230..8796fb288 100644 --- a/code/BlenderDNA.h +++ b/code/BlenderDNA.h @@ -111,6 +111,27 @@ struct Pointer uint64_t val; }; +// ------------------------------------------------------------------------------- +/** Dummy derivate of std::vector to be able to use it in templates simultaenously + * with boost::shared_ptr, which takes only one template argument + * while std::vector takes three. Also we need to provide some special member + * functions of shared_ptr */ +// ------------------------------------------------------------------------------- +template +class vector : public std::vector +{ +public: + using std::vector::resize; + using std::vector::empty; + + void reset() { + resize(0); + } + + operator bool () const { + return !empty(); + } +}; // ------------------------------------------------------------------------------- /** Mixed flags for use in #Field */ @@ -181,7 +202,7 @@ public: // publicly accessible members std::string name; - std::vector< Field > fields; + vector< Field > fields; std::map indices; size_t size; @@ -255,6 +276,11 @@ private: void ResolvePointer(TOUT& out, const Pointer & ptrval, const FileDatabase& db, const Field& f) const; + // -------------------------------------------------------- + template