From ddc4b1d8690a4de9b99ca1846b9b9649ac021600 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Fri, 29 Oct 2021 12:54:12 -0700 Subject: [PATCH] Add python binding for global lighting setting (#1615) --- CHANGELOG.md | 8 +++++++- package.xml | 2 +- python/dartpy/gui/osg/Viewer.cpp | 14 +++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dbe466913006..ebb89172ebec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ ## DART 6 +### [DART 6.11.2 (2021-10-29)](https://github.com/dartsim/dart/milestone/68?closed=1) + +* dartpy + + * Added Python binding for global lighting mode setting: [#1615](https://github.com/dartsim/dart/pull/1615) + ### [DART 6.11.1 (2021-08-23)](https://github.com/dartsim/dart/milestone/67?closed=1) * Dynamics - * Fixed incorrect LCP construction in JointConstraint for multi-DOFs joints : [#1597](https://github.com/dartsim/dart/pull/1597) + * Fixed incorrect LCP construction in JointConstraint for multi-DOFs joints: [#1597](https://github.com/dartsim/dart/pull/1597) ### [DART 6.11.0 (2021-07-15)](https://github.com/dartsim/dart/milestone/64?closed=1) diff --git a/package.xml b/package.xml index 488c8e96c2af8..9b6814eff14c2 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ a Catkin workspace. Catkin is not required to build DART. For more information, see: http://ros.org/reps/rep-0136.html --> dartsim - 6.11.1 + 6.11.2 DART (Dynamic Animation and Robotics Toolkit) is a collaborative, cross-platform, open source library created by the Georgia Tech Graphics diff --git a/python/dartpy/gui/osg/Viewer.cpp b/python/dartpy/gui/osg/Viewer.cpp index 6448702b2030e..cee2ac5d33073 100644 --- a/python/dartpy/gui/osg/Viewer.cpp +++ b/python/dartpy/gui/osg/Viewer.cpp @@ -53,7 +53,7 @@ void Viewer(py::module& m) }, ::py::arg("eventHandler")); - ::py::class_< + auto viewer = ::py::class_< dart::gui::osg::Viewer, osgViewer::View, dart::common::Subject, @@ -131,6 +131,13 @@ void Viewer(py::module& m) +[](const dart::gui::osg::Viewer* self) -> bool { return self->checkHeadlights(); }) + .def( + "setLightingMode", + &dart::gui::osg::Viewer::setLightingMode, + ::py::arg("lightingMode")) + .def( + "getLightingMode", + &dart::gui::osg::Viewer::getLightingMode) .def( "addWorldNode", +[](dart::gui::osg::Viewer* self, @@ -350,6 +357,11 @@ void Viewer(py::module& m) self->setCameraManipulator(self->getCameraManipulator()); }); + + ::py::enum_(viewer, "LightingMode") + .value("NO_LIGHT", dart::gui::osg::Viewer::NO_LIGHT) + .value("HEADLIGHT", dart::gui::osg::Viewer::HEADLIGHT) + .value("SKY_LIGHT", dart::gui::osg::Viewer::SKY_LIGHT); } // namespace python } // namespace python