// Copyright (C) 2002-2005 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. // // Not complete - but missing ones probably not needed // // Removed two functions for OSG-0.9.6 build - brett hartshorn // updated for osg cvs may 7th 2004, brett hartshorn // updated for OSG CVS july 6th 2004 by brett hartshorn // Updated for OSG 0.9.7 brett #include #include #include #include #include #include #include #include #include "held_ptr.hpp" #ifdef _STLP_DEBUG #error "_STLP_DEBUG shouldn't be defined" #endif using namespace boost::python; namespace PyOSG { void init_AnimationPath() { class_, bases, boost::noncopyable> animation_path("AnimationPath", "AnimationPath for specify the time varying transformation pathway to use when update camera and model objects.\n" "Subclassed from Transform.ComputeTransformCallback allows AnimationPath to\n" "be attached directly to Transform nodes to move subgraphs around the scene.\n", no_init); { scope animation_path_scope(animation_path); // TODO: TimeControlPointMap access - not essential animation_path .def(init<>()) .def("getMatrix", (bool (osg::AnimationPath::*)(double, osg::Matrixf&) const) &osg::AnimationPath::getMatrix, "getMatrix(time, matrix) -> bool\n\n" "Return the matrix transformation for the given time.\n" "getMatrix returns True if successful, False otherwise\n") .def("getMatrix", (bool (osg::AnimationPath::*)(double, osg::Matrixd&) const) &osg::AnimationPath::getMatrix) .def("getInverse", (bool (osg::AnimationPath::*)(double, osg::Matrixf&) const) &osg::AnimationPath::getInverse, "getInverse(time, matrix) -> bool\n\n" "Get the inverse transformation matrix for a point in time." ) .def("getInverse", (bool (osg::AnimationPath::*)(double, osg::Matrixd&) const) &osg::AnimationPath::getInverse) .def("getInterpolatedControlPoint", &osg::AnimationPath::getInterpolatedControlPoint) .def("insert", &osg::AnimationPath::insert) .def("getFirstTime", &osg::AnimationPath::getFirstTime) .def("getLastTime", &osg::AnimationPath::getLastTime) .def("getPeriod", &osg::AnimationPath::getPeriod) .def("setLoopMode", &osg::AnimationPath::setLoopMode) .def("getLoopMode", &osg::AnimationPath::getLoopMode) .def("empty", &osg::AnimationPath::empty) .def("read", &osg::AnimationPath::read) .def("write", &osg::AnimationPath::write) ; enum_ loop_mode("LoopMode"); # define OSG_ENUM(VALUE) \ (loop_mode.value(#VALUE, osg::AnimationPath::VALUE), \ animation_path.def(#VALUE, object(osg::AnimationPath::VALUE))) OSG_ENUM(SWING); OSG_ENUM(LOOP); OSG_ENUM(NO_LOOPING); class_("ControlPoint") .def(init()) .def(init()) .def(init()) .def("setPosition", &osg::AnimationPath::ControlPoint::setPosition) .def("getPosition", &osg::AnimationPath::ControlPoint::getPosition, return_value_policy()) .def("setRotation", &osg::AnimationPath::ControlPoint::setRotation) .def("getRotation", &osg::AnimationPath::ControlPoint::getRotation, return_value_policy()) .def("setScale", &osg::AnimationPath::ControlPoint::setScale) .def("getScale", &osg::AnimationPath::ControlPoint::getScale, return_value_policy()) .def("interpolate", (void (osg::AnimationPath::ControlPoint::*) (float ratio, const osg::AnimationPath::ControlPoint&, const osg::AnimationPath::ControlPoint&)) &osg::AnimationPath::ControlPoint::interpolate) .def("interpolate", (void (osg::AnimationPath::ControlPoint::*) (double ratio, const osg::AnimationPath::ControlPoint&, const osg::AnimationPath::ControlPoint&)) &osg::AnimationPath::ControlPoint::interpolate) .def("getMatrix", (void (osg::AnimationPath::ControlPoint::*)(osg::Matrixd&) const) &osg::AnimationPath::ControlPoint::getMatrix) .def("getInverse", (void (osg::AnimationPath::ControlPoint::*)(osg::Matrixd&) const) &osg::AnimationPath::ControlPoint::getInverse) ; } // TODO: Make subclassable from python with apply method, and member access class_, bases, boost::noncopyable> animation_path_callback("AnimationPathCallback", no_init); animation_path_callback .def(init<>()) .def(init()) .def(init()) .def(init()) .def(init()) .def("setAnimationPath", &osg::AnimationPathCallback::setAnimationPath) .def("getAnimationPath", (osg::AnimationPath * (osg::AnimationPathCallback::*)()) &osg::AnimationPathCallback::getAnimationPath, return_value_policy()) .def("setPivotPoint", &osg::AnimationPathCallback::setPivotPoint) .def("getPivotPoint", &osg::AnimationPathCallback::getPivotPoint, return_value_policy()) .def("setUseInverseMatrix", &osg::AnimationPathCallback::setUseInverseMatrix) .def("getUseInverseMatrix", &osg::AnimationPathCallback::getUseInverseMatrix) .def("setTimeOffset", &osg::AnimationPathCallback::setTimeOffset) .def("getTimeOffset", &osg::AnimationPathCallback::getTimeOffset) .def("setTimeMultiplier", &osg::AnimationPathCallback::setTimeMultiplier) .def("getTimeMultiplier", &osg::AnimationPathCallback::getTimeMultiplier) .def("reset", &osg::AnimationPathCallback::reset) .def("setPause", &osg::AnimationPathCallback::setPause) .def("getAnimationTime", &osg::AnimationPathCallback::getAnimationTime) .def("update", &osg::AnimationPathCallback::update) ; } } // namespace PyOSG