Commit 447fdc0f authored by Jan Möbius's avatar Jan Möbius
Browse files

Added sevaral core functions to python interface

parent fe65b989
......@@ -309,9 +309,205 @@ PYBIND11_EMBEDDED_MODULE(openflipper, m) {
core.def(py::init([]() { return core_; }));
core.def("updateView", &Core::updateView);
core.def("clearAll", &Core::clearAll);
core.def("fullscreen", &Core::fullscreen);
core.def("updateView", &Core::updateView, QCoreApplication::translate("PythonDocCore","Redraw the contents of the viewer.").toLatin1().data() );
core.def("blockScenegraphUpdates", &Core::blockScenegraphUpdates, QCoreApplication::translate("PythonDocCore","Disable Scenegraph Updates (e.g. before loading or adding a large number of files)").toLatin1().data() );
core.def("updateUI", &Core::updateUI, QCoreApplication::translate("PythonDocCore","Process events during script execution to keep the ui alive").toLatin1().data() );
core.def("clearAll", &Core::clearAll, QCoreApplication::translate("PythonDocCore","Clear all data objects.").toLatin1().data() );
core.def("deleteObject", &Core::deleteObject, QCoreApplication::translate("PythonDocCore","Delete an object from the scene.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Id of the object to delete.").toLatin1().data() ) );
// void setObjectComment(int objId, QString key, QString comment);
// void clearObjectComment(int objId, QString key);
// void clearAllComments(int objId);
core.def("fullscreen", &Core::fullscreen, QCoreApplication::translate("PythonDocCore","Enable or disable fullscreen mode.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Enable or disable?").toLatin1().data() ) );
core.def("showViewModeControls", &Core::deleteObject, QCoreApplication::translate("PythonDocCore","Show or hide the view mode control box").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Visible?").toLatin1().data() ) );
core.def("loggerState", &Core::loggerState, QCoreApplication::translate("PythonDocCore","Change the logger window state").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","0 = In Scene , 1 = Normal, 2 = Hidden").toLatin1().data() ) );
core.def("enableOpenMeshErrorLog", &Core::enableOpenMeshErrorLog, QCoreApplication::translate("PythonDocCore","Enable or disable OpenMesh error logging").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Enable or Disable").toLatin1().data() ) );
core.def("showToolbox", &Core::showToolbox, QCoreApplication::translate("PythonDocCore","Show or hide toolbox").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Visible?").toLatin1().data() ) );
core.def("showStatusBar", &Core::showStatusBar, QCoreApplication::translate("PythonDocCore","Show or hide status bar").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Visible?").toLatin1().data() ) );
core.def("multiViewMode", &Core::multiViewMode, QCoreApplication::translate("PythonDocCore","Switch MultiView Mode").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","0: One Viewer, 1: Double Viewer, 2: Grid, 3: Horizontal split").toLatin1().data() ) );
core.def("restrictFrameRate", &Core::restrictFrameRate, QCoreApplication::translate("PythonDocCore","Restrict maximal rendering FrameRate to MaxFrameRate").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Restrict Framerate?").toLatin1().data() ) );
core.def("setMaxFrameRate", &Core::setMaxFrameRate, QCoreApplication::translate("PythonDocCore","Set the maximal framerate (automatically enables framerate restriction)").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Maximum frameRate").toLatin1().data() ) );
core.def("snapshotBaseFileName", &Core::snapshotBaseFileName, QCoreApplication::translate("PythonDocCore","Set a base filename for storing snapshots. This setting is viewer dependent").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Base filename").toLatin1().data()),
py::arg( QCoreApplication::translate("PythonDocCore","Viewer ID to set the filename for").toLatin1().data() ) );
core.def("snapshotFileType", &Core::snapshotFileType, QCoreApplication::translate("PythonDocCore","Set a filetype for storing snapshots.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Image type as string (e.g. jpg )").toLatin1().data()),
py::arg( QCoreApplication::translate("PythonDocCore","Viewer ID to set the filetype for").toLatin1().data() ) );
core.def("snapshotCounterStart", &Core::snapshotCounterStart, QCoreApplication::translate("PythonDocCore","Set the starting number for the snapshot counter.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Starting number for the counter").toLatin1().data() ),
py::arg( QCoreApplication::translate("PythonDocCore","Viewer ID to set the counter for").toLatin1().data() ) );
core.def("snapshot", &Core::snapshot, QCoreApplication::translate("PythonDocCore", "Make a snapshot of the viewer with id viewerId.\n"
"Pass 0 as viewerId parameter to capture the current viewer. \n"
"The captured image will have the specified dimensions. \n"
"If 0 is passed as either width or height parameter, the value will \n"
"automatically be set to hold the right aspect ratio, respectively. \n"
"If 0 is passed for both width and height values, the viewport's current \n"
"dimension is used. Set alpha to true if you want the background to be transparent. \n"
"The fifth parameter is used to hide the coordinate system in the upper right corner of the screen. \n"
"If no filename was set using snapshotBaseFileName() the snapshot is stored \n"
"in snap.png in the current directory. For every snapshot \n"
"a counter is added to the filename.").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","Id of viewer").toLatin1().data() ) = 0,
py::arg( QCoreApplication::translate("PythonDocCore","Width of image").toLatin1().data() )= 0,
py::arg( QCoreApplication::translate("PythonDocCore","Height of image").toLatin1().data() )= 0,
py::arg( QCoreApplication::translate("PythonDocCore","Transparent background?").toLatin1().data() ) = false,
py::arg( QCoreApplication::translate("PythonDocCore","Hide coordinate system?").toLatin1().data() ) = false ,
py::arg( QCoreApplication::translate("PythonDocCore","Number of samples per pixel").toLatin1().data() ) =1 );
core.def("applicationSnapshot", &Core::applicationSnapshot, QCoreApplication::translate("PythonDocCore","Create a snapshot of the whole application").toLatin1().data() );
core.def("applicationSnapshotName", &Core::applicationSnapshotName, QCoreApplication::translate("PythonDocCore","Set the baseName for the application snapshot").toLatin1().data() ,
py::arg( QCoreApplication::translate("PythonDocCore","BaseName for full application snapshots").toLatin1().data() ) );
core.def("viewerSnapshot", static_cast<void (Core::*)()>(&Core::viewerSnapshot), QCoreApplication::translate("PythonDocCore","Take a snapshot from all viewers").toLatin1().data() );
// /// Scriptable snapshot method offering full control
// void viewerSnapshot(QString file_name, bool store_comments,
// bool comments_visible_only, bool comments_targeted_only,
// bool store_material_info, int snapshot_width, int snapshot_height,
// bool snapshot_transparent, bool hide_coord_sys,
// int snapshot_multisampling, bool store_view);
// /// resize the examinerViewer
// void resizeViewers(int _width, int _height );
// /// resize the whole Application
// void resizeApplication(int _width, int _height );
// /// write the current versions of all plugins to ini file
// void writeVersionNumbers(QString _filename);
// /// return the list of available object that has the given selection and type
// QList<int> objectList (QString _selection, QStringList _types);
// /// Block the scenegraph updates
// void blockSceneGraphUpdates();
// /// Unblock the scenegraph updates
// void unblockSceneGraphUpdates();
// void setView(QString view);
// void setViewAndWindowGeometry(QString view);
// emit setSlotDescription("deleteObject(int)", tr("Delete an object from the scene."), QStringList("ObjectId"), QStringList(tr("Id of the object to delete")));
// emit slotSetSlotDescriptionGlobalFunction("printToFile(QString,QString)", tr("Print a message to a file"), QStringList(QString("Filename;Values").split(";")), QStringList(QString("Filename to print into;Arbitrary number of arguments").split(";")));
// emit slotSetSlotDescriptionGlobalFunction("help(QString)", tr("Print help about something"), QStringList("Help Entry"), QStringList("help about what?"));
// emit setSlotDescription("exitApplication()", tr("Quit OpenFlipper"), QStringList(), QStringList());
// emit setSlotDescription("resizeViewer(int,int)", tr("Resize the viewer"),
// QString(tr("width,height")).split(","),
// QString(tr("new width for the viewer,new height for the viewer")).split(","));
// emit setSlotDescription("writeVersionNumbers(QString)", tr("write the current versions of all plugins to INI file"),
// QStringList(tr("filename")),
// QStringList(tr("fullpath to a file where the versions should be written to.")));
// //save slots
// emit setSlotDescription("saveObject(int,QString)", tr("Save object to file. If the file exists it will be overwritten."),
// QString(tr("object-id,filename")).split(","),
// QString(tr("id of the object, complete path and filename")).split(","));
// emit setSlotDescription("saveObjectTo(int,QString)", tr("Save object to file. The location can be chosen in a dialog. "
// "(only works if GUI is available)"),
// QString(tr("object-id,filename")).split(","),
// QString(tr("id of the object, initial filename for the dialog")).split(","));
// emit setSlotDescription("saveAllObjects()", tr("Saves all target objects. "
// "If no filename is available a dialog is shown. (only works if GUI is available)"),QStringList(), QStringList());
// emit setSlotDescription("saveAllObjectsTo()", tr("Saves all target objects. The locations can be chosen in dialogs. "
// "(only works if GUI is available)"),QStringList(), QStringList());
// emit setSlotDescription("saveSettings()", tr("Show the dialog to save the current setting. (only works if GUI is available)"),QStringList(), QStringList());
// emit setSlotDescription("saveSettings(QString, bool, bool, bool, bool, bool, bool)", tr("Save the current setting to the supplied file."),
// QStringList(tr("filePath,is_saveObjectInfo,is_targetOnly,is_saveAll,is_askOverwrite,is_saveProgramSettings,is_savePluginSettings").split(",")),
// QStringList(tr("Path of the file to save the settings to.;Save objects in current setting.;Restrict to targeted objects.;<no idea what this parameter does>;Prompt before overwriting files that already exist (gui mode only).;Save " TOSTRING( PRODUCT_NAME ) " program settings.;Save plugin settings.").split(";")));
// //load slots
// emit setSlotDescription("loadObject()", tr("Show the dialog to load an object. (only works if GUI is available)"),QStringList(), QStringList());
// emit setSlotDescription("loadObject(QString)", tr("Load an object specified in file filename. This automatically determines which file plugin to use."),
// QStringList(tr("filename")), QStringList(tr("Filename")));
// emit setSlotDescription("getObjectId(QString)", tr("Return identifier of object with specified name. Returns -1 if object was not found."),QStringList(), QStringList());
// emit setSlotDescription("loadSettings()", tr("Show the dialog to load settings. (only works if GUI is available)"),QStringList(), QStringList());
// emit setSlotDescription("loadSettings(QString)", tr("load settings from file."),QStringList(), QStringList());
// emit setSlotDescription("createWidget(QString,QString)", tr("Create a widget from an ui file"),
// QString(tr("Object name,ui file")).split(","),
// QString(tr("Name of the new widget in script,ui file to load")).split(","));
// emit setSlotDescription("addToolbox(QString,QWidget*)", tr("Add a widget as a toolbox"),
// QString(tr("Toolbox Entry name,Widget")).split(","),
// QString(tr("Name of the new widget in the toolbox,Pointer to the new widget")).split(","));
// emit setSlotDescription("addToolbox(QString,QWidget*,QIcon*)", tr("Add a widget as a toolbox"),
// QString(tr("Toolbox Entry name,Widget,Icon")).split(","),
// QString(tr("Name of the new widget in the toolbox,Pointer to the new widget,Pointer to icon")).split(","));
// emit setSlotDescription("serializeMaterialProperties(int)", tr("Serialize and return the material properties of the supplied object."),
// QString(tr("ObjectId")).split(","),
// QString(tr("ID of the object")).split(","));
// emit setSlotDescription("deserializeMaterialProperties(int, QString)", tr("Deserialize the supplied material properties into the supplied object."),
// QString(tr("ObjectId, SerializedProps")).split(","),
// QString(tr("ID of the object,The serialized material properties.")).split(","));
// emit setSlotDescription("addViewModeToolboxes(QString,QString)", tr("Set toolboxes for a viewmode (This automatically adds the view mode if it does not exist)"),
// QString(tr("Name,Toolbox List")).split(","),
// QString(tr("Name of the Viewmode,seperated list of toolboxes visible in this viewmode")).split(","));
// emit setSlotDescription("addViewModeToolbars(QString,QString)", tr("Set toolbars for a viewmode (This automatically adds the view mode if it does not exist)"),
// QString(tr("Name,Toolbar List")).split(","),
// QString(tr("Name of the Viewmode,seperated list of toolbars visible in this viewmode")).split(","));
// emit setSlotDescription("addViewModeContextMenus(QString,QString)", tr("Set context Menus for a viewmode (This automatically adds the view mode if it does not exist)"),
// QString(tr("Name,Context Menu List")).split(","),
// QString(tr("Name of the Viewmode,seperated list of Context Menus visible in this viewmode")).split(","));
// emit setSlotDescription("addViewModeIcon(QString,QString)", tr("Set Icon for a viewmode (This automatically adds the view mode if it does not exist)"),
// QString(tr("Name,Icon filename")).split(","),
// QString(tr("Name of the Viewmode,filename of the icon (will be taken from OpenFlippers icon directory)")).split(","));
// emit setSlotDescription("objectList(QString,QStringList)", tr("Returns object list"),
// QString(tr("Selection type,Object types")).split(","),
// QString(tr("Type of object selection (all,source,target),Object type (All,PolyMesh,TriangleMesh,...)")).split(";"));
// emit setSlotDescription("setToolBoxSide(QString)", tr("Determine whether the toolboxes should be displayed on the right or on the left side."),
// QStringList(tr("side")), QStringList(tr("The desired side of the toolboxes (either 'left' or 'right')")));
// emit setSlotDescription("getToolbox(QString,QString)", tr("Returns a pointer to the requested toolbox widget if it was found, nullptr, otherwise."),
// tr("Plugin Name\rToolbox Name").split("\r"),
// tr("The plugin which the requested toolbox belongs to.\rThe name of the requested toolbox.").split("\r"));
// emit setSlotDescription("unblockSceneGraphUpdates()", tr("Enable Scenegraph Updates (e.g. before loading or adding a large number of files)"),QStringList(), QStringList());
// emit setSlotDescription("setView", tr("Set the encoded view for the primary viewport."), QStringList(tr("view")), QStringList(tr("The encoded view. (You can obtain one through \"Copy View\" in the context menu of the coordinates.)")));
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