diff --git a/applications/osgviewer/osgviewer.cpp b/applications/osgviewer/osgviewer.cpp index 56955dcc7..49bfd9c25 100644 --- a/applications/osgviewer/osgviewer.cpp +++ b/applications/osgviewer/osgviewer.cpp @@ -138,7 +138,7 @@ int main_osgProducer(osg::ArgumentParser& arguments) #include #include #include - +#include int main_osgViewer(osg::ArgumentParser& arguments) { @@ -152,6 +152,19 @@ int main_osgViewer(osg::ArgumentParser& arguments) keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); + std::string pathfile; + osg::ref_ptr apm = 0; + while (arguments.read("-p",pathfile)) + { + osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); + if (apm || !apm->valid()) + { + unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); + keyswitchManipulator->addMatrixManipulator( '4', "Path", apm ); + keyswitchManipulator->selectMatrixManipulator(num); + } + } + viewer.setCameraManipulator( keyswitchManipulator.get() ); }