From c2416e48c19a5745bf37c4f1ba8d28a9208fc6b3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 12 Jan 2007 15:08:45 +0000 Subject: [PATCH] Added support for animation path manipulator to osgViewer path --- applications/osgviewer/osgviewer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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() ); }