43 #include <pybind11/include/pybind11/pybind11.h> 44 #include <pybind11/include/pybind11/embed.h> 47 #include <ViewControlPlugin.hh> 48 #include <OpenFlipper/BasePlugin/PythonFunctions.hh> 49 #include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh> 55 PYBIND11_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()) );
137 QCoreApplication::translate(
"PythonDocViewControl",
"Set the viewing direction").toLatin1().data(),
138 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewing Direction").toLatin1().data()),
139 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Up vector").toLatin1().data()),
140 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to set viewing direction (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
143 QCoreApplication::translate(
"PythonDocViewControl",
"Set scene radius").toLatin1().data(),
144 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Radius").toLatin1().data()),
145 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to set radius (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
148 QCoreApplication::translate(
"PythonDocViewControl",
"Rotate scene").toLatin1().data(),
149 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Rotation axis").toLatin1().data()),
150 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Rotation angle").toLatin1().data()),
151 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Rotation center").toLatin1().data()),
152 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to rotate (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
156 QCoreApplication::translate(
"PythonDocViewControl",
"Translate scene").toLatin1().data(),
157 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Translation vector").toLatin1().data()),
158 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to translate (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
161 QCoreApplication::translate(
"PythonDocViewControl",
"Set the draw mode of a viewer").toLatin1().data(),
162 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"List of draw modes ( ; separated list ) ").toLatin1().data()),
163 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to set draw mode (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
166 QCoreApplication::translate(
"PythonDocViewControl",
" This function can be used to set the drawmode for an object.").toLatin1().data(),
167 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"List of draw modes ( ; separated list ) ").toLatin1().data()),
168 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Object ID to set the drawmode on.").toLatin1().data()),
169 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Set the draw mode even if its not directly supported by the objects nodes").toLatin1().data()) =
true);
172 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current viewing direction").toLatin1().data(),
173 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get viewing direction from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
176 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current upVector").toLatin1().data(),
177 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get upVector from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
180 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current eyePosition").toLatin1().data(),
181 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get eyePosition from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
184 QCoreApplication::translate(
"PythonDocViewControl",
"Get the current sceneCenter").toLatin1().data(),
185 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to get scene center from (Default is the active viewer)?").toLatin1().data()) = PluginFunctions::ACTIVE_VIEWER );
188 QCoreApplication::translate(
"PythonDocViewControl",
"Set the scene center").toLatin1().data(),
189 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Coordinates of center?").toLatin1().data()),
190 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to change (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
193 QCoreApplication::translate(
"PythonDocViewControl",
"Enable or disable Backface culling").toLatin1().data(),
194 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Enable?").toLatin1().data()),
195 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Viewer id to change (Default is all viewers)?").toLatin1().data()) = PluginFunctions::ALL_VIEWERS );
197 view.def(
"setEyePosition", &ViewControlPlugin::setEyePosition),
198 QCoreApplication::translate(
"PythonDocViewControl",
"Change the Eye position to the given value").toLatin1().data(),
199 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Eye position").toLatin1().data()) ;
202 QCoreApplication::translate(
"PythonDocViewControl",
"Change View in all viewers to view whole scene").toLatin1().data());
204 QCoreApplication::translate(
"PythonDocViewControl",
"Change View in given viewer to view whole scene").toLatin1().data(),
205 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer which should be switched").toLatin1().data()) );
208 QCoreApplication::translate(
"PythonDocViewControl",
"Change View on all viewers to view home position").toLatin1().data());
210 QCoreApplication::translate(
"PythonDocViewControl",
"Change View on given viewer to view home position").toLatin1().data(),
211 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer to change").toLatin1().data()) );
214 QCoreApplication::translate(
"PythonDocViewControl",
"Change all Viewers to orthographic projection").toLatin1().data());
216 QCoreApplication::translate(
"PythonDocViewControl",
"Change Viewer to orthographic projection").toLatin1().data(),
217 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer to change").toLatin1().data()) );
220 QCoreApplication::translate(
"PythonDocViewControl",
"Change all Viewers to perspective projection").toLatin1().data());
222 QCoreApplication::translate(
"PythonDocViewControl",
"Change Viewer to perspective projection").toLatin1().data(),
223 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Id of the viewer to change").toLatin1().data()) );
226 QCoreApplication::translate(
"PythonDocViewControl",
"Set fovy angle of projection for all viewers.").toLatin1().data(),
227 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"fovy angle").toLatin1().data()) );
230 QCoreApplication::translate(
"PythonDocViewControl",
"Set the projection mode of the coordinate system.").toLatin1().data(),
231 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"If true, orthogonal projection otherwise perspective projection").toLatin1().data()) );
233 view.def(
"setTwoSidedLighting", &ViewControlPlugin::setTwoSidedLighting,
234 QCoreApplication::translate(
"PythonDocViewControl",
"Enable or disable two sided lighting.").toLatin1().data(),
235 py::arg(QCoreApplication::translate(
"PythonDocViewControl",
"Specifies whether to enable or disable two sided lighting.").toLatin1().data()) );
void setSceneRadius(double _radius, int _viewer=PluginFunctions::ALL_VIEWERS)
Set scene radius.
void orthographicProjection()
Change Viewer to orthographicProjection.
Vector upVector(int _viewer=PluginFunctions::ACTIVE_VIEWER)
get a viewers up vector
void viewHome()
Change View on given Viewer to view home position.
void setCoordsysProjection(bool _orthogonal)
void enableBackfaceCulling(bool _state, int _viewer=PluginFunctions::ALL_VIEWERS)
Enable or disable Backface culling.
Vector eyePosition(int _viewer=PluginFunctions::ACTIVE_VIEWER)
get a viewers eye Position
void setViewingDirection(Vector _direction, Vector _upvector, int _viewer=PluginFunctions::ALL_VIEWERS)
Set the viewing direction.
Vector viewingDirection(int _viewer=PluginFunctions::ACTIVE_VIEWER)
Get a viewers viewing direction.
void translate(Vector _vec, int _viewer=PluginFunctions::ALL_VIEWERS)
translate Scene
bool modelingAreasVisible(int _id)
For meshes returns if the modeling areas for this object is visible.
void viewAll()
Change View on all viewers to view whole scene.
void showModelingAreas(int _id, bool _state)
Allows to enable/disable visualization of the objects modeling area for meshes.
void showSelection(int _id, bool _state)
Allows to enable/disable visualization of the objects selection for meshes.
void setFOVY(double _fovy)
Set fovy angle of projection.
bool selectionVisible(int _id)
For meshes returns if the selection for this object is visible.
Vector sceneCenter(int _viewer=PluginFunctions::ACTIVE_VIEWER)
Get the scene center.
void rotate(Vector _axis, double _angle, Vector _center, int _viewer=PluginFunctions::ALL_VIEWERS)
Rotate Scene.
void setSceneCenter(Vector _center, int _viewer=PluginFunctions::ALL_VIEWERS)
Set the scene center.
void setObjectDrawMode(QString _mode, int _objectID, bool _force=true)
Set the draw mode for an object.
void setDrawMode(QString _mode, int _viewer=PluginFunctions::ALL_VIEWERS)
Set the draw mode for a viewer.