Commits (5)
include (plugin)
openflipper_plugin ()
\ No newline at end of file
openflipper_plugin (
TYPES TRIANGLEMESH POLYMESH
)
......@@ -159,7 +159,7 @@ void MouseAndKeyPlugin::slotMouseEvent(QMouseEvent* _event) {
// If double click has been performed
if (_event->type() == QEvent::MouseButtonDblClick) {
unsigned int node_idx, target_idx;
size_t node_idx, target_idx;
OpenMesh::Vec3d hitPoint;
// Get picked object's identifier
......@@ -279,10 +279,10 @@ void MouseAndKeyPlugin::transformMesh(ACG::Matrix4x4d _mat, MeshT& _mesh) {
// Iterator over all vertices and transform them by _mat
// Update normals
for (; v_it != v_end; ++v_it) {
_mesh.set_point(v_it, (typename MeshT::Point) _mat.transform_point(
(OpenMesh::Vec3d)(_mesh.point(v_it))));
_mesh.set_normal(v_it, (typename MeshT::Point) _mat.transform_vector(
(OpenMesh::Vec3d)(_mesh.normal(v_it))));
_mesh.set_point(*v_it, (typename MeshT::Point) _mat.transform_point(
(OpenMesh::Vec3d)(_mesh.point(*v_it))));
_mesh.set_normal(*v_it, (typename MeshT::Point) _mat.transform_vector(
(OpenMesh::Vec3d)(_mesh.normal(*v_it))));
}
typename MeshT::FaceIter f_it = _mesh.faces_begin();
......@@ -290,8 +290,8 @@ void MouseAndKeyPlugin::transformMesh(ACG::Matrix4x4d _mat, MeshT& _mesh) {
// Iterate over all faces and update face normals
for (; f_it != f_end; ++f_it)
_mesh.set_normal(f_it, (typename MeshT::Point) _mat.transform_vector(
(OpenMesh::Vec3d)(_mesh.normal(f_it))));
_mesh.set_normal(*f_it, (typename MeshT::Point) _mat.transform_vector(
(OpenMesh::Vec3d)(_mesh.normal(*f_it))));
} // End transformMesh
......@@ -330,5 +330,4 @@ void MouseAndKeyPlugin::contextMenuItemSelected(QAction* _action) {
} // End contextMenuItemSelected
Q_EXPORT_PLUGIN2( mouseandkeyplugin , MouseAndKeyPlugin );
#ifndef MOUSEANDKEYPLUGIN_HH
#define MOUSEANDKEYPLUGIN_HH
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/MouseInterface.hh>
#include <OpenFlipper/BasePlugin/PickingInterface.hh>
......@@ -10,6 +11,11 @@
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/common/Types.hh>
#include <QPushButton>
#include <QLabel>
#include <QGridLayout>
#include <QMenu>
class MouseAndKeyPlugin: public QObject,
BaseInterface,
MouseInterface,
......@@ -27,6 +33,8 @@ class MouseAndKeyPlugin: public QObject,
Q_INTERFACES(ToolboxInterface)
Q_INTERFACES(LoggingInterface)
Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.examples.MouseAndKeyPlugin")
signals:
//BaseInterface
......
......@@ -94,7 +94,7 @@ void SmootherPlugin::simpleLaplace()
// Copy original positions to backup ( in vertex property )
TriMesh::VertexIter v_it, v_end = mesh->vertices_end();
for (v_it = mesh->vertices_begin(); v_it != v_end; ++v_it) {
mesh->property(origPositions, v_it) = mesh->point(v_it);
mesh->property(origPositions, *v_it) = mesh->point(*v_it);
}
// Do one smoothing step (For each point of the mesh ... )
......@@ -106,12 +106,12 @@ void SmootherPlugin::simpleLaplace()
bool skip = false;
// ( .. for each outgoing halfedge .. )
TriMesh::VertexOHalfedgeIter voh_it(*mesh, v_it);
TriMesh::VertexOHalfedgeIter voh_it(*mesh, *v_it);
for (; voh_it; ++voh_it) {
for (; voh_it.is_valid(); ++voh_it) {
// .. add the (original) position of the neighbour ( end of the outgoing halfedge )
point += mesh->property(origPositions, mesh->to_vertex_handle(voh_it));
point += mesh->property(origPositions, mesh->to_vertex_handle(*voh_it));
// Check if the current Halfedge is a boundary halfedge
// If it is, abort and keep the current vertex position
......@@ -122,11 +122,11 @@ void SmootherPlugin::simpleLaplace()
}
// Devide by the valence of the current vertex
point /= mesh->valence(v_it);
point /= mesh->valence(*v_it);
if (!skip) {
// Set new position for the mesh if its not on the boundary
mesh->point(v_it) = point;
mesh->point(*v_it) = point;
}
}
......@@ -155,7 +155,7 @@ void SmootherPlugin::simpleLaplace()
// Copy original positions to backup ( in Vertex property )
PolyMesh::VertexIter v_it, v_end = mesh->vertices_end();
for (v_it = mesh->vertices_begin(); v_it != v_end; ++v_it) {
mesh->property(origPositions, v_it) = mesh->point(v_it);
mesh->property(origPositions, *v_it) = mesh->point(*v_it);
}
// Do one smoothing step (For each point of the mesh ... )
......@@ -167,10 +167,10 @@ void SmootherPlugin::simpleLaplace()
bool skip = false;
// ( .. for each Outoing halfedge .. )
PolyMesh::VertexOHalfedgeIter voh_it(*mesh, v_it);
for (; voh_it; ++voh_it) {
PolyMesh::VertexOHalfedgeIter voh_it(*mesh, *v_it);
for (; voh_it.is_valid(); ++voh_it) {
// .. add the (original) position of the Neighbour ( end of the outgoing halfedge )
point += mesh->property(origPositions, mesh->to_vertex_handle(voh_it));
point += mesh->property(origPositions, mesh->to_vertex_handle(*voh_it));
// Check if the current Halfedge is a boundary halfedge
// If it is, abort and keep the current vertex position
......@@ -182,11 +182,11 @@ void SmootherPlugin::simpleLaplace()
}
// Devide by the valence of the current vertex
point /= mesh->valence(v_it);
point /= mesh->valence(*v_it);
if (!skip) {
// Set new position for the mesh if its not on the boundary
mesh->point(v_it) = point;
mesh->point(*v_it) = point;
}
}
......@@ -207,5 +207,3 @@ void SmootherPlugin::simpleLaplace()
}
}
Q_EXPORT_PLUGIN2( smootherplugin, SmootherPlugin);
......@@ -6,12 +6,18 @@
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/common/Types.hh>
#include <QPushButton>
#include <QLabel>
#include <QGridLayout>
#include <QSpinBox>
class SmootherPlugin : public QObject, BaseInterface, ToolboxInterface, LoggingInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(ToolboxInterface)
Q_INTERFACES(LoggingInterface)
Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.examples.SmootherPlugin")
signals:
//BaseInterface
......
#include "simplePlugin.hh"
#include "OpenFlipper/BasePlugin/PluginFunctions.hh"
Q_EXPORT_PLUGIN2( simplePlugin , SimplePlugin );
......@@ -8,6 +8,7 @@ class SimplePlugin : public QObject, BaseInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.examples.SimplePlugin")
public :
......
......@@ -100,14 +100,14 @@ PythonWidget::PythonWidget(QWidget *parent )
QTextEdit* coreInfo = new QTextEdit( infoTab );
infoTab->addTab(coreInfo,"Core");
moduleTab->addTab(coreInfo,"Core");
QString coreDoc = interpreter->runScriptOutput("import pydoc ;import openflipper;html = pydoc.HTMLDoc();object, name = pydoc.resolve(openflipper);page = html.page(pydoc.describe(object), html.document(object, name));print(page)");
coreInfo->setHtml(coreDoc);
// Collect all Python Documentation for the OpenFlipper Plugin Modules
for ( int i = 0 ; i < pythonPlugins.size() ; ++i ) {
QTextEdit* edit = new QTextEdit( infoTab );
infoTab->addTab(edit,pythonPlugins[i]);
QTextEdit* edit = new QTextEdit( moduleTab );
moduleTab->addTab(edit,pythonPlugins[i]);
QString data = interpreter->runScriptOutput("import pydoc ;import "+pythonPlugins[i]+";html = pydoc.HTMLDoc();object, name = pydoc.resolve("+pythonPlugins[i]+");page = html.page(pydoc.describe(object), html.document(object, name));print(page)");
edit->setHtml(data);
}
......
......@@ -44,6 +44,7 @@
#pragma once
#include "ui_pythonWidget.h"
#include "OpenFlipper/BasePlugin/LoggingInterface.hh"
class PythonWidget : public QMainWindow, public Ui::PythonWidget
......
......@@ -6,66 +6,159 @@
<rect>
<x>0</x>
<y>0</y>
<width>994</width>
<height>659</height>
<width>1474</width>
<height>1004</height>
</rect>
</property>
<property name="windowTitle">
<string>About OpenFlipper</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QTabWidget" name="infoTab">
<property name="currentIndex">
<number>0</number>
<widget class="QSplitter" name="splitter_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Python Script</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="scriptWidget">
<property name="readOnly">
<bool>false</bool>
<widget class="QTabWidget" name="infoTab">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Python Script</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="handleWidth">
<number>4</number>
</property>
<widget class="QTextEdit" name="scriptWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
<widget class="QTextEdit" name="pythonOutput">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Python Information</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QTextEdit" name="pythonInfo">
<property name="enabled">
<bool>true</bool>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QTextEdit" name="pythonOutput"/>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="RunButton">
<property name="text">
<string>Run</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Python Information</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<widget class="QFrame" name="frame_3">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTextEdit" name="pythonInfo">
<property name="enabled">
<bool>true</bool>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<widget class="QTabWidget" name="moduleTab">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
......@@ -73,40 +166,6 @@ p, li { white-space: pre-wrap; }
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="RunButton">
<property name="text">
<string>Run</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<action name="actionClose">
......