43#include <pybind11/pybind11.h>
44#include <pybind11/embed.h>
47#include <DecimaterPlugin.hh>
49#include <OpenFlipper/BasePlugin/PythonFunctions.hh>
50#include <OpenFlipper/PythonInterpreter/PythonTypeConversions.hh>
52namespace py = pybind11;
56PYBIND11_EMBEDDED_MODULE(Decimater, m) {
58 QObject* pluginPointer = getPluginPointer(
"Decimater");
61 std::cerr <<
"Error Getting plugin pointer for Plugin-Decimater" << std::endl;
65 DecimaterPlugin* plugin = qobject_cast<DecimaterPlugin*>(pluginPointer);
68 std::cerr <<
"Error converting plugin pointer for Plugin-Decimater" << std::endl;
74 py::class_< DecimaterPlugin,std::unique_ptr<DecimaterPlugin, py::nodelete> > decimater(m,
"Decimater");
79 decimater.def(py::init([plugin]() {
return plugin; }));
83 QCoreApplication::translate(
"PythonDocDecimater",
"Decimate a mesh. You can use the following parameters:\n\n\
84decimater_type [0 (Incremental), 1 (MC), 2 (Mixed)] \n\
85random_samples [For MC/Mixed] \n\
86incremental_percentage [For Mixed] \n\
87decimation_order [0 (by distance), 1 (by normal deviation), 2 (by edge length)] \n\
92aspect_ratio,independent_sets \n\
99decimater.decimate(5,\"random_samples=2;decimater_type=2;distance=0.0000001;decimation_order=0\") " ).toLatin1().data(),
100 py::arg(QCoreApplication::translate(
"PythonDocDecimater",
"ID of the object").toLatin1().data()),
101 py::arg(QCoreApplication::translate(
"PythonDocDecimater",
"List of Decimation parameters as a list separated by ';'").toLatin1().data()) );
void decimate(int _objID, QVariantMap _constraints)
decimate an object