Commit 6c7be838 authored by Jan Möbius's avatar Jan Möbius

Preliminary python interface test

parent 445a93ab
......@@ -4,6 +4,8 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/TSplineMesh)
add_definitions (-DENABLE_TSPLINEMESH_SUPPORT)
endif ()
openflipper_plugin (DIRS TSplineMesh
openflipper_plugin (PYTHONINTERFACE
DIRS TSplineMesh
INSTALLDATA Icons
TYPES POLYMESH TRIANGLEMESH)
TYPES POLYMESH TRIANGLEMESH
)
#include <pybind11/include/pybind11/pybind11.h>
#include <pybind11/include/pybind11/embed.h>
#include <ViewControlPlugin.hh>
#include <OpenFlipper/BasePlugin/PythonFunctions.hh>
namespace py = pybind11;
PYBIND11_EMBEDDED_MODULE(viewControlPlugin, m) {
QObject* pluginPointer = getPluginPointer("ViewControl");
// Export our core. Make sure that the c++ worlds core objet is not deleted if
// the python side gets deleted!!
py::class_< ViewControlPlugin,std::unique_ptr<ViewControlPlugin, py::nodelete> > view(m, "viewControl");
// On the c++ side we will just return the existing core instance
// and prevent the system to recreate a new core as we need
// to work on the existing one.
view.def(py::init([&pluginPointer]() { return qobject_cast<ViewControlPlugin*>(pluginPointer); }));
view.def("viewAll", static_cast<void (ViewControlPlugin::*)()>(&ViewControlPlugin::viewAll),"Change View in all viewers to view whole scene");
view.def("viewAll", static_cast<void (ViewControlPlugin::*)(int)>(&ViewControlPlugin::viewAll),"Change View in given viewer to view whole scene",py::arg("Id of the viewer which should be switched") );
view.def("orthographicProjection", static_cast<void (ViewControlPlugin::*)()>(&ViewControlPlugin::orthographicProjection) );
view.def("orthographicProjection", static_cast<void (ViewControlPlugin::*)(int)>(&ViewControlPlugin::orthographicProjection) );
}
......@@ -39,10 +39,7 @@
* *
\*===========================================================================*/
#ifndef ViewControlPlugin_HH
#define ViewControlPlugin_HH
#pragma once
#include <QObject>
#include <QMenuBar>
......@@ -355,4 +352,4 @@ class ViewControlPlugin : public QObject, BaseInterface , PickingInterface, Logg
};
#endif //ViewControlPlugin_HH
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