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

Method ReadHeader

code/AssetLib/FBX/FBXDocument.cpp:287–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285static const unsigned int UpperSupportedVersion = 7400;
286
287void Document::ReadHeader() {
288 // Read ID objects from "Objects" section
289 const Scope& sc = parser.GetRootScope();
290 const Element* const ehead = sc["FBXHeaderExtension"];
291 if(!ehead || !ehead->Compound()) {
292 DOMError("no FBXHeaderExtension dictionary found");
293 }
294
295 const Scope& shead = *ehead->Compound();
296 fbxVersion = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(shead,"FBXVersion",ehead),0));
297 ASSIMP_LOG_DEBUG("FBX Version: ", fbxVersion);
298
299 // While we may have some success with newer files, we don't support
300 // the older 6.n fbx format
301 if(fbxVersion < LowerSupportedVersion ) {
302 DOMError("unsupported, old format version, supported are only FBX 2011, FBX 2012 and FBX 2013");
303 }
304 if(fbxVersion > UpperSupportedVersion ) {
305 if(Settings().strictMode) {
306 DOMError("unsupported, newer format version, supported are only FBX 2011, FBX 2012 and FBX 2013"
307 " (turn off strict mode to try anyhow) ");
308 }
309 else {
310 DOMWarning("unsupported, newer format version, supported are only FBX 2011, FBX 2012 and FBX 2013,"
311 " trying to read it nevertheless");
312 }
313 }
314
315 const Element* const ecreator = shead["Creator"];
316 if(ecreator) {
317 creator = ParseTokenAsString(GetRequiredToken(*ecreator,0));
318 }
319
320 const Element* const etimestamp = shead["CreationTimeStamp"];
321 if(etimestamp && etimestamp->Compound()) {
322 const Scope& stimestamp = *etimestamp->Compound();
323 creationTimeStamp[0] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Year"),0));
324 creationTimeStamp[1] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Month"),0));
325 creationTimeStamp[2] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Day"),0));
326 creationTimeStamp[3] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Hour"),0));
327 creationTimeStamp[4] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Minute"),0));
328 creationTimeStamp[5] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Second"),0));
329 creationTimeStamp[6] = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(stimestamp,"Millisecond"),0));
330 }
331}
332
333// ------------------------------------------------------------------------------------------------
334void Document::ReadGlobalSettings() {

Callers

nothing calls this directly

Calls 6

DOMErrorFunction · 0.85
ParseTokenAsIntFunction · 0.85
SettingsClass · 0.85
DOMWarningFunction · 0.85
ParseTokenAsStringFunction · 0.85
CompoundMethod · 0.80

Tested by

no test coverage detected