// 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 #include #include #include #include "Node.hpp" #include "held_ptr.hpp" using namespace boost::python; namespace { tuple getValueList(osg::Switch &sw) { list values; for (osg::Switch::ValueList::const_iterator iter = sw.getValueList().begin(); iter != sw.getValueList().end(); iter++) { values.append(*iter); } return tuple(values); } DEFINE_NODE_CAST(Switch) } namespace PyOSG { void init_Switch() { REGISTER_NODE_CAST(Switch) class_, bases > swtch("Switch", "Switch is a Group node which allows switching between children.\n" "Typical uses would be for objects which might need to be rendered\n" "differently at different times, for instance a switch could be used \n" "to represent the different states of a traffic light.", no_init); scope switch_scope(swtch); swtch.def(init<>()) .def("setNewChildDefaultValue", &osg::Switch::setNewChildDefaultValue, "setNewChildDefaultValue(value) -> None\n") .def("getNewChildDefaultValue", &osg::Switch::getNewChildDefaultValue, "getNewChildDefaultValue() -> bool\n") .def("addChild", (bool (osg::Switch::*)(osg::Node *)) &osg::Switch::addChild, "addChild(node) -> bool\n") .def("addChild", (bool (osg::Switch::*)(osg::Node *, bool)) &osg::Switch::addChild, "addChild(node, value) -> bool\n") .def("insertChild", (bool (osg::Switch::*)(unsigned int, osg::Node *)) &osg::Switch::insertChild, "insertChild(index, node) -> bool\n") .def("insertChild", (bool (osg::Switch::*)(unsigned int, osg::Node *, bool)) &osg::Switch::insertChild, "insertChild(index, node, value) -> bool\n") .def("removeChild", (bool (osg::Switch::*)(osg::Node*)) &osg::Switch::removeChild) .def("removeChild", (bool (osg::Switch::*)(unsigned int, unsigned int)) &osg::Switch::removeChild) .def("setValue", (void (osg::Switch::*)(unsigned int, bool)) &osg::Switch::setValue) .def("getValue", (bool (osg::Switch::*)(unsigned int) const) &osg::Switch::getValue) .def("setChildValue", &osg::Switch::setChildValue) .def("getChildValue", &osg::Switch::getChildValue) .def("setAllChildrenOff", &osg::Switch::setAllChildrenOff, "Set all the children off (false), and set the new default child value to off (false).") .def("setAllChildrenOn", &osg::Switch::setAllChildrenOn, "Set all the children on (true), and set the new default child value to on (true).") .def("setSingleChildOn", &osg::Switch::setSingleChildOn, "Set a single child to be on, switch off all other children.") .def("getValueList", &getValueList); ; } }