46 #include "MeshConvert.hh" 52 #include <OpenFlipper/libs_required/OpenMesh/src/OpenMesh/Core/Mesh/Casts.hh> 61 void MeshConvertPlugin::pluginsInitialized()
64 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.",
65 QString(
"object_id,toTriMesh").split(
","),
66 QString(
" id of an object to convert, flag to convert to a TriMesh, if not set creates a new PolyMesh").split(
","));
68 if(! OpenFlipper::Options::gui())
72 toolbar =
new QToolBar(tr(
"Mesh conversion"));
74 grp =
new QActionGroup(toolbar);
77 bidirectionalConversion =
new QAction(tr(
"&Convert Meshes"), grp);
78 polyConversion =
new QAction(tr(
"&Convert to PolyMesh"), grp);
79 triConversion =
new QAction(tr(
"&Convert to TriMesh"), grp);
82 bidirectionalConversion->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"Mesh-Convert.png"));
83 polyConversion->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"Mesh-Convert-Poly.png"));
84 triConversion->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"Mesh-Convert-Tri.png"));
87 toolbar->addAction(bidirectionalConversion);
88 toolbar->addAction(polyConversion);
89 toolbar->addAction(triConversion);
93 connect( grp, SIGNAL( triggered(QAction*) ),
this, SLOT(
convert(QAction*)) );
96 emit addToolbar( toolbar );
102 MeshConvertPlugin::MeshConvertPlugin() :
105 bidirectionalConversion(
nullptr),
106 polyConversion(
nullptr),
107 triConversion(
nullptr)
112 MeshConvertPlugin::~MeshConvertPlugin()
150 std::vector<int> _ids;
153 for(std::vector<int>::iterator
id = _ids.begin();
id != _ids.end(); ++id)
155 if((_action == bidirectionalConversion || _action == polyConversion))
159 if((_action == bidirectionalConversion || _action == triConversion))
#define DATA_TRIANGLE_MESH
void convert(QAction *)
convert Converts trimesh to poly and vice versa depending on the Action that was called.
void initializePlugin()
BaseInterface.
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.