46#include "MeshConvert.hh"
52#include <OpenFlipper/libs_required/OpenMesh/src/OpenMesh/Core/Mesh/Casts.hh>
54#include <QActionGroup>
64void MeshConvertPlugin::pluginsInitialized()
67 emit setSlotDescription(
"convert(int,bool)",
"Convert a mesh to PolyMesh or to TriMesh. returns the ID of the new mesh or -1 in case of error. The old mesh remains unchanged.",
68 QString(
"object_id,toTriMesh").split(
","),
69 QString(
" id of an object to convert, flag to convert to a TriMesh, if not set creates a new PolyMesh").split(
","));
71 if(! OpenFlipper::Options::gui())
75 toolbar =
new QToolBar(tr(
"Mesh conversion"));
77 grp =
new QActionGroup(toolbar);
80 bidirectionalConversion =
new QAction(tr(
"&Convert Meshes"), grp);
81 polyConversion =
new QAction(tr(
"&Convert to PolyMesh"), grp);
82 triConversion =
new QAction(tr(
"&Convert to TriMesh"), grp);
85 bidirectionalConversion->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"Mesh-Convert.png"));
86 polyConversion->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"Mesh-Convert-Poly.png"));
87 triConversion->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"Mesh-Convert-Tri.png"));
90 toolbar->addAction(bidirectionalConversion);
91 toolbar->addAction(polyConversion);
92 toolbar->addAction(triConversion);
96 connect( grp, SIGNAL( triggered(QAction*) ),
this, SLOT(
convert(QAction*)) );
99 emit addToolbar( toolbar );
105MeshConvertPlugin::MeshConvertPlugin() :
108 bidirectionalConversion(nullptr),
109 polyConversion(nullptr),
110 triConversion(nullptr)
115MeshConvertPlugin::~MeshConvertPlugin()
153 std::vector<int> _ids;
156 for(std::vector<int>::iterator
id = _ids.begin();
id != _ids.end(); ++
id)
158 if((_action == bidirectionalConversion || _action == polyConversion))
162 if((_action == bidirectionalConversion || _action == triConversion))
#define DATA_TRIANGLE_MESH
void initializePlugin()
BaseInterface.
void convert(QAction *)
convert Converts trimesh to poly and vice versa depending on the Action that was called.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
bool getMesh(int _identifier, PolyMesh *&_mesh)
Get the Poly Mesh which has the given identifier.
bool getTargetIdentifiers(std::vector< int > &_identifiers)
Get the identifiers of all objects marked as a target object.