Gui: Added Gui.doc.view.viewer.setBackgroundColor() py method
This commit is contained in:
@@ -75,6 +75,8 @@ void View3DInventorViewerPy::init_type()
|
||||
"getPickRadius(): returns radius of confusion in pixels for picking objects on screen (selection).");
|
||||
add_varargs_method("setPickRadius", &View3DInventorViewerPy::setPickRadius,
|
||||
"setPickRadius(new_radius): sets radius of confusion in pixels for picking objects on screen (selection).");
|
||||
add_varargs_method("setBackgroundColor", &View3DInventorViewerPy::setBackgroundColor,
|
||||
"setBackgroundColor(r,g,b): sets the background color of the current viewer.");
|
||||
add_varargs_method("setRedirectToSceneGraph", &View3DInventorViewerPy::setRedirectToSceneGraph,
|
||||
"setRedirectToSceneGraph(bool): enables or disables to redirect events directly to the scene graph.");
|
||||
add_varargs_method("isRedirectedToSceneGraph", &View3DInventorViewerPy::isRedirectedToSceneGraph,
|
||||
@@ -363,6 +365,28 @@ Py::Object View3DInventorViewerPy::setPickRadius(const Py::Tuple& args)
|
||||
}
|
||||
}
|
||||
|
||||
Py::Object View3DInventorViewerPy::setBackgroundColor(const Py::Tuple& args)
|
||||
{
|
||||
float r,g,b = 0.0;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "fff", &r, &g, &b)) {
|
||||
throw Py::Exception();
|
||||
}
|
||||
try {
|
||||
SbColor col(r,g,b);
|
||||
_viewer->setGradientBackgroundColor(col,col);
|
||||
return Py::None();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
throw Py::RuntimeError(e.what());
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
throw Py::RuntimeError(e.what());
|
||||
}
|
||||
catch(...) {
|
||||
throw Py::RuntimeError("Unknown C++ exception");
|
||||
}
|
||||
}
|
||||
|
||||
Py::Object View3DInventorViewerPy::setRedirectToSceneGraph(const Py::Tuple& args)
|
||||
{
|
||||
PyObject* m=Py_False;
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
Py::Object getPickRadius(const Py::Tuple& args);
|
||||
Py::Object setPickRadius(const Py::Tuple& args);
|
||||
|
||||
Py::Object setBackgroundColor(const Py::Tuple& args);
|
||||
Py::Object setRedirectToSceneGraph(const Py::Tuple& args);
|
||||
Py::Object isRedirectedToSceneGraph(const Py::Tuple& args);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user