From 2cb6499f1ce16d9adcab8fca3766069e4ed61a65 Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Sat, 21 Nov 2020 12:16:40 +0100 Subject: [PATCH] Model loading; overlay properties earlier This is to permit an section in to be present whilst the rest of the model is loaded - otherwise the overlay is only present after the model is loaded; e.g. to allow a model specific registration to be applied to a shared model; island_68.png Nimitz CVN-68 nimitz-class.xml --- simgear/scene/model/SGReaderWriterXML.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index 1a7ea435..9b1a9780 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -528,7 +528,10 @@ sgLoad3DModel_internal(const SGPath& path, // Check for an XML wrapper if (modelpath.extension() == "xml") { try { - readProperties(modelpath, props); + if (overlay) + copyProperties(overlay, props); + + readProperties(modelpath, props); } catch (const sg_exception &t) { SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load xml: " << t.getFormattedMessage()); @@ -538,9 +541,6 @@ sgLoad3DModel_internal(const SGPath& path, addTooltipAnimations(path, props, model, options->getAutoTooltipsMasterMax()); } - if (overlay) - copyProperties(overlay, props); - if (previewMode && props->hasChild("nopreview")) { return std::make_tuple(0, (osg::Node *) NULL); }