43#include <pybind11/pybind11.h>
44#include <pybind11/embed.h>
47#include <ViewControlPlugin.hh>
48#include <OpenFlipper/BasePlugin/PythonFunctions.hh>
49#include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh>
51namespace py = pybind11;
55PYBIND11_EMBEDDED_MODULE(ViewControl, m) {
57 QObject* pluginPointer = getPluginPointer(
"ViewControl");
60 std::cerr <<
"Error Getting plugin pointer for Plugin-ViewControl" << std::endl;
67 std::cerr <<
"Error converting plugin pointer for Plugin-ViewControl" << std::endl;
73 py::class_< ViewControlPlugin,std::unique_ptr<ViewControlPlugin, py::nodelete> > view(m,
"ViewControl");
78 view.def(py::init([plugin]() {
return plugin; }));
83 QCoreApplication::translate(
"PythonDocViewControl",
"For meshes returns if the selection for this object is visible").toLatin1().data(),
84 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"ID of the mesh object").toLatin1().data()) );
87 QCoreApplication::translate(
"PythonDocViewControl",
"For meshes show or hide the selection.").toLatin1().data(),
88 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"ID of the mesh object").toLatin1().data()),
89 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Visible or not?").toLatin1().data()) );
92 QCoreApplication::translate(
"PythonDocViewControl",
"For meshes returns if the modeling area for this object is visible").toLatin1().data(),
93 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"ID of the mesh object").toLatin1().data()) );
96 QCoreApplication::translate(
"PythonDocViewControl",
"For meshes show or hide the modeling area.").toLatin1().data(),
97 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"ID of the mesh object").toLatin1().data()),
98 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Visible or not?").toLatin1().data()) );
101 QCoreApplication::translate(
"PythonDocViewControl",
"For meshes set the line width of selections.").toLatin1().data(),
102 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"ID of the mesh object").toLatin1().data()),
103 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Line width to set").toLatin1().data()) );
106 QCoreApplication::translate(
"PythonDocViewControl",
"For meshes set the line width of features.").toLatin1().data(),
107 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"ID of the mesh object").toLatin1().data()),
108 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Line width to set").toLatin1().data()) );
147 QCoreApplication::translate(
"PythonDocViewControl",
"Set the viewing direction").toLatin1().data(),
148 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewing Direction").toLatin1().data()),
149 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Up vector").toLatin1().data()),
150 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to set viewing direction (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
153 QCoreApplication::translate(
"PythonDocViewControl",
"Set scene radius").toLatin1().data(),
154 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Radius").toLatin1().data()),
155 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to set radius (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
158 QCoreApplication::translate(
"PythonDocViewControl",
"Rotate scene").toLatin1().data(),
159 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Rotation axis").toLatin1().data()),
160 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Rotation angle").toLatin1().data()),
161 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Rotation center").toLatin1().data()),
162 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to rotate (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
166 QCoreApplication::translate(
"PythonDocViewControl",
"Translate scene").toLatin1().data(),
167 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Translation vector").toLatin1().data()),
168 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to translate (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
171 QCoreApplication::translate(
"PythonDocViewControl",
"Set the draw mode of a viewer").toLatin1().data(),
172 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"List of draw modes ( ; separated list ) ").toLatin1().data()),
173 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to set draw mode (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
176 QCoreApplication::translate(
"PythonDocViewControl",
" This function can be used to set the drawmode for an object.").toLatin1().data(),
177 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"List of draw modes ( ; separated list ) ").toLatin1().data()),
178 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Object ID to set the drawmode on.").toLatin1().data()),
179 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Set the draw mode even if its not directly supported by the objects nodes").toLatin1().data()) =
true);
182 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current viewing direction").toLatin1().data(),
183 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get viewing direction from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
186 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current upVector").toLatin1().data(),
187 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get upVector from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
190 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current eyePosition").toLatin1().data(),
191 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get eyePosition from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
194 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current sceneCenter").toLatin1().data(),
195 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get scene center from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
198 QCoreApplication::translate(
"PythonDocViewControl",
"Set the scene center").toLatin1().data(),
199 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Coordinates of center?").toLatin1().data()),
200 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to change (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
203 QCoreApplication::translate(
"PythonDocViewControl",
"Enable or disable Backface culling").toLatin1().data(),
204 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Enable?").toLatin1().data()),
205 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to change (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
207 view.def(
"setEyePosition", &ViewControlPlugin::setEyePosition),
208 QCoreApplication::translate(
"PythonDocViewControl",
"Change the Eye position to the given value").toLatin1().data(),
209 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Eye position").toLatin1().data()) ;
212 QCoreApplication::translate(
"PythonDocViewControl",
"Change View in all viewers to view whole scene").toLatin1().data());
214 QCoreApplication::translate(
"PythonDocViewControl",
"Change View in given viewer to view whole scene").toLatin1().data(),
215 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer which should be switched").toLatin1().data()) );
218 QCoreApplication::translate(
"PythonDocViewControl",
"Change View on all viewers to view home position").toLatin1().data());
220 QCoreApplication::translate(
"PythonDocViewControl",
"Change View on given viewer to view home position").toLatin1().data(),
221 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer to change").toLatin1().data()) );
224 QCoreApplication::translate(
"PythonDocViewControl",
"Change all Viewers to orthographic projection").toLatin1().data());
226 QCoreApplication::translate(
"PythonDocViewControl",
"Change Viewer to orthographic projection").toLatin1().data(),
227 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer to change").toLatin1().data()) );
230 QCoreApplication::translate(
"PythonDocViewControl",
"Change all Viewers to perspective projection").toLatin1().data());
232 QCoreApplication::translate(
"PythonDocViewControl",
"Change Viewer to perspective projection").toLatin1().data(),
233 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer to change").toLatin1().data()) );
236 QCoreApplication::translate(
"PythonDocViewControl",
"Set fovy angle of projection for all viewers.").toLatin1().data(),
237 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"fovy angle").toLatin1().data()) );
240 QCoreApplication::translate(
"PythonDocViewControl",
"Set the projection mode of the coordinate system.").toLatin1().data(),
241 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"If true, orthogonal projection otherwise perspective projection").toLatin1().data()) );
243 view.def(
"setTwoSidedLighting", &ViewControlPlugin::setTwoSidedLighting,
244 QCoreApplication::translate(
"PythonDocViewControl",
"Enable or disable two sided lighting.").toLatin1().data(),
245 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Specifies whether to enable or disable two sided lighting.").toLatin1().data()) );
248 QCoreApplication::translate(
"PythonDocViewControl",
"Use the projection matrix of the given viewer to project the point").toLatin1().data(),
249 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Coordinates of a point").toLatin1().data()),
250 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"ViewerId").toLatin1().data()) = 0 );
void setSceneCenter(Vector _center, int _viewer=PluginFunctions::ALL_VIEWERS)
Set the scene center.
void showSelection(int _id, bool _state)
Allows to enable/disable visualization of the objects selection for meshes.
void viewAll()
Change View on all viewers to view whole scene.
void setViewingDirection(Vector _direction, Vector _upvector, int _viewer=PluginFunctions::ALL_VIEWERS)
Set the viewing direction.
void translate(Vector _vec, int _viewer=PluginFunctions::ALL_VIEWERS)
translate Scene
void rotate(Vector _axis, double _angle, Vector _center, int _viewer=PluginFunctions::ALL_VIEWERS)
Rotate Scene.
Vector eyePosition(int _viewer=PluginFunctions::ACTIVE_VIEWER)
get a viewers eye Position
void showModelingAreas(int _id, bool _state)
Allows to enable/disable visualization of the objects modeling area for meshes.
Vector upVector(int _viewer=PluginFunctions::ACTIVE_VIEWER)
get a viewers up vector
void setFOVY(double _fovy)
Set fovy angle of projection.
void viewHome()
Change View on given Viewer to view home position.
bool selectionVisible(int _id)
For meshes returns if the selection for this object is visible.
ACG::Vec3d project(ACG::Vec3d _point, int _viewerId=0)
Use the projection matrix of the given viewer to project the point.
void setDrawMode(QString _mode, int _viewer=PluginFunctions::ALL_VIEWERS)
Set the draw mode for a viewer.
Vector viewingDirection(int _viewer=PluginFunctions::ACTIVE_VIEWER)
Get a viewers viewing direction.
bool modelingAreasVisible(int _id)
For meshes returns if the modeling areas for this object is visible.
void setObjectDrawMode(QString _mode, int _objectID, bool _force=true)
Set the draw mode for an object.
void setFeatureLineWidth(int _id, double _width)
Set the line width of the features.
void setCoordsysProjection(bool _orthogonal)
void setSelectionLineWidth(int _id, double _width)
Set the line width of the selections.
void orthographicProjection()
Change Viewer to orthographicProjection.
void setSceneRadius(double _radius, int _viewer=PluginFunctions::ALL_VIEWERS)
Set scene radius.
void enableBackfaceCulling(bool _state, int _viewer=PluginFunctions::ALL_VIEWERS)
Enable or disable Backface culling.
Vector sceneCenter(int _viewer=PluginFunctions::ACTIVE_VIEWER)
Get the scene center.