// 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. #include #include #include #include #include #include #include #include #include #include #include "Transform.hpp" #include "held_ptr.hpp" using namespace boost::python; namespace { DEFINE_TRANSFORM_CAST(AutoTransform) } namespace PyOSG { void init_AutoTransform() { REGISTER_TRANSFORM_CAST(AutoTransform) class_, bases, boost::noncopyable > atransform("AutoTransform", "AutoTransform - is a subclass of Transform which has an osg::Matrix\n" "which represent a 4x4 transformation of its children from local cordinates\n" "into the Transform's parent coordinates.\n", no_init); scope autotransform_scope(atransform); atransform .def(init<>()) .def("setPosition", &osg::AutoTransform::setPosition) .def("getPosition", &osg::AutoTransform::getPosition, return_value_policy()) .def("setRotation", &osg::AutoTransform::setRotation) .def("getRotation", &osg::AutoTransform::getRotation, return_value_policy()) .def("setScale", (void (osg::AutoTransform::*)(float)) &osg::AutoTransform::setScale) .def("setScale", (void (osg::AutoTransform::*)(const osg::Vec3&)) &osg::AutoTransform::setScale) .def("getScale", &osg::AutoTransform::getScale, return_value_policy()) .def("setPivotPoint", &osg::AutoTransform::setPivotPoint) .def("getPivotPoint", &osg::AutoTransform::getPivotPoint, return_value_policy()) .def("setAutoUpdateEyeMovementTolerance", &osg::AutoTransform::setAutoUpdateEyeMovementTolerance) .def("getAutoUpdateEyeMovementTolerance", &osg::AutoTransform::getAutoUpdateEyeMovementTolerance) .def("setAutoRotateMode", &osg::AutoTransform::setAutoRotateMode) .def("getAutoRotateMode", &osg::AutoTransform::getAutoRotateMode) .def("setAutoScaleToScreen", &osg::AutoTransform::setAutoScaleToScreen) .def("getAutoScaleToScreen", &osg::AutoTransform::getAutoScaleToScreen) .def("computeLocalToWorldMatrix", &osg::AutoTransform::computeLocalToWorldMatrix) .def("computeWorldToLocalMatrix", &osg::AutoTransform::computeWorldToLocalMatrix) ; # define OSG_ENUM_MODE(VALUE) \ (rot_mode.value(#VALUE, osg::AutoTransform::VALUE), \ atransform.def(#VALUE, object(osg::AutoTransform::VALUE))) enum_ rot_mode("AutoRotateMode"); OSG_ENUM_MODE(NO_ROTATION); OSG_ENUM_MODE(ROTATE_TO_SCREEN); OSG_ENUM_MODE(ROTATE_TO_CAMERA); } }