Show
Ignore:
Timestamp:
02/25/07 21:05:23 (8 years ago)
Author:
robert
Message:

Further work on add serialization support for osgViewer configurations

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgcamera/osgcamera.cpp

    r6101 r6275  
    22 
    33#include <osgDB/ReadFile> 
     4#include <osgDB/WriteFile> 
    45#include <osgViewer/Viewer> 
    56#include <osgGA/TrackballManipulator> 
     
    265266    else viewer.setCameraManipulator( new osgGA::TrackballManipulator() ); 
    266267 
     268    std::string configfile; 
     269    while (arguments.read("--config", configfile)) 
     270    { 
     271        osg::notify(osg::NOTICE)<<"Trying to read config file "<<configfile<<std::endl; 
     272        osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(configfile); 
     273        osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get()); 
     274        if (view) 
     275        { 
     276            osg::notify(osg::NOTICE)<<"Read config file succesfully"<<std::endl; 
     277        } 
     278        else 
     279        { 
     280            osg::notify(osg::NOTICE)<<"Failed to read config file : "<<configfile<<std::endl; 
     281            return 1; 
     282        } 
     283    } 
     284 
     285    while (arguments.read("--write-config", configfile)) { osgDB::writeObjectFile(viewer, configfile); } 
     286 
    267287 
    268288#if 0