#include <osgDB/ReadFile>
#include <simgear/debug/logstream.hxx>
+#include <simgear/structure/OSGVersion.hxx>
#include "modellib.hxx"
#include "SGReaderWriterXMLOptions.hxx"
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), opts->getPropRoot(),
+ this);
}
return true;
}
void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp)
{
- //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" << getFileName(getNumChildren()) << ")");
- setTimeStamp(getNumChildren(),0);
+ //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" <<
+ //getFileName(getNumChildren()) << ")");
+ unsigned childNum = getNumChildren();
+ setTimeStamp(childNum, 0);
double priority=1.0;
- dbp->requestNodeFile(getFileName(getNumChildren()),this,priority,0, _readerWriterOptions.get());
+ dbp->requestNodeFile(getFileName(childNum),this,priority,0,
+ getDatabaseRequest(childNum),
+ _readerWriterOptions.get());
}