Model loading; overlay properties earlier

This is to permit an <overlay> section in <model> 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;

    <model>
        <overlay>
            <texture-file>island_68.png</texture-file>
            <carrier-name>Nimitz</carrier-name>
            <carrier-registration>CVN-68</carrier-registration>
        </overlay>
        <path>nimitz-class.xml</path>
    </model>
This commit is contained in:
Richard Harrison 2020-11-21 12:16:40 +01:00
parent e2596eaeea
commit 2cb6499f1c

View File

@ -528,6 +528,9 @@ sgLoad3DModel_internal(const SGPath& path,
// Check for an XML wrapper
if (modelpath.extension() == "xml") {
try {
if (overlay)
copyProperties(overlay, props);
readProperties(modelpath, props);
} catch (const sg_exception &t) {
SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load xml: "
@ -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);
}