/src/assimp/code/AssetLib/Blender/BlenderDNA.h
Line | Count | Source |
1 | | /* |
2 | | Open Asset Import Library (assimp) |
3 | | ---------------------------------------------------------------------- |
4 | | |
5 | | Copyright (c) 2006-2026, assimp team |
6 | | |
7 | | All rights reserved. |
8 | | |
9 | | Redistribution and use of this software in source and binary forms, |
10 | | with or without modification, are permitted provided that the |
11 | | following conditions are met: |
12 | | |
13 | | * Redistributions of source code must retain the above |
14 | | copyright notice, this list of conditions and the |
15 | | following disclaimer. |
16 | | |
17 | | * Redistributions in binary form must reproduce the above |
18 | | copyright notice, this list of conditions and the |
19 | | following disclaimer in the documentation and/or other |
20 | | materials provided with the distribution. |
21 | | |
22 | | * Neither the name of the assimp team, nor the names of its |
23 | | contributors may be used to endorse or promote products |
24 | | derived from this software without specific prior |
25 | | written permission of the assimp team. |
26 | | |
27 | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
28 | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
29 | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
30 | | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
31 | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
32 | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
33 | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
34 | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
35 | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
36 | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
37 | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
38 | | |
39 | | ---------------------------------------------------------------------- |
40 | | */ |
41 | | |
42 | | /** @file BlenderDNA.h |
43 | | * @brief Blender `DNA` (file format specification embedded in |
44 | | * blend file itself) loader. |
45 | | */ |
46 | | #ifndef INCLUDED_AI_BLEND_DNA_H |
47 | | #define INCLUDED_AI_BLEND_DNA_H |
48 | | |
49 | | #include <assimp/BaseImporter.h> |
50 | | #include <assimp/StreamReader.h> |
51 | | #include <stdint.h> |
52 | | #include <assimp/DefaultLogger.hpp> |
53 | | #include <map> |
54 | | #include <memory> |
55 | | |
56 | | // enable verbose log output. really verbose, so be careful. |
57 | | #ifdef ASSIMP_BUILD_DEBUG |
58 | | # define ASSIMP_BUILD_BLENDER_DEBUG |
59 | | #endif |
60 | | |
61 | | // set this to non-zero to dump BlenderDNA stuff to dna.txt. |
62 | | // you could set it on the assimp build command line too without touching it here. |
63 | | // !!! please make sure this is set to 0 in the repo !!! |
64 | | #ifndef ASSIMP_BUILD_BLENDER_DEBUG_DNA |
65 | | # define ASSIMP_BUILD_BLENDER_DEBUG_DNA 0 |
66 | | #endif |
67 | | |
68 | | // #define ASSIMP_BUILD_BLENDER_NO_STATS |
69 | | |
70 | | namespace Assimp { |
71 | | |
72 | | template <bool, bool> |
73 | | class StreamReader; |
74 | | typedef StreamReader<true, true> StreamReaderAny; |
75 | | |
76 | | namespace Blender { |
77 | | |
78 | | class FileDatabase; |
79 | | struct FileBlockHead; |
80 | | |
81 | | template <template <typename> class TOUT> |
82 | | class ObjectCache; |
83 | | |
84 | | // ------------------------------------------------------------------------------- |
85 | | /** Exception class used by the blender loader to selectively catch exceptions |
86 | | * thrown in its own code (DeadlyImportErrors thrown in general utility |
87 | | * functions are untouched then). If such an exception is not caught by |
88 | | * the loader itself, it will still be caught by Assimp due to its |
89 | | * ancestry. */ |
90 | | // ------------------------------------------------------------------------------- |
91 | | struct Error : DeadlyImportError { |
92 | | template <typename... T> |
93 | | explicit Error(T &&...args) : |
94 | 0 | DeadlyImportError(args...) { |
95 | 0 | } Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [39], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [2]>(char const (&) [39], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [2]) Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [43], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [2]>(char const (&) [43], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [2]) Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [8], char const*&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [32], unsigned long, char const (&) [2], unsigned long>(char const (&) [8], char const*&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [32], unsigned long&&, char const (&) [2], unsigned long&&) Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [8], char const*&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [32], unsigned long>(char const (&) [8], char const*&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [32], unsigned long&&) Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [8], char const*&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [24]>(char const (&) [8], char const*&, char const (&) [17], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [24]) Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [45], unsigned long const&, char const (&) [2]>(char const (&) [45], unsigned long const&, char const (&) [2]) Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [32], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [26], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [10]>(char const (&) [32], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [26], std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const (&) [10]) Unexecuted instantiation: Assimp::Blender::Error::Error<char const (&) [17], int const&, char const (&) [14]>(char const (&) [17], int const&, char const (&) [14]) |
96 | | }; |
97 | | |
98 | | // ------------------------------------------------------------------------------- |
99 | | /** The only purpose of this structure is to feed a virtual dtor into its |
100 | | * descendents. It serves as base class for all data structure fields. */ |
101 | | // ------------------------------------------------------------------------------- |
102 | | struct ElemBase { |
103 | | ElemBase() : |
104 | 0 | dna_type(nullptr) { |
105 | | // empty |
106 | 0 | } |
107 | | |
108 | 0 | virtual ~ElemBase() = default; |
109 | | |
110 | | /** Type name of the element. The type |
111 | | * string points is the `c_str` of the `name` attribute of the |
112 | | * corresponding `Structure`, that is, it is only valid as long |
113 | | * as the DNA is not modified. The dna_type is only set if the |
114 | | * data type is not static, i.e. a std::shared_ptr<ElemBase> |
115 | | * in the scene description would have its type resolved |
116 | | * at runtime, so this member is always set. */ |
117 | | const char *dna_type; |
118 | | }; |
119 | | |
120 | | // ------------------------------------------------------------------------------- |
121 | | /** Represents a generic pointer to a memory location, which can be either 32 |
122 | | * or 64 bits. These pointers are loaded from the BLEND file and finally |
123 | | * fixed to point to the real, converted representation of the objects |
124 | | * they used to point to.*/ |
125 | | // ------------------------------------------------------------------------------- |
126 | | struct Pointer { |
127 | | uint64_t val{0}; |
128 | | }; |
129 | | |
130 | | // ------------------------------------------------------------------------------- |
131 | | /** Represents a generic offset within a BLEND file */ |
132 | | // ------------------------------------------------------------------------------- |
133 | | struct FileOffset { |
134 | | uint64_t val{0}; |
135 | | }; |
136 | | |
137 | | // ------------------------------------------------------------------------------- |
138 | | /** Dummy derivate of std::vector to be able to use it in templates simultaenously |
139 | | * with std::shared_ptr, which takes only one template argument |
140 | | * while std::vector takes three. Also we need to provide some special member |
141 | | * functions of shared_ptr */ |
142 | | // ------------------------------------------------------------------------------- |
143 | | template <typename T> |
144 | | class vector : public std::vector<T> { |
145 | | public: |
146 | | using std::vector<T>::resize; |
147 | | using std::vector<T>::empty; |
148 | | |
149 | 0 | void reset() { |
150 | 0 | resize(0); |
151 | 0 | } Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MFace>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MTFace>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::TFace>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MVert>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MEdge>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MLoop>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MLoopUV>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MLoopCol>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MPoly>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MTexPoly>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MDeformVert>::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MCol>::reset() Unexecuted instantiation: Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::Material> >::reset() Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MDeformWeight>::reset() |
152 | | |
153 | 0 | operator bool() const { |
154 | 0 | return !empty(); |
155 | 0 | } Unexecuted instantiation: Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::Material> >::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MTFace>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MLoopUV>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::TFace>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MCol>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MLoopCol>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MFace>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MVert>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MEdge>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MLoop>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MPoly>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MTexPoly>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MDeformVert>::operator bool() const Unexecuted instantiation: Assimp::Blender::vector<Assimp::Blender::MDeformWeight>::operator bool() const |
156 | | }; |
157 | | |
158 | | // ------------------------------------------------------------------------------- |
159 | | /** Mixed flags for use in #Field */ |
160 | | // ------------------------------------------------------------------------------- |
161 | | enum FieldFlags { |
162 | | FieldFlag_Pointer = 0x1, |
163 | | FieldFlag_Array = 0x2 |
164 | | }; |
165 | | |
166 | | // ------------------------------------------------------------------------------- |
167 | | /** Represents a single member of a data structure in a BLEND file */ |
168 | | // ------------------------------------------------------------------------------- |
169 | | struct Field { |
170 | | std::string name; |
171 | | std::string type; |
172 | | |
173 | | size_t size; |
174 | | size_t offset; |
175 | | |
176 | | /** Size of each array dimension. For flat arrays, |
177 | | * the second dimension is set to 1. */ |
178 | | size_t array_sizes[2]; |
179 | | |
180 | | /** Any of the #FieldFlags enumerated values */ |
181 | | unsigned int flags; |
182 | | }; |
183 | | |
184 | | // ------------------------------------------------------------------------------- |
185 | | /** Range of possible behaviors for fields absence in the input file. Some are |
186 | | * mission critical so we need them, while others can silently be default |
187 | | * initialized and no animations are harmed. */ |
188 | | // ------------------------------------------------------------------------------- |
189 | | enum ErrorPolicy { |
190 | | /** Substitute default value and ignore */ |
191 | | ErrorPolicy_Igno, |
192 | | /** Substitute default value and write to log */ |
193 | | ErrorPolicy_Warn, |
194 | | /** Substitute a massive error message and crash the whole matrix. Its time for another zion */ |
195 | | ErrorPolicy_Fail |
196 | | }; |
197 | | |
198 | | #ifdef ASSIMP_BUILD_BLENDER_DEBUG |
199 | | # define ErrorPolicy_Igno ErrorPolicy_Warn |
200 | | #endif |
201 | | |
202 | | // ------------------------------------------------------------------------------- |
203 | | /** Represents a data structure in a BLEND file. A Structure defines n fields |
204 | | * and their locations and encodings the input stream. Usually, every |
205 | | * Structure instance pertains to one equally-named data structure in the |
206 | | * BlenderScene.h header. This class defines various utilities to map a |
207 | | * binary `blob` read from the file to such a structure instance with |
208 | | * meaningful contents. */ |
209 | | // ------------------------------------------------------------------------------- |
210 | | class Structure { |
211 | | template <template <typename> class> |
212 | | friend class ObjectCache; |
213 | | |
214 | | public: |
215 | | Structure() : |
216 | 0 | cache_idx(static_cast<size_t>(-1)) { |
217 | | // empty |
218 | 0 | } |
219 | | |
220 | | // publicly accessible members |
221 | | std::string name; |
222 | | vector<Field> fields; |
223 | | std::map<std::string, size_t> indices; |
224 | | |
225 | | size_t size; |
226 | | |
227 | | // -------------------------------------------------------- |
228 | | /** Access a field of the structure by its canonical name. The pointer version |
229 | | * returns nullptr on failure while the reference version raises an import error. */ |
230 | | inline const Field &operator[](const std::string &ss) const; |
231 | | inline const Field *Get(const std::string &ss) const; |
232 | | |
233 | | // -------------------------------------------------------- |
234 | | /** Access a field of the structure by its index */ |
235 | | inline const Field &operator[](const size_t i) const; |
236 | | |
237 | | // -------------------------------------------------------- |
238 | 0 | inline bool operator==(const Structure &other) const { |
239 | 0 | return name == other.name; // name is meant to be an unique identifier |
240 | 0 | } |
241 | | |
242 | | // -------------------------------------------------------- |
243 | 0 | inline bool operator!=(const Structure &other) const { |
244 | 0 | return name != other.name; |
245 | 0 | } |
246 | | |
247 | | // -------------------------------------------------------- |
248 | | /** Try to read an instance of the structure from the stream |
249 | | * and attempt to convert to `T`. This is done by |
250 | | * an appropriate specialization. If none is available, |
251 | | * a compiler complain is the result. |
252 | | * @param dest Destination value to be written |
253 | | * @param db File database, including input stream. */ |
254 | | template <typename T> |
255 | | void Convert(T &dest, const FileDatabase &db) const; |
256 | | |
257 | | // -------------------------------------------------------- |
258 | | // generic converter |
259 | | template <typename T> |
260 | | void Convert(std::shared_ptr<ElemBase> in, const FileDatabase &db) const; |
261 | | |
262 | | // -------------------------------------------------------- |
263 | | // generic allocator |
264 | | template <typename T> |
265 | | std::shared_ptr<ElemBase> Allocate() const; |
266 | | |
267 | | // -------------------------------------------------------- |
268 | | // field parsing for 1d arrays |
269 | | template <int error_policy, typename T, size_t M> |
270 | | void ReadFieldArray(T (&out)[M], const char *name, |
271 | | const FileDatabase &db) const; |
272 | | |
273 | | // -------------------------------------------------------- |
274 | | // field parsing for 2d arrays |
275 | | template <int error_policy, typename T, size_t M, size_t N> |
276 | | void ReadFieldArray2(T (&out)[M][N], const char *name, |
277 | | const FileDatabase &db) const; |
278 | | |
279 | | // -------------------------------------------------------- |
280 | | // field parsing for pointer or dynamic array types |
281 | | // (std::shared_ptr) |
282 | | // The return value indicates whether the data was already cached. |
283 | | template <int error_policy, template <typename> class TOUT, typename T> |
284 | | bool ReadFieldPtr(TOUT<T> &out, const char *name, |
285 | | const FileDatabase &db, |
286 | | bool non_recursive = false) const; |
287 | | |
288 | | // -------------------------------------------------------- |
289 | | // field parsing for static arrays of pointer or dynamic |
290 | | // array types (std::shared_ptr[]) |
291 | | // The return value indicates whether the data was already cached. |
292 | | template <int error_policy, template <typename> class TOUT, typename T, size_t N> |
293 | | bool ReadFieldPtr(TOUT<T> (&out)[N], const char *name, |
294 | | const FileDatabase &db) const; |
295 | | |
296 | | // -------------------------------------------------------- |
297 | | // field parsing for `normal` values |
298 | | // The return value indicates whether the data was already cached. |
299 | | template <int error_policy, typename T> |
300 | | void ReadField(T &out, const char *name, |
301 | | const FileDatabase &db) const; |
302 | | |
303 | | // -------------------------------------------------------- |
304 | | /** |
305 | | * @brief field parsing for dynamic vectors |
306 | | * @param[in] out vector of struct to be filled |
307 | | * @param[in] name of field |
308 | | * @param[in] db to access the file, dna, ... |
309 | | * @return true when read was successful |
310 | | */ |
311 | | template <int error_policy, template <typename> class TOUT, typename T> |
312 | | bool ReadFieldPtrVector(vector<TOUT<T>> &out, const char *name, const FileDatabase &db) const; |
313 | | |
314 | | /** |
315 | | * @brief parses raw customdata |
316 | | * @param[in] out shared_ptr to be filled |
317 | | * @param[in] cdtype customdata type to read |
318 | | * @param[in] name of field ptr |
319 | | * @param[in] db to access the file, dna, ... |
320 | | * @return true when read was successful |
321 | | */ |
322 | | template <int error_policy> |
323 | | bool ReadCustomDataPtr(std::shared_ptr<ElemBase> &out, int cdtype, const char *name, const FileDatabase &db) const; |
324 | | |
325 | | private: |
326 | | // -------------------------------------------------------- |
327 | | template <template <typename> class TOUT, typename T> |
328 | | bool ResolvePointer(TOUT<T> &out, const Pointer &ptrval, |
329 | | const FileDatabase &db, const Field &f, |
330 | | bool non_recursive = false) const; |
331 | | |
332 | | // -------------------------------------------------------- |
333 | | template <template <typename> class TOUT, typename T> |
334 | | bool ResolvePointer(vector<TOUT<T>> &out, const Pointer &ptrval, |
335 | | const FileDatabase &db, const Field &f, bool) const; |
336 | | |
337 | | // -------------------------------------------------------- |
338 | | bool ResolvePointer(std::shared_ptr<FileOffset> &out, const Pointer &ptrval, |
339 | | const FileDatabase &db, const Field &f, bool) const; |
340 | | |
341 | | // -------------------------------------------------------- |
342 | | inline const FileBlockHead *LocateFileBlockForAddress( |
343 | | const Pointer &ptrval, |
344 | | const FileDatabase &db) const; |
345 | | |
346 | | private: |
347 | | // ------------------------------------------------------------------------------ |
348 | | template <typename T> |
349 | 0 | T *_allocate(std::shared_ptr<T> &out, size_t &s) const { |
350 | 0 | out = std::shared_ptr<T>(new T()); |
351 | 0 | s = 1; |
352 | 0 | return out.get(); |
353 | 0 | } Unexecuted instantiation: Assimp::Blender::Object* Assimp::Blender::Structure::_allocate<Assimp::Blender::Object>(std::__1::shared_ptr<Assimp::Blender::Object>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::Group* Assimp::Blender::Structure::_allocate<Assimp::Blender::Group>(std::__1::shared_ptr<Assimp::Blender::Group>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::GroupObject* Assimp::Blender::Structure::_allocate<Assimp::Blender::GroupObject>(std::__1::shared_ptr<Assimp::Blender::GroupObject>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::CollectionObject* Assimp::Blender::Structure::_allocate<Assimp::Blender::CollectionObject>(std::__1::shared_ptr<Assimp::Blender::CollectionObject>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::CollectionChild* Assimp::Blender::Structure::_allocate<Assimp::Blender::CollectionChild>(std::__1::shared_ptr<Assimp::Blender::CollectionChild>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::Collection* Assimp::Blender::Structure::_allocate<Assimp::Blender::Collection>(std::__1::shared_ptr<Assimp::Blender::Collection>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::Tex* Assimp::Blender::Structure::_allocate<Assimp::Blender::Tex>(std::__1::shared_ptr<Assimp::Blender::Tex>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::Base* Assimp::Blender::Structure::_allocate<Assimp::Blender::Base>(std::__1::shared_ptr<Assimp::Blender::Base>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MTex* Assimp::Blender::Structure::_allocate<Assimp::Blender::MTex>(std::__1::shared_ptr<Assimp::Blender::MTex>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::Image* Assimp::Blender::Structure::_allocate<Assimp::Blender::Image>(std::__1::shared_ptr<Assimp::Blender::Image>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::Material* Assimp::Blender::Structure::_allocate<Assimp::Blender::Material>(std::__1::shared_ptr<Assimp::Blender::Material>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::World* Assimp::Blender::Structure::_allocate<Assimp::Blender::World>(std::__1::shared_ptr<Assimp::Blender::World>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::Library* Assimp::Blender::Structure::_allocate<Assimp::Blender::Library>(std::__1::shared_ptr<Assimp::Blender::Library>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::PackedFile* Assimp::Blender::Structure::_allocate<Assimp::Blender::PackedFile>(std::__1::shared_ptr<Assimp::Blender::PackedFile>&, unsigned long&) const |
354 | | |
355 | | template <typename T> |
356 | 0 | T *_allocate(vector<T> &out, size_t &s) const { |
357 | 0 | out.resize(s); |
358 | 0 | return s ? &out.front() : nullptr; |
359 | 0 | } Unexecuted instantiation: Assimp::Blender::MFace* Assimp::Blender::Structure::_allocate<Assimp::Blender::MFace>(Assimp::Blender::vector<Assimp::Blender::MFace>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MTFace* Assimp::Blender::Structure::_allocate<Assimp::Blender::MTFace>(Assimp::Blender::vector<Assimp::Blender::MTFace>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::TFace* Assimp::Blender::Structure::_allocate<Assimp::Blender::TFace>(Assimp::Blender::vector<Assimp::Blender::TFace>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MVert* Assimp::Blender::Structure::_allocate<Assimp::Blender::MVert>(Assimp::Blender::vector<Assimp::Blender::MVert>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MEdge* Assimp::Blender::Structure::_allocate<Assimp::Blender::MEdge>(Assimp::Blender::vector<Assimp::Blender::MEdge>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MLoop* Assimp::Blender::Structure::_allocate<Assimp::Blender::MLoop>(Assimp::Blender::vector<Assimp::Blender::MLoop>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MLoopUV* Assimp::Blender::Structure::_allocate<Assimp::Blender::MLoopUV>(Assimp::Blender::vector<Assimp::Blender::MLoopUV>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MLoopCol* Assimp::Blender::Structure::_allocate<Assimp::Blender::MLoopCol>(Assimp::Blender::vector<Assimp::Blender::MLoopCol>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MPoly* Assimp::Blender::Structure::_allocate<Assimp::Blender::MPoly>(Assimp::Blender::vector<Assimp::Blender::MPoly>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MTexPoly* Assimp::Blender::Structure::_allocate<Assimp::Blender::MTexPoly>(Assimp::Blender::vector<Assimp::Blender::MTexPoly>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MDeformVert* Assimp::Blender::Structure::_allocate<Assimp::Blender::MDeformVert>(Assimp::Blender::vector<Assimp::Blender::MDeformVert>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MCol* Assimp::Blender::Structure::_allocate<Assimp::Blender::MCol>(Assimp::Blender::vector<Assimp::Blender::MCol>&, unsigned long&) const Unexecuted instantiation: Assimp::Blender::MDeformWeight* Assimp::Blender::Structure::_allocate<Assimp::Blender::MDeformWeight>(Assimp::Blender::vector<Assimp::Blender::MDeformWeight>&, unsigned long&) const |
360 | | |
361 | | // -------------------------------------------------------- |
362 | | template <int error_policy> |
363 | | struct _defaultInitializer { |
364 | | |
365 | | template <typename T, unsigned int N> |
366 | 0 | void operator()(T (&out)[N], const char * = nullptr) { |
367 | 0 | for (unsigned int i = 0; i < N; ++i) { |
368 | 0 | out[i] = T(); |
369 | 0 | } |
370 | 0 | } Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<float, 4u>(float (&) [4u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<char, 32u>(char (&) [32u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<float, 3u>(float (&) [3u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<float, 2u>(float (&) [2u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::MTex>, 18u>(std::__1::shared_ptr<Assimp::Blender::MTex> (&) [18u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<char, 1024u>(char (&) [1024u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<char, 240u>(char (&) [240u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<int, 42u>(int (&) [42u], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<char, 64u>(char (&) [64u], char const*) |
371 | | |
372 | | template <typename T, unsigned int N, unsigned int M> |
373 | 0 | void operator()(T (&out)[N][M], const char * = nullptr) { |
374 | 0 | for (unsigned int i = 0; i < N; ++i) { |
375 | 0 | for (unsigned int j = 0; j < M; ++j) { |
376 | 0 | out[i][j] = T(); |
377 | 0 | } |
378 | 0 | } |
379 | 0 | } |
380 | | |
381 | | template <typename T> |
382 | 0 | void operator()(T &out, const char * = nullptr) { |
383 | 0 | out = T(); |
384 | 0 | } Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<float>(float&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<char>(char&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::Object> >(std::__1::shared_ptr<Assimp::Blender::Object>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::Group> >(std::__1::shared_ptr<Assimp::Blender::Group>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::ListBase>(Assimp::Blender::ListBase&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<int>(int&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::GroupObject> >(std::__1::shared_ptr<Assimp::Blender::GroupObject>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::Collection> >(std::__1::shared_ptr<Assimp::Blender::Collection>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::Tex> >(std::__1::shared_ptr<Assimp::Blender::Tex>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<short>(short&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::FileOffset> >(std::__1::shared_ptr<Assimp::Blender::FileOffset>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::Base> >(std::__1::shared_ptr<Assimp::Blender::Base>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::Pointer>(Assimp::Blender::Pointer&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::Image> >(std::__1::shared_ptr<Assimp::Blender::Image>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MTFace> >(Assimp::Blender::vector<Assimp::Blender::MTFace>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::TFace> >(Assimp::Blender::vector<Assimp::Blender::TFace>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MEdge> >(Assimp::Blender::vector<Assimp::Blender::MEdge>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MLoop> >(Assimp::Blender::vector<Assimp::Blender::MLoop>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MLoopUV> >(Assimp::Blender::vector<Assimp::Blender::MLoopUV>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MLoopCol> >(Assimp::Blender::vector<Assimp::Blender::MLoopCol>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MPoly> >(Assimp::Blender::vector<Assimp::Blender::MPoly>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MTexPoly> >(Assimp::Blender::vector<Assimp::Blender::MTexPoly>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MDeformVert> >(Assimp::Blender::vector<Assimp::Blender::MDeformVert>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MCol> >(Assimp::Blender::vector<Assimp::Blender::MCol>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::CustomData>(Assimp::Blender::CustomData&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<Assimp::Blender::MDeformWeight> >(Assimp::Blender::vector<Assimp::Blender::MDeformWeight>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<unsigned char>(unsigned char&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::ElemBase> >(std::__1::shared_ptr<Assimp::Blender::ElemBase>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::World> >(std::__1::shared_ptr<Assimp::Blender::World>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::Library> >(std::__1::shared_ptr<Assimp::Blender::Library>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<std::__1::shared_ptr<Assimp::Blender::PackedFile> >(std::__1::shared_ptr<Assimp::Blender::PackedFile>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<0>::operator()<Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::CustomDataLayer> > >(Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::CustomDataLayer> >&, char const*) |
385 | | }; |
386 | | |
387 | | private: |
388 | | mutable size_t cache_idx; |
389 | | }; |
390 | | |
391 | | // ------------------------------------------------------------------------------------------------------- |
392 | | template<> |
393 | | struct Structure::_defaultInitializer<ErrorPolicy_Warn> { |
394 | | template <typename T> |
395 | 0 | void operator()(T &out, const char *reason = "<add reason>") { |
396 | 0 | ASSIMP_LOG_WARN(reason); |
397 | | |
398 | | // ... and let the show go on |
399 | 0 | _defaultInitializer<0 /*ErrorPolicy_Igno*/>()(out); |
400 | 0 | } Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<float>(float&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<float [4]>(float (&) [4], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<float [4][4]>(float (&) [4][4], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<char>(char&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<char [32]>(char (&) [32], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::Object> >(std::__1::shared_ptr<Assimp::Blender::Object>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::Group> >(std::__1::shared_ptr<Assimp::Blender::Group>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::ListBase>(Assimp::Blender::ListBase&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<int>(int&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::GroupObject> >(std::__1::shared_ptr<Assimp::Blender::GroupObject>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::Collection> >(std::__1::shared_ptr<Assimp::Blender::Collection>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::Tex> >(std::__1::shared_ptr<Assimp::Blender::Tex>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<float [3]>(float (&) [3], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<short>(short&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<float [2]>(float (&) [2], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::FileOffset> >(std::__1::shared_ptr<Assimp::Blender::FileOffset>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::Base> >(std::__1::shared_ptr<Assimp::Blender::Base>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::Pointer>(Assimp::Blender::Pointer&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::MTex> [18]>(std::__1::shared_ptr<Assimp::Blender::MTex> (&) [18], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::Image> >(std::__1::shared_ptr<Assimp::Blender::Image>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MTFace> >(Assimp::Blender::vector<Assimp::Blender::MTFace>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::TFace> >(Assimp::Blender::vector<Assimp::Blender::TFace>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MEdge> >(Assimp::Blender::vector<Assimp::Blender::MEdge>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MLoop> >(Assimp::Blender::vector<Assimp::Blender::MLoop>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MLoopUV> >(Assimp::Blender::vector<Assimp::Blender::MLoopUV>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MLoopCol> >(Assimp::Blender::vector<Assimp::Blender::MLoopCol>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MPoly> >(Assimp::Blender::vector<Assimp::Blender::MPoly>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MTexPoly> >(Assimp::Blender::vector<Assimp::Blender::MTexPoly>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MDeformVert> >(Assimp::Blender::vector<Assimp::Blender::MDeformVert>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MCol> >(Assimp::Blender::vector<Assimp::Blender::MCol>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::CustomData>(Assimp::Blender::CustomData&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<Assimp::Blender::MDeformWeight> >(Assimp::Blender::vector<Assimp::Blender::MDeformWeight>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<unsigned char>(unsigned char&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::ElemBase> >(std::__1::shared_ptr<Assimp::Blender::ElemBase>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<char [1024]>(char (&) [1024], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::World> >(std::__1::shared_ptr<Assimp::Blender::World>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<char [240]>(char (&) [240], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::Library> >(std::__1::shared_ptr<Assimp::Blender::Library>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<std::__1::shared_ptr<Assimp::Blender::PackedFile> >(std::__1::shared_ptr<Assimp::Blender::PackedFile>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<int [42]>(int (&) [42], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::CustomDataLayer> > >(Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::CustomDataLayer> >&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<1>::operator()<char [64]>(char (&) [64], char const*) |
401 | | }; |
402 | | |
403 | | // ------------------------------------------------------------------------------------------------------- |
404 | | template<> |
405 | | struct Structure::_defaultInitializer<ErrorPolicy_Fail> { |
406 | | template <typename T> |
407 | 0 | void operator()(T & /*out*/, const char *message = "") { |
408 | | // obviously, it is crucial that _DefaultInitializer is used |
409 | | // only from within a catch clause. |
410 | 0 | throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error: ", message); |
411 | 0 | } Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<Assimp::Blender::ID>(Assimp::Blender::ID&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<int>(int&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<std::__1::shared_ptr<Assimp::Blender::ElemBase> >(std::__1::shared_ptr<Assimp::Blender::ElemBase>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<std::__1::shared_ptr<Assimp::Blender::CollectionObject> >(std::__1::shared_ptr<Assimp::Blender::CollectionObject>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<std::__1::shared_ptr<Assimp::Blender::CollectionChild> >(std::__1::shared_ptr<Assimp::Blender::CollectionChild>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<Assimp::Blender::ListBase>(Assimp::Blender::ListBase&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<float [4][2]>(float (&) [4][2], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<int [4]>(int (&) [4], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<Assimp::Blender::ModifierData>(Assimp::Blender::ModifierData&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<short>(short&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<float>(float&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<Assimp::Blender::vector<Assimp::Blender::MFace> >(Assimp::Blender::vector<Assimp::Blender::MFace>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<Assimp::Blender::vector<Assimp::Blender::MVert> >(Assimp::Blender::vector<Assimp::Blender::MVert>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::Material> > >(Assimp::Blender::vector<std::__1::shared_ptr<Assimp::Blender::Material> >&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<float [3]>(float (&) [3], char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<std::__1::shared_ptr<Assimp::Blender::GroupObject> >(std::__1::shared_ptr<Assimp::Blender::GroupObject>&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<char>(char&, char const*) Unexecuted instantiation: void Assimp::Blender::Structure::_defaultInitializer<2>::operator()<char [240]>(char (&) [240], char const*) |
412 | | }; |
413 | | |
414 | | // ------------------------------------------------------------------------------------------------------- |
415 | | template <> |
416 | | inline bool Structure ::ResolvePointer<std::shared_ptr, ElemBase>(std::shared_ptr<ElemBase> &out, |
417 | | const Pointer &ptrval, |
418 | | const FileDatabase &db, |
419 | | const Field &f, |
420 | | bool) const; |
421 | | |
422 | | template <> bool Structure :: ResolvePointer<std::shared_ptr,ElemBase>( |
423 | | std::shared_ptr<ElemBase>& out, const Pointer & ptrval, |
424 | | const FileDatabase& db, const Field&, bool) const; |
425 | | template <> inline void Structure :: Convert<int> (int& dest,const FileDatabase& db) const; |
426 | | template<> inline void Structure :: Convert<short> (short& dest,const FileDatabase& db) const; |
427 | | template <> inline void Structure :: Convert<char> (char& dest,const FileDatabase& db) const; |
428 | | template <> inline void Structure::Convert<unsigned char>(unsigned char& dest, const FileDatabase& db) const; |
429 | | template <> inline void Structure :: Convert<float> (float& dest,const FileDatabase& db) const; |
430 | | template <> inline void Structure :: Convert<double> (double& dest,const FileDatabase& db) const; |
431 | | template <> inline void Structure :: Convert<Pointer> (Pointer& dest,const FileDatabase& db) const; |
432 | | |
433 | | // ------------------------------------------------------------------------------- |
434 | | /** Represents the full data structure information for a single BLEND file. |
435 | | * This data is extracted from the DNA1 chunk in the file. |
436 | | * #DNAParser does the reading and represents currently the only place where |
437 | | * DNA is altered.*/ |
438 | | // ------------------------------------------------------------------------------- |
439 | | class DNA { |
440 | | public: |
441 | | typedef void (Structure::*ConvertProcPtr)( |
442 | | std::shared_ptr<ElemBase> in, |
443 | | const FileDatabase &) const; |
444 | | |
445 | | typedef std::shared_ptr<ElemBase> ( |
446 | | Structure::*AllocProcPtr)() const; |
447 | | |
448 | | typedef std::pair<AllocProcPtr, ConvertProcPtr> FactoryPair; |
449 | | |
450 | | public: |
451 | | std::map<std::string, FactoryPair> converters; |
452 | | vector<Structure> structures; |
453 | | std::map<std::string, size_t> indices; |
454 | | |
455 | | public: |
456 | | // -------------------------------------------------------- |
457 | | /** Access a structure by its canonical name, the pointer version returns nullptr on failure |
458 | | * while the reference version raises an error. */ |
459 | | inline const Structure &operator[](const std::string &ss) const; |
460 | | inline const Structure *Get(const std::string &ss) const; |
461 | | |
462 | | // -------------------------------------------------------- |
463 | | /** Access a structure by its index */ |
464 | | inline const Structure &operator[](const size_t i) const; |
465 | | |
466 | | public: |
467 | | // -------------------------------------------------------- |
468 | | /** Add structure definitions for all the primitive types, |
469 | | * i.e. integer, short, char, float */ |
470 | | void AddPrimitiveStructures(); |
471 | | |
472 | | // -------------------------------------------------------- |
473 | | /** Fill the @c converters member with converters for all |
474 | | * known data types. The implementation of this method is |
475 | | * in BlenderScene.cpp and is machine-generated. |
476 | | * Converters are used to quickly handle objects whose |
477 | | * exact data type is a runtime-property and not yet |
478 | | * known at compile time (consider Object::data).*/ |
479 | | void RegisterConverters(); |
480 | | |
481 | | // -------------------------------------------------------- |
482 | | /** Take an input blob from the stream, interpret it according to |
483 | | * a its structure name and convert it to the intermediate |
484 | | * representation. |
485 | | * @param structure Destination structure definition |
486 | | * @param db File database. |
487 | | * @return A null pointer if no appropriate converter is available.*/ |
488 | | std::shared_ptr<ElemBase> ConvertBlobToStructure( |
489 | | const Structure &structure, |
490 | | const FileDatabase &db) const; |
491 | | |
492 | | // -------------------------------------------------------- |
493 | | /** Find a suitable conversion function for a given Structure. |
494 | | * Such a converter function takes a blob from the input |
495 | | * stream, reads as much as it needs, and builds up a |
496 | | * complete object in intermediate representation. |
497 | | * @param structure Destination structure definition |
498 | | * @param db File database. |
499 | | * @return A null pointer in .first if no appropriate converter is available.*/ |
500 | | FactoryPair GetBlobToStructureConverter( |
501 | | const Structure &structure, |
502 | | const FileDatabase &db) const; |
503 | | |
504 | | #if ASSIMP_BUILD_BLENDER_DEBUG_DNA |
505 | | // -------------------------------------------------------- |
506 | | /** Dump the DNA to a text file. This is for debugging purposes. |
507 | | * The output file is `dna.txt` in the current working folder*/ |
508 | | void DumpToFile(); |
509 | | #endif |
510 | | |
511 | | // -------------------------------------------------------- |
512 | | /** Extract array dimensions from a C array declaration, such |
513 | | * as `...[4][6]`. Returned string would be `...[][]`. |
514 | | * @param out |
515 | | * @param array_sizes Receive maximally two array dimensions, |
516 | | * the second element is set to 1 if the array is flat. |
517 | | * Both are set to 1 if the input is not an array. |
518 | | * @throw DeadlyImportError if more than 2 dimensions are |
519 | | * encountered. */ |
520 | | static void ExtractArraySize( |
521 | | const std::string &out, |
522 | | size_t array_sizes[2]); |
523 | | }; |
524 | | |
525 | | // special converters for primitive types |
526 | | template <> |
527 | | inline void Structure ::Convert<int>(int &dest, const FileDatabase &db) const; |
528 | | template <> |
529 | | inline void Structure ::Convert<short>(short &dest, const FileDatabase &db) const; |
530 | | template <> |
531 | | inline void Structure ::Convert<char>(char &dest, const FileDatabase &db) const; |
532 | | template <> |
533 | | inline void Structure ::Convert<float>(float &dest, const FileDatabase &db) const; |
534 | | template <> |
535 | | inline void Structure ::Convert<double>(double &dest, const FileDatabase &db) const; |
536 | | template <> |
537 | | inline void Structure ::Convert<Pointer>(Pointer &dest, const FileDatabase &db) const; |
538 | | |
539 | | // ------------------------------------------------------------------------------- |
540 | | /** Describes a master file block header. Each master file sections holds n |
541 | | * elements of a certain SDNA structure (or otherwise unspecified data). */ |
542 | | // ------------------------------------------------------------------------------- |
543 | | struct FileBlockHead { |
544 | | // points right after the header of the file block |
545 | | StreamReaderAny::pos start; |
546 | | |
547 | | std::string id; |
548 | | size_t size; |
549 | | |
550 | | // original memory address of the data |
551 | | Pointer address; |
552 | | |
553 | | // index into DNA |
554 | | unsigned int dna_index; |
555 | | |
556 | | // number of structure instances to follow |
557 | | size_t num; |
558 | | |
559 | | // file blocks are sorted by address to quickly locate specific memory addresses |
560 | 0 | bool operator<(const FileBlockHead &o) const { |
561 | 0 | return address.val < o.address.val; |
562 | 0 | } |
563 | | |
564 | | // for std::upper_bound |
565 | 0 | operator const Pointer &() const { |
566 | 0 | return address; |
567 | 0 | } |
568 | | }; |
569 | | |
570 | | // for std::upper_bound |
571 | 0 | inline bool operator<(const Pointer &a, const Pointer &b) { |
572 | 0 | return a.val < b.val; |
573 | 0 | } |
574 | | |
575 | | // ------------------------------------------------------------------------------- |
576 | | /** Utility to read all master file blocks in turn. */ |
577 | | // ------------------------------------------------------------------------------- |
578 | | class SectionParser { |
579 | | public: |
580 | | // -------------------------------------------------------- |
581 | | /** @param stream Inout stream, must point to the |
582 | | * first section in the file. Call Next() once |
583 | | * to have it read. |
584 | | * @param ptr64 Pointer size in file is 64 bits? */ |
585 | | SectionParser(StreamReaderAny &stream, bool ptr64) : |
586 | 0 | stream(stream), ptr64(ptr64) { |
587 | 0 | current.size = current.start = 0; |
588 | 0 | } |
589 | | |
590 | | public: |
591 | | // -------------------------------------------------------- |
592 | 0 | const FileBlockHead &GetCurrent() const { |
593 | 0 | return current; |
594 | 0 | } |
595 | | |
596 | | public: |
597 | | // -------------------------------------------------------- |
598 | | /** Advance to the next section. |
599 | | * @throw DeadlyImportError if the last chunk was passed. */ |
600 | | void Next(); |
601 | | |
602 | | public: |
603 | | FileBlockHead current; |
604 | | StreamReaderAny &stream; |
605 | | bool ptr64; |
606 | | }; |
607 | | |
608 | | #ifndef ASSIMP_BUILD_BLENDER_NO_STATS |
609 | | // ------------------------------------------------------------------------------- |
610 | | /** Import statistics, i.e. number of file blocks read*/ |
611 | | // ------------------------------------------------------------------------------- |
612 | | class Statistics { |
613 | | public: |
614 | | Statistics() = default; |
615 | | ~Statistics() = default; |
616 | | |
617 | | /// total number of fields we read |
618 | | unsigned int fields_read; |
619 | | |
620 | | /// total number of resolved pointers |
621 | | unsigned int pointers_resolved; |
622 | | |
623 | | /// number of pointers resolved from the cache |
624 | | unsigned int cache_hits; |
625 | | |
626 | | /// objects in FileData::cache |
627 | | unsigned int cached_objects; |
628 | | }; |
629 | | |
630 | | #endif |
631 | | |
632 | | // ------------------------------------------------------------------------------- |
633 | | /** The object cache - all objects addressed by pointers are added here. This |
634 | | * avoids circular references and avoids object duplication. */ |
635 | | // ------------------------------------------------------------------------------- |
636 | | template <template <typename> class TOUT> |
637 | | class ObjectCache { |
638 | | public: |
639 | | typedef std::map<Pointer, TOUT<ElemBase>> StructureCache; |
640 | | |
641 | | public: |
642 | 0 | explicit ObjectCache(const FileDatabase &db) : db(db) { |
643 | | // currently there are only ~400 structure records per blend file. |
644 | | // we read only a small part of them and don't cache objects |
645 | | // which we don't need, so this should suffice. |
646 | 0 | caches.reserve(64); |
647 | 0 | } |
648 | | |
649 | | // -------------------------------------------------------- |
650 | | /** Check whether a specific item is in the cache. |
651 | | * @param s Data type of the item |
652 | | * @param out Output pointer. Unchanged if the |
653 | | * cache doesn't know the item yet. |
654 | | * @param ptr Item address to look for. */ |
655 | | template <typename T> |
656 | | void get( const Structure &s,TOUT<T> &out, const Pointer &ptr) const; |
657 | | |
658 | | // -------------------------------------------------------- |
659 | | /** Add an item to the cache after the item has |
660 | | * been fully read. Do not insert anything that |
661 | | * may be faulty or might cause the loading |
662 | | * to abort. |
663 | | * @param s Data type of the item |
664 | | * @param out Item to insert into the cache |
665 | | * @param ptr address (cache key) of the item. */ |
666 | | template <typename T> |
667 | | void set(const Structure &s, |
668 | | const TOUT<T> &out, |
669 | | const Pointer &ptr); |
670 | | |
671 | | private: |
672 | | mutable vector<StructureCache> caches; |
673 | | const FileDatabase &db; |
674 | | }; |
675 | | |
676 | | // ------------------------------------------------------------------------------- |
677 | | // ------------------------------------------------------------------------------- |
678 | | template <> |
679 | | class ObjectCache<Blender::vector> { |
680 | | public: |
681 | 0 | explicit ObjectCache(const FileDatabase &) {} |
682 | | |
683 | | template <typename T> |
684 | 0 | void get(const Structure &, vector<T> &, const Pointer &) {}Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MFace>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MFace>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MTFace>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MTFace>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::TFace>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::TFace>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MVert>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MVert>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MEdge>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MEdge>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MLoop>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MLoop>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MLoopUV>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MLoopUV>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MLoopCol>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MLoopCol>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MPoly>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MPoly>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MTexPoly>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MTexPoly>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MDeformVert>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MDeformVert>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MCol>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MCol>&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::get<Assimp::Blender::MDeformWeight>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MDeformWeight>&, Assimp::Blender::Pointer const&) |
685 | | template <typename T> |
686 | 0 | void set(const Structure &, const vector<T> &, const Pointer &) {}Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MFace>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MFace> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MTFace>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MTFace> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::TFace>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::TFace> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MVert>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MVert> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MEdge>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MEdge> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MLoop>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MLoop> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MLoopUV>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MLoopUV> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MLoopCol>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MLoopCol> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MPoly>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MPoly> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MTexPoly>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MTexPoly> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MDeformVert>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MDeformVert> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MCol>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MCol> const&, Assimp::Blender::Pointer const&) Unexecuted instantiation: void Assimp::Blender::ObjectCache<Assimp::Blender::vector>::set<Assimp::Blender::MDeformWeight>(Assimp::Blender::Structure const&, Assimp::Blender::vector<Assimp::Blender::MDeformWeight> const&, Assimp::Blender::Pointer const&) |
687 | | }; |
688 | | |
689 | | #ifdef _MSC_VER |
690 | | # pragma warning(disable : 4355) |
691 | | #endif |
692 | | |
693 | | // ------------------------------------------------------------------------------- |
694 | | /** Memory representation of a full BLEND file and all its dependencies. The |
695 | | * output aiScene is constructed from an instance of this data structure. */ |
696 | | // ------------------------------------------------------------------------------- |
697 | | class FileDatabase { |
698 | | template <template <typename> class TOUT> |
699 | | friend class ObjectCache; |
700 | | |
701 | | public: |
702 | | FileDatabase() : |
703 | 0 | _cacheArrays(*this), _cache(*this), next_cache_idx() {} |
704 | | |
705 | 0 | Statistics &stats() const { |
706 | 0 | return _stats; |
707 | 0 | } |
708 | | |
709 | | // For all our templates to work on both shared_ptr's and vector's |
710 | | // using the same code, a dummy cache for arrays is provided. Actually, |
711 | | // arrays of objects are never cached because we can't easily |
712 | | // ensure their proper destruction. |
713 | | template <typename T> |
714 | 0 | ObjectCache<std::shared_ptr> &cache(std::shared_ptr<T> & /*in*/) const { |
715 | 0 | return _cache; |
716 | 0 | } Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::ElemBase>(std::__1::shared_ptr<Assimp::Blender::ElemBase>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Object>(std::__1::shared_ptr<Assimp::Blender::Object>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Group>(std::__1::shared_ptr<Assimp::Blender::Group>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::GroupObject>(std::__1::shared_ptr<Assimp::Blender::GroupObject>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::CollectionObject>(std::__1::shared_ptr<Assimp::Blender::CollectionObject>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::CollectionChild>(std::__1::shared_ptr<Assimp::Blender::CollectionChild>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Collection>(std::__1::shared_ptr<Assimp::Blender::Collection>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Tex>(std::__1::shared_ptr<Assimp::Blender::Tex>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Base>(std::__1::shared_ptr<Assimp::Blender::Base>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MTex>(std::__1::shared_ptr<Assimp::Blender::MTex>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Image>(std::__1::shared_ptr<Assimp::Blender::Image>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Material>(std::__1::shared_ptr<Assimp::Blender::Material>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::World>(std::__1::shared_ptr<Assimp::Blender::World>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::Library>(std::__1::shared_ptr<Assimp::Blender::Library>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<std::__1::shared_ptr>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::PackedFile>(std::__1::shared_ptr<Assimp::Blender::PackedFile>&) const |
717 | | |
718 | | template <typename T> |
719 | 0 | ObjectCache<vector> &cache(vector<T> & /*in*/) const { |
720 | 0 | return _cacheArrays; |
721 | 0 | } Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MFace>(Assimp::Blender::vector<Assimp::Blender::MFace>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MTFace>(Assimp::Blender::vector<Assimp::Blender::MTFace>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::TFace>(Assimp::Blender::vector<Assimp::Blender::TFace>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MVert>(Assimp::Blender::vector<Assimp::Blender::MVert>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MEdge>(Assimp::Blender::vector<Assimp::Blender::MEdge>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MLoop>(Assimp::Blender::vector<Assimp::Blender::MLoop>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MLoopUV>(Assimp::Blender::vector<Assimp::Blender::MLoopUV>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MLoopCol>(Assimp::Blender::vector<Assimp::Blender::MLoopCol>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MPoly>(Assimp::Blender::vector<Assimp::Blender::MPoly>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MTexPoly>(Assimp::Blender::vector<Assimp::Blender::MTexPoly>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MDeformVert>(Assimp::Blender::vector<Assimp::Blender::MDeformVert>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MCol>(Assimp::Blender::vector<Assimp::Blender::MCol>&) const Unexecuted instantiation: Assimp::Blender::ObjectCache<Assimp::Blender::vector>& Assimp::Blender::FileDatabase::cache<Assimp::Blender::MDeformWeight>(Assimp::Blender::vector<Assimp::Blender::MDeformWeight>&) const |
722 | | |
723 | | public: |
724 | | // publicly accessible fields |
725 | | bool i64bit; |
726 | | bool little; |
727 | | |
728 | | DNA dna; |
729 | | std::shared_ptr<StreamReaderAny> reader; |
730 | | vector<FileBlockHead> entries; |
731 | | |
732 | | private: |
733 | | #ifndef ASSIMP_BUILD_BLENDER_NO_STATS |
734 | | mutable Statistics _stats; |
735 | | #endif |
736 | | |
737 | | mutable ObjectCache<vector> _cacheArrays; |
738 | | mutable ObjectCache<std::shared_ptr> _cache; |
739 | | |
740 | | mutable size_t next_cache_idx; |
741 | | }; |
742 | | |
743 | | #ifdef _MSC_VER |
744 | | # pragma warning(default : 4355) |
745 | | #endif |
746 | | |
747 | | // ------------------------------------------------------------------------------- |
748 | | /** Factory to extract a #DNA from the DNA1 file block in a BLEND file. */ |
749 | | // ------------------------------------------------------------------------------- |
750 | | class DNAParser { |
751 | | public: |
752 | | /** Bind the parser to a empty DNA and an input stream */ |
753 | 0 | explicit DNAParser(FileDatabase &db) : db(db) { |
754 | | // empty |
755 | 0 | } |
756 | | |
757 | | // -------------------------------------------------------- |
758 | | /** Locate the DNA in the file and parse it. The input |
759 | | * stream is expected to point to the beginning of the DN1 |
760 | | * chunk at the time this method is called and is |
761 | | * undefined afterwards. |
762 | | * @throw DeadlyImportError if the DNA cannot be read. |
763 | | * @note The position of the stream pointer is undefined |
764 | | * afterwards.*/ |
765 | | void Parse(); |
766 | | |
767 | | /** Obtain a reference to the extracted DNA information */ |
768 | 0 | const Blender::DNA &GetDNA() const { |
769 | 0 | return db.dna; |
770 | 0 | } |
771 | | |
772 | | private: |
773 | | FileDatabase &db; |
774 | | }; |
775 | | |
776 | | /** |
777 | | * @brief read CustomData's data to ptr to mem |
778 | | * @param[out] out memory ptr to set |
779 | | * @param[in] cdtype to read |
780 | | * @param[in] cnt cnt of elements to read |
781 | | * @param[in] db to read elements from |
782 | | * @return true when ok |
783 | | */ |
784 | | bool readCustomData(std::shared_ptr<ElemBase> &out, int cdtype, size_t cnt, const FileDatabase &db); |
785 | | |
786 | | } // namespace Blender |
787 | | } // namespace Assimp |
788 | | |
789 | | #include "BlenderDNA.inl" |
790 | | |
791 | | #endif |