From: frohlich Date: Sat, 16 May 2009 17:46:12 +0000 (+0000) Subject: Attach the ModelData to the options instead of the userdata field. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e45912fd8ad5d20a4708c7a44cf50dc2d6351732;p=simgear.git Attach the ModelData to the options instead of the userdata field. Modified Files: simgear/scene/model/SGPagedLOD.cxx simgear/scene/model/SGReaderWriterXML.cxx --- diff --git a/simgear/scene/model/SGPagedLOD.cxx b/simgear/scene/model/SGPagedLOD.cxx index b45af204..8debb8d1 100644 --- a/simgear/scene/model/SGPagedLOD.cxx +++ b/simgear/scene/model/SGPagedLOD.cxx @@ -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 d = dynamic_cast(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(_readerWriterOptions.get()); + if(opts) { - SGReaderWriterXMLOptions *o=dynamic_cast(_readerWriterOptions.get()); - if(o) - { - d = o->getModelData(); - if(d.valid()) - d->modelLoaded(getFileName(getNumChildren()-1), 0, this); - } + osg::ref_ptr d = opts->getModelData(); + if(d.valid()) + d->modelLoaded(getFileName(getNumChildren()-1), 0, this); } return true; } diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index abdac8d0..7a3660f6 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -179,9 +179,8 @@ sgLoad3DModel_internal(const string &path, copyProperties(mp, prop_root); } - osg::ref_ptr options - = new osgDB::ReaderWriter::Options(*osgDB::Registry::instance() - ->getOptions()); + osg::ref_ptr 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 animation_nodes;