Allow delayed setup of ErrorContext data
Permit no model data to be provided, when loading a model via the modelLib API (d’oh)
This commit is contained in:
parent
81a489d81d
commit
651460bbc8
@ -87,6 +87,11 @@ ErrorReportContext::ErrorReportContext(const std::string& key, const std::string
|
||||
}
|
||||
|
||||
ErrorReportContext::ErrorReportContext(const ContextMap& context)
|
||||
{
|
||||
addFromMap(context);
|
||||
}
|
||||
|
||||
void ErrorReportContext::addFromMap(const ContextMap& context)
|
||||
{
|
||||
if (static_contextCallback) {
|
||||
for (const auto& p : context) {
|
||||
@ -96,6 +101,7 @@ ErrorReportContext::ErrorReportContext(const ContextMap& context)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ErrorReportContext::~ErrorReportContext()
|
||||
{
|
||||
if (static_contextCallback) {
|
||||
|
@ -78,7 +78,12 @@ public:
|
||||
/**
|
||||
Allow establishing multiple context values in a single operation
|
||||
*/
|
||||
ErrorReportContext(const ContextMap& context);
|
||||
ErrorReportContext(const ContextMap& context = {});
|
||||
|
||||
/**
|
||||
@brief allowed delayed add of values
|
||||
*/
|
||||
void addFromMap(const ContextMap& context);
|
||||
|
||||
~ErrorReportContext();
|
||||
|
||||
|
@ -143,7 +143,10 @@ SGModelLib::loadModel(const string &path,
|
||||
|
||||
// establish the error report context so we can attribute any load
|
||||
// errors correctly
|
||||
simgear::ErrorReportContext ec(data->getErrorContext());
|
||||
simgear::ErrorReportContext ec;
|
||||
if (data) {
|
||||
ec.addFromMap(data->getErrorContext());
|
||||
}
|
||||
|
||||
if (load2DPanels) {
|
||||
opt->setLoadPanel(static_panelFunc);
|
||||
@ -164,9 +167,10 @@ SGModelLib::loadDeferredModel(const string &path, SGPropertyNode *prop_root,
|
||||
proxyNode->setLoadingExternalReferenceMode(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER);
|
||||
proxyNode->setFileName(0, path);
|
||||
|
||||
// establish the error report context so we can attribute any load
|
||||
// errors correctly
|
||||
simgear::ErrorReportContext ec(data->getErrorContext());
|
||||
simgear::ErrorReportContext ec;
|
||||
if (data) {
|
||||
ec.addFromMap(data->getErrorContext());
|
||||
}
|
||||
|
||||
osg::ref_ptr<SGReaderWriterOptions> opt;
|
||||
opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
||||
@ -199,9 +203,10 @@ SGModelLib::loadPagedModel(SGPropertyNode *prop_root, SGModelData *data, SGModel
|
||||
unsigned int simple_models = 0;
|
||||
osg::PagedLOD *plod = new osg::PagedLOD;
|
||||
|
||||
// establish the error report context so we can attribute any load
|
||||
// errors correctly
|
||||
simgear::ErrorReportContext ec(data->getErrorContext());
|
||||
simgear::ErrorReportContext ec;
|
||||
if (data) {
|
||||
ec.addFromMap(data->getErrorContext());
|
||||
}
|
||||
|
||||
osg::ref_ptr<SGReaderWriterOptions> opt;
|
||||
opt = SGReaderWriterOptions::copyOrCreate(osgDB::Registry::instance()->getOptions());
|
||||
|
Loading…
Reference in New Issue
Block a user