// Copyright (C) 2002-2003 Gideon May (gideon@computer.org) // // Permission to copy, use, sell and distribute this software is granted // provided this copyright notice appears in all copies. // Permission to modify the code and to distribute modified code is granted // provided this copyright notice appears in all copies, and a notice // that the code was modified is included with the copyright notice. // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. #include #include #include #include #include #include #include #include #include "Node.hpp" #include "held_ptr.hpp" using namespace boost::python; namespace { tuple getInterval(osg::Sequence &seq) { osg::Sequence::LoopMode mode; int begin, end; seq.getInterval(mode, begin, end); return make_tuple(mode, begin, end); } tuple getDuration(osg::Sequence &seq) { float speed; int nreps; seq.getDuration(speed, nreps); return make_tuple(speed, nreps); } DEFINE_NODE_CAST(Sequence) } namespace PyOSG { void init_Sequence() { REGISTER_NODE_CAST(Sequence) class_, bases > sequence("Sequence", "Sequence is a Group node which allows automatic, time based\n" "switching between children.", no_init); scope sequence_scope(sequence); sequence.def(init<>()) .def("setValue", &osg::Sequence::setValue) .def("getValue", &osg::Sequence::getValue) .def("setTime", &osg::Sequence::setTime, "Set time in seconds for child") .def("getTime", &osg::Sequence::getTime, "Get time for child") .def("setInterval", &osg::Sequence::setInterval, "Set sequence mode & interval.") .def("getInterval", &getInterval, "Get sequence mode & interval.") .def("setDuration", &osg::Sequence::setDuration, "Set duration: speed-up & number of repeats") .def("getDuration", &getDuration, "Get duration") .def("setMode", &osg::Sequence::setMode, "Set sequence mode. Start/stop & pause/resume.") .def("getMode", &osg::Sequence::getMode, "Get sequence mode.") ; # define OSG_ENUM_LOOP(VALUE) \ (loop.value(#VALUE, osg::Sequence::VALUE), \ sequence.def(#VALUE, object(osg::Sequence::VALUE))) enum_ loop("LoopMode"); OSG_ENUM_LOOP(LOOP); OSG_ENUM_LOOP(SWING); # define OSG_ENUM_SEQUENCE(VALUE) \ (mode.value(#VALUE, osg::Sequence::VALUE), \ sequence.def(#VALUE, object(osg::Sequence::VALUE))) enum_ mode("SequenceMode"); OSG_ENUM_SEQUENCE(START); OSG_ENUM_SEQUENCE(STOP); OSG_ENUM_SEQUENCE(PAUSE); OSG_ENUM_SEQUENCE(RESUME); } }