1
0
Fork 0

fgviewer: Improove reader/writer option command line handling.

This commit is contained in:
Mathias Froehlich 2011-12-17 08:28:33 +01:00
parent 33630ffe33
commit 7d1372cae0

View file

@ -171,13 +171,18 @@ main(int argc, char** argv)
} }
simgear::SGModelLib::init(fg_root, props); simgear::SGModelLib::init(fg_root, props);
// The file path list must be set in the registry. // Set up the reader/writer options
osgDB::Registry::instance()->getDataFilePathList() = filePathList; osg::ref_ptr<simgear::SGReaderWriterOptions> options;
if (osgDB::Options* ropt = osgDB::Registry::instance()->getOptions())
simgear::SGReaderWriterOptions* options = new simgear::SGReaderWriterOptions; options = new simgear::SGReaderWriterOptions(*ropt);
else
options = new simgear::SGReaderWriterOptions;
options->getDatabasePathList() = filePathList; options->getDatabasePathList() = filePathList;
options->setMaterialLib(ml); options->setMaterialLib(ml);
options->setPropertyNode(props); options->setPropertyNode(props);
options->setPluginStringData("SimGear::FG_ROOT", fg_root);
options->setPluginStringData("SimGear::FG_SCENERY", fg_scenery);
osgDB::Registry::instance()->setOptions(options.get());
// Here, all arguments are processed // Here, all arguments are processed
arguments.reportRemainingOptionsAsUnrecognized(); arguments.reportRemainingOptionsAsUnrecognized();
@ -185,7 +190,7 @@ main(int argc, char** argv)
// read the scene from the list of file specified command line args. // read the scene from the list of file specified command line args.
osg::ref_ptr<osg::Node> loadedModel; osg::ref_ptr<osg::Node> loadedModel;
loadedModel = osgDB::readNodeFiles(arguments, options); loadedModel = osgDB::readNodeFiles(arguments, options.get());
// if no model has been successfully loaded report failure. // if no model has been successfully loaded report failure.
if (!loadedModel.valid()) { if (!loadedModel.valid()) {