SGSharedPtr<SGPropertyNode> prop_root;
osg::Node *(*load_panel)(SGPropertyNode *)=0;
- SGModelData *data=0;
+ osg::ref_ptr<SGModelData> data;
if (xmlOptions) {
prop_root = xmlOptions->getPropRoot();
}
osg::ref_ptr<SGReaderWriterXMLOptions> options
- = new SGReaderWriterXMLOptions(*osgDB::Registry::instance()->getOptions());
+ = new SGReaderWriterXMLOptions(*options_);
+ options->setPropRoot(prop_root);
+ options->setLoadPanel(load_panel);
// Assume that textures are in
// the same location as the XML file.
} else {
submodelpath = submodelFileName;
}
+ osg::ref_ptr<SGReaderWriterXMLOptions> options;
+ options = new SGReaderWriterXMLOptions(*options_);
+ options->setPropRoot(prop_root);
+ options->setLoadPanel(load_panel);
try {
- submodel = sgLoad3DModel_internal(submodelpath.str(), options_,
+ submodel = sgLoad3DModel_internal(submodelpath.str(), options.get(),
sub_props->getNode("overlay"));
} catch (const sg_throwable &t) {
SG_LOG(SG_INPUT, SG_ALERT, "Failed to load submodel: " << t.getFormattedMessage());
options.get()));
}
- if (data) {
- data->setConfigProperties(props);
- options->setModelData(data);
- }
-
std::vector<SGPropertyNode_ptr> animation_nodes;
animation_nodes = props->getChildren("animation");
for (unsigned i = 0; i < animation_nodes.size(); ++i)
if (!needTransform && group->getNumChildren() < 2) {
model = group->getChild(0);
group->removeChild(model.get());
- model->setUserData(group->getUserData());
+ if (data.valid())
+ data->modelLoaded(modelpath.str(), props, model.get());
return model.release();
}
+ if (data.valid())
+ data->modelLoaded(modelpath.str(), props, group.get());
if (props->hasChild("debug-outfile")) {
std::string outputfile = props->getStringValue("debug-outfile",
"debug-model.osg");