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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user