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

Finished python interface for move plugin

parent 8d824747
......@@ -68,7 +68,7 @@ PYBIND11_EMBEDDED_MODULE(Move, m) {
// Export our core. Make sure that the c++ worlds core object is not deleted if
// the python side gets deleted!!
py::class_< MovePlugin,std::unique_ptr<MovePlugin, py::nodelete> > move(m, "move");
py::class_< MovePlugin,std::unique_ptr<MovePlugin, py::nodelete> > move(m, "Move");
// On the c++ side we will just return the existing core instance
// and prevent the system to recreate a new core as we need
......@@ -92,8 +92,11 @@ PYBIND11_EMBEDDED_MODULE(Move, m) {
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Translation vector").toLatin1().data()) );
// /// translate given vertices by a vector
// void translate( int _objectId , IdList _vHandles, Vector _vector );
move.def("translate", static_cast<void (MovePlugin::*)(int,IdList,Vector)>(&MovePlugin::translate),
QCoreApplication::translate("PythonDocMove","Translate vertices of an object by given vector.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","List of vertex indices to be moved").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Translation vector").toLatin1().data()) );
move.def("translateVertexSelection", static_cast<void (MovePlugin::*)(int,Vector)>(&MovePlugin::translateVertexSelection),
QCoreApplication::translate("PythonDocMove","Translate current vertex selection of an object by given vector.").toLatin1().data(),
......@@ -112,28 +115,42 @@ PYBIND11_EMBEDDED_MODULE(Move, m) {
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Translation vector").toLatin1().data()) );
move.def("transform", static_cast<void (MovePlugin::*)(int,Matrix4x4)>(&MovePlugin::transform),
QCoreApplication::translate("PythonDocMove","Transform an object with a 4x4 matrix").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Transformation matrix").toLatin1().data()) );
move.def("transform", static_cast<void (MovePlugin::*)(int,IdList,Matrix4x4)>(&MovePlugin::transform),
QCoreApplication::translate("PythonDocMove","Transform an object with a 4x4 matrix").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","List of vertex handles to move").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Transformation matrix").toLatin1().data()) );
//
// /// transform an Object by a given matrix
// void transform( int _objectId , Matrix4x4 _matrix );
//
// /// transform given vertices by a matrix
// void transform( int _objectId , IdList _vHandles, Matrix4x4 _matrix );
// /// transform current selection of an Object by a given matrix
// bool transformVertexSelection( int _objectId , Matrix4x4 _matrix );
//
// /// transform current selection of an Object by a given matrix
// bool transformFaceSelection( int _objectId , Matrix4x4 _matrix );
//
// /// transform current selection of an Object by a given matrix
// bool transformEdgeSelection( int _objectId , Matrix4x4 _matrix );
//
// /// transform current selection of an Object by a given matrix
// bool transformCellSelection( int _objectId , Matrix4x4 _matrix );
//
// /// Transform handle region using the given transformation matrix
// void transformHandleRegion(int _objectId, Matrix4x4 _matrix);
//
move.def("transformVertexSelection", static_cast<bool (MovePlugin::*)(int,Matrix4x4)>(&MovePlugin::transformVertexSelection),
QCoreApplication::translate("PythonDocMove","Transform selected vertices by given matrix.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Transformation matrix").toLatin1().data()) );
move.def("transformFaceSelection", static_cast<bool (MovePlugin::*)(int,Matrix4x4)>(&MovePlugin::transformFaceSelection),
QCoreApplication::translate("PythonDocMove","Transform selected faces by given matrix.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Transformation matrix").toLatin1().data()) );
move.def("transformEdgeSelection", static_cast<bool (MovePlugin::*)(int,Matrix4x4)>(&MovePlugin::transformEdgeSelection),
QCoreApplication::translate("PythonDocMove","Transform selected edges by given matrix.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Transformation matrix").toLatin1().data()) );
move.def("transformCellSelection", static_cast<bool (MovePlugin::*)(int,Matrix4x4)>(&MovePlugin::transformCellSelection),
QCoreApplication::translate("PythonDocMove","Transform selected cells by given matrix.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Transformation matrix").toLatin1().data()) );
move.def("transformHandleRegion", static_cast<void (MovePlugin::*)(int,Matrix4x4)>(&MovePlugin::transformHandleRegion),
QCoreApplication::translate("PythonDocMove","Transform handle region by given matrix.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Transformation matrix").toLatin1().data()) );
move.def("setManipulatorPosition", &MovePlugin::setManipulatorPosition,
QCoreApplication::translate("PythonDocMove","Set the position of the manipulator.").toLatin1().data(),
......@@ -150,7 +167,6 @@ PYBIND11_EMBEDDED_MODULE(Move, m) {
py::arg(QCoreApplication::translate("PythonDocMove","X-Axis direction").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Y-Axis direction").toLatin1().data()));
move.def("manipulatorDirectionX", &MovePlugin::manipulatorDirectionX,
QCoreApplication::translate("PythonDocMove","Get the x-direction of an object's manipulator.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()) );
......@@ -183,55 +199,8 @@ PYBIND11_EMBEDDED_MODULE(Move, m) {
py::arg(QCoreApplication::translate("PythonDocMove","Rotation axis").toLatin1().data()),
py::arg(QCoreApplication::translate("PythonDocMove","Rotation angle").toLatin1().data()) );
// /** \brief Gets the Object Matrix in the scenegraph
// *
// * The object itself is not modified b< this matrix. Only the transformation matrix applied to the object
// * coordinates before rendering gets modified.
// *
// * @param _objectId Id of the object to modify
// * @return Current Matrix of the object
// */
// Matrix4x4 getObjectRenderingMatrix(int _objectId);
//
// emit setSlotDescription("translate(int,idList,Vector)",tr("Translate vertices by given vector."),
// QString(tr("objectId,VertexHandles,Vector")).split(","),
// QString(tr("ID of an object, List of vertex handles, translation vector")).split(","));
//
// emit setSlotDescription("transformHandleRegion(int,Matrix4x4)",tr("Transform handle region using the specified matrix."),
// QString(tr("objectId,Matrix")).split(","), QString(tr("ID of an object, transformation matrix")).split(","));
//
// emit setSlotDescription("transform(int,Matrix4x4)",tr("transform object by given matrix."),
// QString(tr("objectId,Matrix")).split(","), QString(tr("ID of an object, transformation matrix")).split(","));
//
// emit setSlotDescription("transform(int,IdList,Matrix4x4)",tr("transform vertices by given matrix."),
// QString(tr("objectId,VertexHandles,Matrix")).split(","),
// QString(tr("ID of an object, List of vertex handles, transformation matrix")).split(","));
//
// emit setSlotDescription("transformSelection(int,Matrix4x4)",tr("transform current selection of an object by given matrix."),
// QString(tr("objectId,Matrix")).split(","), QString(tr("ID of an object, transformation matrix")).split(","));
//
// emit setSlotDescription("transformCellSelection(int,Matrix4x4)",tr("transform selected cells by given matrix."),
// QString(tr("objectId,Matrix")).split(","),
// QString(tr("ID of an object, transformation matrix")).split(","));
//
// emit setSlotDescription("transformVertexSelection(int,Matrix4x4)",tr("transform selected vertices by given matrix."),
// QString(tr("objectId,Matrix")).split(","),
// QString(tr("ID of an object, transformation matrix")).split(","));
//
// emit setSlotDescription("transformFaceSelection(int,Matrix4x4)",tr("transform selected faces by given matrix."),
// QString(tr("objectId,Matrix")).split(","),
// QString(tr("ID of an object, transformation matrix")).split(","));
//
// emit setSlotDescription("transformEdgeSelection(int,Matrix4x4)",tr("transform selected edges by given matrix."),
// QString(tr("objectId,Matrix")).split(","),
// QString(tr("ID of an object, transformation matrix")).split(","));
//
//
// emit setSlotDescription("getObjectRenderingMatrix(int)",tr("Returns the current object transformation matrix from the scenegraph."),
// QStringList(tr("objectId").split(";")), QStringList(tr("ID of an object").split(";")));
move.def("getObjectRenderingMatrix", &MovePlugin::getObjectRenderingMatrix,
QCoreApplication::translate("PythonDocMove","Returns the current object transformation matrix from the Scenegraph.").toLatin1().data(),
py::arg(QCoreApplication::translate("PythonDocMove","ID of an object").toLatin1().data()));
}
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