setRadius(getBound().radius());
setCenter(getBound().center());
- // if the model was an .xml-file it will have UserData set
- osg::ref_ptr<SGModelData> d = dynamic_cast<SGModelData*>(child->getUserData());
- if (d.valid())
- d->modelLoaded(getFileName(getNumChildren()-1), d->getProperties(), this);
- else // this calls modelLoaded for non-xml models
+ SGReaderWriterXMLOptions* opts;
+ opts = dynamic_cast<SGReaderWriterXMLOptions*>(_readerWriterOptions.get());
+ if(opts)
{
- SGReaderWriterXMLOptions *o=dynamic_cast<SGReaderWriterXMLOptions*>(_readerWriterOptions.get());
- if(o)
- {
- d = o->getModelData();
- if(d.valid())
- d->modelLoaded(getFileName(getNumChildren()-1), 0, this);
- }
+ osg::ref_ptr<SGModelData> d = opts->getModelData();
+ if(d.valid())
+ d->modelLoaded(getFileName(getNumChildren()-1), 0, this);
}
return true;
}
copyProperties(mp, prop_root);
}
- osg::ref_ptr<osgDB::ReaderWriter::Options> options
- = new osgDB::ReaderWriter::Options(*osgDB::Registry::instance()
- ->getOptions());
+ osg::ref_ptr<SGReaderWriterXMLOptions> options
+ = new SGReaderWriterXMLOptions(*osgDB::Registry::instance()->getOptions());
// Assume that textures are in
// the same location as the XML file.
if (data) {
data->setProps(props);
- group->setUserData(data);
+ options->setModelData(data);
}
std::vector<SGPropertyNode_ptr> animation_nodes;