- fbx: add "strict" import mode (only accept 2012,2013 files).
parent
b7456307dd
commit
f617e766b1
|
@ -494,9 +494,9 @@ const Object* LazyObject::Get(bool dieOnError)
|
|||
flags &= ~BEING_CONSTRUCTED;
|
||||
flags |= FAILED_TO_CONSTRUCT;
|
||||
|
||||
//if(dieOnError) {
|
||||
if(dieOnError || doc.Settings().strictMode) {
|
||||
throw;
|
||||
//}
|
||||
}
|
||||
|
||||
// note: the error message is already formatted, so raw logging is ok
|
||||
if(!DefaultLogger::isNullLogger()) {
|
||||
|
@ -587,6 +587,13 @@ void Document::ReadHeader()
|
|||
const Scope& shead = *ehead->Compound();
|
||||
fbxVersion = ParseTokenAsInt(GetRequiredToken(GetRequiredElement(shead,"FBXVersion",ehead),0));
|
||||
|
||||
if(Settings().strictMode) {
|
||||
if(fbxVersion < 7200 || fbxVersion > 7300) {
|
||||
DOMError("unsupported format version, supported are only FBX 2012 and FBX 2013"\
|
||||
" in ASCII format (turn off strict mode to try anyhow) ");
|
||||
}
|
||||
}
|
||||
|
||||
const Element* const ecreator = shead["Creator"];
|
||||
if(ecreator) {
|
||||
creator = ParseTokenAsString(GetRequiredToken(*ecreator,0));
|
||||
|
|
|
@ -57,7 +57,17 @@ struct ImportSettings
|
|||
, readCameras(true)
|
||||
, readLights(true)
|
||||
, readAnimations(true)
|
||||
, strictMode(true)
|
||||
{}
|
||||
|
||||
|
||||
/** enable strict mode:
|
||||
* - only accept fbx 2012, 2013 files
|
||||
* - on the slightest error, give up.
|
||||
*
|
||||
* Basically, strict mode means that the fbx file will actually
|
||||
* be validated. Strict mode is off by default. */
|
||||
bool strictMode;
|
||||
|
||||
/** specifies whether all geometry layers are read and scanned for
|
||||
* usable data channels. The FBX spec indicates that many readers
|
||||
|
|
Loading…
Reference in New Issue