Commit e11d5c9b authored by Jan Möbius's avatar Jan Möbius

Added Python scriptable project function

parent 283a1702
......@@ -234,6 +234,11 @@ PYBIND11_EMBEDDED_MODULE(ViewControl, m) {
QCoreApplication::translate("PythonDocViewControl","Enable or disable two sided lighting.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocViewControl","Specifies whether to enable or disable two sided lighting.").toLatin1().data()) );
view.def("project", &ViewControlPlugin::project,
QCoreApplication::translate("PythonDocViewControl","Use the projection matrix of the given viewer to project the point").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocViewControl","Coordinates of a point").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocViewControl","ViewerId").toLatin1().data()) = 0 );
//
// emit setSlotDescription("setObjectDrawMode(QString,int,bool)", "Set the drawMode for an object",
// QString("DrawMode,ObjectID,Force").split(","),
......
......@@ -1447,6 +1447,10 @@ void ViewControlPlugin::setTwoSidedLighting(bool _enabled) {
PluginFunctions::viewerProperties().twoSidedLighting(_enabled);
}
ACG::Vec3d ViewControlPlugin::project(ACG::Vec3d _point, int _viewerId) {
ACG::GLState& state = PluginFunctions::viewerProperties(_viewerId).glState();
return state.project(_point);
}
void ViewControlPlugin::setDescriptions() {
emit setSlotDescription("translate(Vector,int)", "Translate Scene",
......
......@@ -352,6 +352,9 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
void setTwoSidedLighting(bool _enabled);
/// Use the projection matrix of the given viewer to project the point
ACG::Vec3d project(ACG::Vec3d _point, int _viewerId = 0);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment