Model animation loading errors

Another fix, for a different exception type, spotted by Michael D.

SF-ID: https://sourceforge.net/p/flightgear/codetickets/2702/
This commit is contained in:
James Turner 2022-02-06 10:55:58 +00:00
parent f17bd77030
commit 8722ea0fb6

View File

@ -824,12 +824,20 @@ sgLoad3DModel_internal(const SGPath& path,
/// OSGFIXME: duh, why not only model????? /// OSGFIXME: duh, why not only model?????
SGAnimation::animate(modelData); SGAnimation::animate(modelData);
// note from James: we used to re-throw these errors, and they
// were caught one level up as an SG_DEV_ALERT log message and
// loading an empty osg::Node for the entire model.
// Chosing instead to trap them there, since a single failed animation
// isn't necessarily a reason to abandon the model load.
} catch (sg_exception& e) { } catch (sg_exception& e) {
simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::XMLModelLoad, simgear::reportFailure(simgear::LoadFailure::Misconfigured, simgear::ErrorCode::XMLModelLoad,
"Couldn't load animation " + animation_nodes[i]->getNameString() "Couldn't load animation " + animation_nodes[i]->getNameString() + ":" + e.getFormattedMessage(),
+ ":" + e.getFormattedMessage(), modelpath);
} catch (std::exception& e) { // needed because props throws std::runtime_error sometimes
simgear::reportFailure(simgear::LoadFailure::Misconfigured, simgear::ErrorCode::XMLModelLoad,
"Couldn't load animation " + animation_nodes[i]->getNameString() + ":" + e.what(),
modelpath); modelpath);
throw;
} }
} }