Attach the ModelData to the options instead of the userdata field.

Modified Files:
	simgear/scene/model/SGPagedLOD.cxx
	simgear/scene/model/SGReaderWriterXML.cxx
This commit is contained in:
frohlich
2009-05-16 17:46:12 +00:00
committed by Tim Moore
parent 56c4ba67c6
commit e45912fd8a
2 changed files with 9 additions and 16 deletions

View File

@@ -50,19 +50,13 @@ bool SGPagedLOD::addChild(osg::Node *child)
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;
}

View File

@@ -179,9 +179,8 @@ sgLoad3DModel_internal(const string &path,
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.
@@ -311,7 +310,7 @@ sgLoad3DModel_internal(const string &path,
if (data) {
data->setProps(props);
group->setUserData(data);
options->setModelData(data);
}
std::vector<SGPropertyNode_ptr> animation_nodes;