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:
@@ -528,7 +528,10 @@ sgLoad3DModel_internal(const SGPath& path,
|
|||||||
// Check for an XML wrapper
|
// Check for an XML wrapper
|
||||||
if (modelpath.extension() == "xml") {
|
if (modelpath.extension() == "xml") {
|
||||||
try {
|
try {
|
||||||
readProperties(modelpath, props);
|
if (overlay)
|
||||||
|
copyProperties(overlay, props);
|
||||||
|
|
||||||
|
readProperties(modelpath, props);
|
||||||
} catch (const sg_exception &t) {
|
} catch (const sg_exception &t) {
|
||||||
SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load xml: "
|
SG_LOG(SG_IO, SG_DEV_ALERT, "Failed to load xml: "
|
||||||
<< t.getFormattedMessage());
|
<< t.getFormattedMessage());
|
||||||
@@ -538,9 +541,6 @@ sgLoad3DModel_internal(const SGPath& path,
|
|||||||
addTooltipAnimations(path, props, model, options->getAutoTooltipsMasterMax());
|
addTooltipAnimations(path, props, model, options->getAutoTooltipsMasterMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlay)
|
|
||||||
copyProperties(overlay, props);
|
|
||||||
|
|
||||||
if (previewMode && props->hasChild("nopreview")) {
|
if (previewMode && props->hasChild("nopreview")) {
|
||||||
return std::make_tuple(0, (osg::Node *) NULL);
|
return std::make_tuple(0, (osg::Node *) NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user