MCPcopy Create free account
hub / github.com/assimp/assimp / ExtractScene

Method ExtractScene

code/AssetLib/Blender/BlenderLoader.cpp:195–230  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

193
194// ------------------------------------------------------------------------------------------------
195void BlenderImporter::ExtractScene(Scene &out, const FileDatabase &file) {
196 const FileBlockHead *block = nullptr;
197 std::map<std::string, size_t>::const_iterator it = file.dna.indices.find("Scene");
198 if (it == file.dna.indices.end()) {
199 ThrowException("There is no `Scene` structure record");
200 }
201
202 const Structure &ss = file.dna.structures[(*it).second];
203
204 // we need a scene somewhere to start with.
205 for (const FileBlockHead &bl : file.entries) {
206
207 // Fix: using the DNA index is more reliable to locate scenes
208 //if (bl.id == "SC") {
209
210 if (bl.dna_index == (*it).second) {
211 block = &bl;
212 break;
213 }
214 }
215
216 if (!block) {
217 ThrowException("There is not a single `Scene` record to load");
218 }
219
220 file.reader->SetCurrentPos(block->start);
221 ss.Convert(out, file);
222
223#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
224 ASSIMP_LOG_INFO(
225 "(Stats) Fields read: ", file.stats().fields_read,
226 ", pointers resolved: ", file.stats().pointers_resolved,
227 ", cache hits: ", file.stats().cache_hits,
228 ", cached objects: ", file.stats().cached_objects);
229#endif
230}
231
232// ------------------------------------------------------------------------------------------------
233void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr<Collection>& collection, ConversionData &conv_data) {

Callers

nothing calls this directly

Calls 3

ConvertMethod · 0.80
endMethod · 0.45
SetCurrentPosMethod · 0.45

Tested by

no test coverage detected