42#include "MeshObjectSelectionPlugin.hh"
43#include "widgets/ParameterWidget.hh"
49#include <QColorDialog>
50#include <QInputDialog>
55#define VERTEX_TYPE "selection_vertex.png"
56#define EDGE_TYPE "selection_edge.png"
57#define HEDGE_TYPE "selection_halfedge.png"
58#define FACE_TYPE "selection_face.png"
63#define G_CLEAR_HANDLE "Clear Handle Region"
64#define G_CLEAR_MODEL "Clear Modeling Region"
65#define G_CONVERT "Convert Selection"
67#define V_SELECT_ALL "Select All Vertices"
68#define V_CLEAR "Clear Vertex Selection"
69#define V_INVERT "Invert Vertex Selection"
70#define V_BOUNDARY "Select Boundary Vertices"
71#define V_SHRINK "Shrink Vertex Selection"
72#define V_GROW "Grow Vertex Selection"
73#define V_DELETE "Delete selected Vertices"
74#define V_COLORIZE "Colorize selected Vertices"
75#define V_COPYSELECTION "Create mesh from Vertex Selection"
76#define V_HANDLE "Set to Handle Region"
77#define V_MODELING "Set to Modeling Region"
78#define V_LOAD_FLIPPER "Load Flipper Selection"
80#define E_SELECT_ALL "Select All Edges"
81#define E_CLEAR "Clear Edge Selection"
82#define E_INVERT "Invert Edge Selection"
83#define E_DELETE "Delete selected Edges"
84#define E_BOUNDARY "Select Boundary Edges"
85#define E_COLORIZE "Colorize selected Edges"
86#define E_COPYSELECTION "Create mesh from Edge Selection"
87#define E_TRACE_PATH "Trace Edge Path"
90#define HE_SELECT_ALL "Select All Halfedges"
91#define HE_CLEAR "Clear Halfedge Selection"
92#define HE_INVERT "Invert Halfedge Selection"
93#define HE_BOUNDARY "Select Boundary Halfedges"
94#define HE_COLORIZE "Colorize selected Halfedges"
96#define F_SELECT_ALL "Select All Faces"
97#define F_CLEAR "Clear Face Selection"
98#define F_INVERT "Invert Face Selection"
99#define F_DELETE "Delete selected Faces"
100#define F_BOUNDARY "Select Boundary Faces"
101#define F_SHRINK "Shrink Face Selection"
102#define F_GROW "Grow Face Selection"
103#define F_COLORIZE "Colorize selected Faces"
104#define F_COPYSELECTION "Create mesh from Face Selection"
107#define C_SELECTIONCOLOR "Selection Color"
108#define C_FEATURECOLOR "Feature Color"
109#define C_HANDLECOLOR "Handle Color"
110#define C_AREACOLOR "Area Color"
118allSupportedTypes_(0u),
120parameterWidget_(nullptr),
121colorButtonSelection_(0),
123colorButtonHandle_(0),
124colorButtonFeature_(0),
125dihedral_angle_threshold_(0.0),
136void MeshObjectSelectionPlugin::initializePlugin() {
142 if(!OpenFlipper::Options::nogui()) {
148 QString(
"Vertex Selection;Edge Selection;Halfedge Selection;Face Selection;" \
149 "Feature Vertices;Feature Edges;Feature Faces;Handle Region;Modeling Region").split(
";"));
151 QString(
"Vertex Selection;Edge Selection;Halfedge Selection;Face Selection;" \
152 "Feature Vertices;Feature Edges;Feature Faces;Handle Region;Modeling Region").split(
";"));
159void MeshObjectSelectionPlugin::pluginsInitialized() {
164 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
166 emit addSelectionEnvironment(
"Mesh Object Selections",
"Select mesh object primitives such as vertices, (half-)edges and faces.",
194 QStringList generalOperations;
195 generalOperations.append(G_CLEAR_HANDLE);
196 generalOperations.append(G_CLEAR_MODEL);
197 generalOperations.append(G_CONVERT);
200 QStringList vertexOperations;
201 vertexOperations.append(V_SELECT_ALL);
202 vertexOperations.append(V_CLEAR);
203 vertexOperations.append(V_INVERT);
204 vertexOperations.append(V_BOUNDARY);
205 vertexOperations.append(V_SHRINK);
206 vertexOperations.append(V_GROW);
207 vertexOperations.append(V_DELETE);
208 vertexOperations.append(V_COLORIZE);
209 vertexOperations.append(V_COPYSELECTION);
210 vertexOperations.append(V_HANDLE);
211 vertexOperations.append(V_MODELING);
212 vertexOperations.append(V_LOAD_FLIPPER);
215 QStringList edgeOperations;
216 edgeOperations.append(E_SELECT_ALL);
217 edgeOperations.append(E_CLEAR);
218 edgeOperations.append(E_INVERT);
219 edgeOperations.append(E_DELETE);
220 edgeOperations.append(E_BOUNDARY);
221 edgeOperations.append(E_COLORIZE);
222 edgeOperations.append(E_COPYSELECTION);
223 edgeOperations.append(E_TRACE_PATH);
226 QStringList hedgeOperations;
227 hedgeOperations.append(HE_SELECT_ALL);
228 hedgeOperations.append(HE_CLEAR);
229 hedgeOperations.append(HE_INVERT);
230 hedgeOperations.append(HE_BOUNDARY);
231 hedgeOperations.append(HE_COLORIZE);
234 QStringList faceOperations;
235 faceOperations.append(F_SELECT_ALL);
236 faceOperations.append(F_CLEAR);
237 faceOperations.append(F_INVERT);
238 faceOperations.append(F_DELETE);
239 faceOperations.append(F_BOUNDARY);
240 faceOperations.append(F_SHRINK);
241 faceOperations.append(F_GROW);
242 faceOperations.append(F_COLORIZE);
243 faceOperations.append(F_COPYSELECTION);
246 QStringList colorOperations;
247 colorOperations.append(C_SELECTIONCOLOR);
248 colorOperations.append(C_FEATURECOLOR);
249 colorOperations.append(C_AREACOLOR);
250 colorOperations.append(C_HANDLECOLOR);
252 emit addSelectionOperations(
environmentHandle_, generalOperations,
"Selection Operations");
257 emit addSelectionOperations(
environmentHandle_, colorOperations,
"Highlight Operations");
259 if(!OpenFlipper::Options::nogui())
265 emit registerKeyShortcut(Qt::Key_A, Qt::ControlModifier);
267 emit registerKeyShortcut(Qt::Key_C, Qt::NoModifier);
269 emit registerKeyShortcut(Qt::Key_C, Qt::ShiftModifier);
271 emit registerKeyShortcut(Qt::Key_I, Qt::NoModifier);
273 emit registerKeyShortcut(Qt::Key_Delete, Qt::NoModifier);
275 emit registerKeyShortcut(Qt::Key_V, Qt::NoModifier);
277 emit registerKeyShortcut(Qt::Key_H, Qt::NoModifier);
279 emit registerKeyShortcut(Qt::Key_E, Qt::NoModifier);
281 emit registerKeyShortcut(Qt::Key_F, Qt::NoModifier);
284 std::string statusStr =
OpenFlipperQSettings().
value(
"SelectionMeshObject/StatusColor",QString()).toString().toStdString();
285 std::string handleStr =
OpenFlipperQSettings().
value(
"SelectionMeshObject/HandleColor",QString()).toString().toStdString();
286 std::string featureStr =
OpenFlipperQSettings().
value(
"SelectionMeshObject/FeatureColor",QString()).toString().toStdString();
288 if (statusStr.empty() || handleStr.empty() || featureStr.empty() || areaStr.empty())
294 std::stringstream sstream;
296 sstream.str(statusStr);
301 sstream.str(handleStr);
306 sstream.str(featureStr);
311 sstream.str(areaStr);
320 emit setSlotDescription(
"selectVertices(int,IdList)", tr(
"Select the specified vertices"),
321 QString(
"objectId,vertexList").split(
","), QString(
"Id of object,List of vertices").split(
","));
322 emit setSlotDescription(
"unselectVertices(int,IdList)", tr(
"Unselect the specified vertices"),
323 QString(
"objectId,vertexList").split(
","), QString(
"Id of object,List of vertices").split(
","));
324 emit setSlotDescription(
"selectAllVertices(int)", tr(
"Select all vertices of an object"),
325 QStringList(
"objectId"), QStringList(
"Id of object"));
326 emit setSlotDescription(
"clearVertexSelection(int)", tr(
"Clear vertex selection of an object"),
327 QStringList(
"objectId"), QStringList(
"Id of an object"));
328 emit setSlotDescription(
"invertVertexSelection(int)", tr(
"Invert vertex selection of an object"),
329 QStringList(
"objectId"), QStringList(
"Id of an object"));
330 emit setSlotDescription(
"selectBoundaryVertices(int)", tr(
"Select all boundary vertices of an object"),
331 QStringList(
"objectId"), QStringList(
"Id of an object"));
332 emit setSlotDescription(
"selectClosestBoundaryVertices(int,int)", tr(
"Select boundary vertices closest to a specific vertex"),
333 QString(
"objectId,vertexId").split(
","), QString(
"Id of an object,Id of closest vertex").split(
","));
334 emit setSlotDescription(
"shrinkVertexSelection(int)", tr(
"Shrink vertex selection by outer selection ring"),
335 QStringList(
"objectId"), QStringList(
"Id of an object"));
336 emit setSlotDescription(
"growVertexSelection(int)", tr(
"Grow vertex selection by an-ring of selection"),
337 QStringList(
"objectId"), QStringList(
"Id of an object"));
338 emit setSlotDescription(
"deleteVertexSelection(int)", tr(
"Delete selected vertices"),
339 QStringList(
"objectId"), QStringList(
"Id of an object"));
340 emit setSlotDescription(
"createMeshFromVertexSelection(int)", tr(
"Take vertex selection and create a new mesh from it"),
341 QString(
"objectId").split(
","), QString(
"Id of an object where the selection should be used to create a new mesh").split(
","));
343 emit setSlotDescription(
"selectVerticesByValue(int,QString,bool,double)", tr(
"Select vertices based on the value of their component"),
344 QString(
"objectId,component,greater,value").split(
","),
345 QString(
"Id of an object where the selection should be used to create a new mesh,component specification: \"x\" or \"y\" or \"z\" ,true: select vertex if component greater than value; false: select if component less than value ,value to test").split(
","));
347 emit setSlotDescription(
"colorizeVertexSelection(int,int,int,int)", tr(
"Colorize the selected vertices"),
348 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
349 emit setSlotDescription(
"selectHandleVertices(int,IdList)", tr(
"Add specified vertices to handle area"),
350 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
351 emit setSlotDescription(
"unselectHandleVertices(int,IdList)", tr(
"Remove specified vertices from handle area"),
352 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
353 emit setSlotDescription(
"clearHandleVertices(int)", tr(
"Clear handle area"),
354 QStringList(
"objectId"), QStringList(
"Id of an object"));
355 emit setSlotDescription(
"setAllHandleVertices(int)", tr(
"Add all vertices of an object to handle area"),
356 QStringList(
"objectId"), QStringList(
"Id of an object"));
357 emit setSlotDescription(
"selectModelingVertices(int,IdList)", tr(
"Add specified vertices to modeling area"),
358 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
359 emit setSlotDescription(
"unselectModelingVertices(int,IdList)", tr(
"Remove specified vertices to modeling area"),
360 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
361 emit setSlotDescription(
"clearModelingVertices(int)", tr(
"Clear modeling area"),
362 QStringList(
"objectId"), QStringList(
"Id of an object"));
363 emit setSlotDescription(
"setAllModelingVertices(int)", tr(
"Add al vertices of an object to modeling area"),
364 QStringList(
"objectId"), QStringList(
"Id of an object"));
366 emit setSlotDescription(
"loadSelection(int,QString)", tr(
"Load selection from selection file"),
367 QString(
"objectId,filename").split(
","), QString(
"Id of an object,Selection file").split(
","));
369 emit setSlotDescription(
"loadFlipperModelingSelection(int,QString)", tr(
"Load selection from Flipper selection file"),
370 QString(
"objectId,filename").split(
","), QString(
"Id of an object,Flipper selection file").split(
","));
371 emit setSlotDescription(
"saveFlipperModelingSelection(int,QString)", tr(
"Save selection into Flipper selection file"),
372 QString(
"objectId,filename").split(
","), QString(
"Id of an object,Flipper selection file").split(
","));
374 emit setSlotDescription(
"selectEdges(int,IdList)", tr(
"Select the specified edges"),
375 QString(
"objectId,edgeList").split(
","), QString(
"Id of an object,List of edges").split(
","));
376 emit setSlotDescription(
"unselectEdges(int,IdList)", tr(
"Unselect the specified edges"),
377 QString(
"objectId,edgeList").split(
","), QString(
"Id of an object,List of edges").split(
","));
378 emit setSlotDescription(
"selectAllEdges(int)", tr(
"Select all edges of an object"),
379 QStringList(
"objectId"), QStringList(
"Id of an object"));
380 emit setSlotDescription(
"invertEdgeSelection(int)", tr(
"Invert edge selection of an object"),
381 QStringList(
"objectId"), QStringList(
"Id of an object"));
382 emit setSlotDescription(
"clearEdgeSelection(int)", tr(
"Clear edge selection of an object"),
383 QStringList(
"objectId"), QStringList(
"Id of an object"));
384 emit setSlotDescription(
"selectBoundaryEdges(int)", tr(
"Select all boundary edges of an object"),
385 QStringList(
"objectId"), QStringList(
"Id of an object"));
387 emit setSlotDescription(
"colorizeEdgeSelection(int,int,int,int)", tr(
"Colorize the selected edges"),
388 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
389 emit setSlotDescription(
"createMeshFromEdgeSelection(int)", tr(
"Take edge selection and create a new mesh from it"),
390 QString(
"objectId").split(
","), QString(
"Id of an object where the selection should be used to create a new mesh").split(
","));
392 emit setSlotDescription(
"selectHalfedges(int,IdList)", tr(
"Select the specified halfedges"),
393 QString(
"objectId,halfedgeList").split(
","), QString(
"Id of an object,List of halfedges").split(
","));
394 emit setSlotDescription(
"unselectHalfedges(int,IdList)", tr(
"Unselect the specified halfedges"),
395 QString(
"objectId,halfedgeList").split(
","), QString(
"Id of an object,List of halfedges").split(
","));
396 emit setSlotDescription(
"selectAllHalfedges(int)", tr(
"Select all halfedges of an object"),
397 QStringList(
"objectId"), QStringList(
"Id of an object"));
398 emit setSlotDescription(
"invertHalfedgeSelection(int)", tr(
"Invert halfedge selection of an object"),
399 QStringList(
"objectId"), QStringList(
"Id of an object"));
400 emit setSlotDescription(
"clearHalfedgeSelection(int)", tr(
"Clear halfedge selection of an object"),
401 QStringList(
"objectId"), QStringList(
"Id of an object"));
402 emit setSlotDescription(
"selectBoundaryHalfedges(int)", tr(
"Select all boundary halfedges of an object"),
403 QStringList(
"objectId"), QStringList(
"Id of an object"));
405 emit setSlotDescription(
"colorizeHalfedgeSelection(int,int,int,int)", tr(
"Colorize the selected halfedges"),
406 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
408 emit setSlotDescription(
"selectFaces(int,IdList)", tr(
"Select the specified faces"),
409 QString(
"objectId,faceList").split(
","), QString(
"Id of an object,List of faces").split(
","));
410 emit setSlotDescription(
"unselectFaces(int,IdList)", tr(
"Unselect the specified faces"),
411 QString(
"objectId,faceList").split(
","), QString(
"Id of an object,List of faces").split(
","));
412 emit setSlotDescription(
"selectAllFaces(int)", tr(
"Select all vertices of an object"),
413 QStringList(
"objectId"), QStringList(
"Id of an object"));
414 emit setSlotDescription(
"clearFaceSelection(int)", tr(
"Clear face selection of an object"),
415 QStringList(
"objectId"), QStringList(
"Id of an object"));
416 emit setSlotDescription(
"invertFaceSelection(int)", tr(
"Invert face selection of an object"),
417 QStringList(
"objectId"), QStringList(
"Id of an object"));
418 emit setSlotDescription(
"selectBoundaryFaces(int)", tr(
"Select all boundary faces of an object"),
419 QStringList(
"objectId"), QStringList(
"Id of an object"));
420 emit setSlotDescription(
"shrinkFaceSelection(int)", tr(
"Shrink face selection by outer face ring of selection"),
421 QStringList(
"objectId"), QStringList(
"Id of an object"));
422 emit setSlotDescription(
"growFaceSelection(int)", tr(
"Grow face selection by an-ring of faces around selection"),
423 QStringList(
"objectId"), QStringList(
"Id of an object"));
424 emit setSlotDescription(
"colorizeFaceSelection(int,int,int,int)", tr(
"Colorize the selected faces"),
425 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
427 emit setSlotDescription(
"createMeshFromFaceSelection(int)", tr(
"Take face selection and create a new mesh from it"),
428 QString(
"objectId").split(
","), QString(
"Id of an object where the selection should be used to create a new mesh").split(
","));
431 QString conversionStrings = tr(
" Possible strings:\n"
432 "- Vertex/Edge/Halfedge/Face Selection\n"
433 "- Model/Handle Region\n"
434 "- Feature Vertices/Edges/Faces");
436 emit setSlotDescription(
"convertSelection(int,QString,QString,bool)", tr(
"Convert the selection on given object. Conversion must be given as strings.")+conversionStrings ,
437 QString(
"objectId,from,to,deselect").split(
","), QString(
"Id of an object,string of selection which will be converted,resulting selection or area,deselect selection after conversion").split(
","));
439 emit setSlotDescription(
"conversion(QString,QString,bool)", tr(
"Convert selection on all target Objects.")+conversionStrings,
440 QString(
"from,to,deselect").split(
","), QString(
"string of selection which will be converted,resulting selection region or feature,deselect selection after conversion").split(
","));
442 emit setSlotDescription(
"convertEdgesToVertexPairs(int,IdList)", tr(
"Convert edge ids to vertex pair ids. Returns vertex Idlist."),
443 QString(
"objectId, edgeIds").split(
","), QString(
"Id of an object, Ids of edges").split(
","));
444 emit setSlotDescription(
"convertHalfedgesToVertexPairs(int,IdList)", tr(
"Convert halfedge ids to vertex pair ids. Returns vertex Idlist."),
445 QString(
"objectId, halfedgeIds").split(
","), QString(
"Id of an object, Ids of halfedges").split(
","));
447 emit setSlotDescription(
"convertVertexPairsToHalfedges(int,IdList)", tr(
"Convert vertex pair ids to halfedge ids. Returns halfedge Idlist."),
448 QString(
"objectId, vertexIds").split(
","), QString(
"Id of an object, Ids of paired vertices").split(
","));
449 emit setSlotDescription(
"convertVertexPairsToEdges(int,IdList)", tr(
"Convert vertex pair ids to edge ids. Returns edge Idlist."),
450 QString(
"objectId, vertexIds").split(
","), QString(
"Id of an object, Ids of paired vertices").split(
","));
455 SelectionInterface::PrimitiveType type = 0u;
456 emit getActivePrimitiveType(type);
462 bool targetsOnly =
false;
463 emit targetObjectsOnly(targetsOnly);
467 if(_operation == G_CLEAR_HANDLE) {
474 }
else if(_operation == G_CLEAR_MODEL) {
481 }
else if(_operation == G_CONVERT) {
483 if(!OpenFlipper::Options::nogui())
485 }
else if(_operation == V_SELECT_ALL) {
492 }
else if(_operation == V_CLEAR) {
499 }
else if(_operation == V_INVERT) {
506 }
else if(_operation == V_BOUNDARY) {
513 }
else if(_operation == V_SHRINK) {
520 }
else if(_operation == V_GROW) {
527 }
else if(_operation == V_DELETE) {
531 if (o_it->visible()){
537 }
else if(_operation == V_COLORIZE) {
541 if (o_it->visible()) {
545 }
else if(_operation == V_COPYSELECTION) {
547 std::vector<int> objects;
550 if (o_it->visible()) {
551 objects.push_back(o_it->id());
555 for (
unsigned int i = 0 ; i < objects.size() ; ++i)
558 }
else if(_operation == V_HANDLE) {
562 if (o_it->visible()) {
568 }
else if(_operation == V_MODELING) {
572 if (o_it->visible()) {
578 }
else if(_operation == V_LOAD_FLIPPER) {
580 QString fileName = QFileDialog::getOpenFileName(0,
581 tr(
"Open Flipper Selection File"), OpenFlipper::Options::dataDirStr(),
582 tr(
"Flipper Selection Files (*.sel)"));
585 if (o_it->visible()) {
589 }
else if(_operation == E_SELECT_ALL) {
596 }
else if(_operation == E_CLEAR) {
603 }
else if(_operation == E_INVERT) {
610 }
else if(_operation == E_DELETE) {
617 }
else if(_operation == E_BOUNDARY) {
624 }
else if(_operation == E_COLORIZE) {
628 if (o_it->visible()) {
632 }
else if(_operation == E_COPYSELECTION) {
634 std::vector<int> objects;
637 if (o_it->visible()) {
638 objects.push_back(o_it->id());
642 for (
unsigned int i = 0 ; i < objects.size() ; ++i)
645 }
else if (_operation == E_TRACE_PATH) {
648 if (o_it->visible()) {
652 }
else if(_operation == HE_SELECT_ALL) {
659 }
else if(_operation == HE_CLEAR) {
666 }
else if(_operation == HE_INVERT) {
673 }
else if(_operation == HE_BOUNDARY) {
680 }
else if(_operation == HE_COLORIZE) {
684 if (o_it->visible()) {
688 }
else if(_operation == F_SELECT_ALL) {
695 }
else if(_operation == F_CLEAR) {
702 }
else if(_operation == F_INVERT) {
709 }
else if(_operation == F_DELETE) {
716 }
else if(_operation == F_BOUNDARY) {
723 }
else if(_operation == F_SHRINK) {
730 }
else if(_operation == F_GROW) {
737 }
else if(_operation == F_COLORIZE) {
741 if (o_it->visible()) {
745 }
else if(_operation == F_COPYSELECTION) {
747 std::vector<int> objects;
750 if (o_it->visible()) {
751 objects.push_back(o_it->id());
755 for (
unsigned int i = 0 ; i < objects.size() ; ++i)
757 }
else if(_operation == C_SELECTIONCOLOR) {
759 if (newColor.isValid())
776 }
else if(_operation == C_FEATURECOLOR) {
778 if (newColor.isValid())
795 }
else if(_operation == C_HANDLECOLOR) {
797 if (newColor.isValid())
814 }
else if(_operation == C_AREACOLOR) {
816 if (newColor.isValid())
838 QColor c = QColorDialog::getColor(Qt::red, 0, tr(
"Choose color"),QColorDialog::ShowAlphaChannel);
844 }
else if (_primitiveTypes &
edgeType_) {
850 }
else if (_primitiveTypes &
faceType_) {
864 if(from == to)
return;
866 bool deselect =
true;
867 if(!OpenFlipper::Options::nogui()) {
880 emit log(
LOGERR,
"Object not found in convertSelection");
884 if(_from ==
"Vertex Selection") {
885 if (_to ==
"Edge Selection") {
890 }
else if (_to ==
"Halfedge Selection") {
895 }
else if (_to ==
"Face Selection") {
900 }
else if (_to ==
"Feature Vertices") {
905 }
else if (_to ==
"Handle Region") {
907 }
else if (_to ==
"Modeling Region") {
915 }
else if (_from ==
"Edge Selection") {
916 if(_to ==
"Vertex Selection") {
921 }
else if (_to ==
"Halfedge Selection") {
926 }
else if (_to ==
"Face Selection") {
931 }
else if (_to ==
"Feature Edges") {
936 }
else if (_to ==
"Handle Region") {
939 std::vector<int> ids;
940 for(
auto e_it : mesh->edges()) {
941 if(mesh->status(e_it).selected()) {
942 ids.push_back(e_it.h0().to().idx());
943 ids.push_back(e_it.h1().to().idx());
949 std::vector<int> ids;
950 for(
auto e_it : mesh->edges()) {
951 if(mesh->status(e_it).selected()) {
952 ids.push_back(e_it.h0().to().idx());
953 ids.push_back(e_it.h1().to().idx());
958 }
else if (_to ==
"Modeling Region") {
961 std::vector<int> ids;
962 for(
auto e_it : mesh->edges()) {
963 if(mesh->status(e_it).selected()) {
964 ids.push_back(e_it.h0().to().idx());
965 ids.push_back(e_it.h1().to().idx());
971 std::vector<int> ids;
972 for(
auto e_it : mesh->edges()) {
973 if(mesh->status(e_it).selected()) {
974 ids.push_back(e_it.h0().to().idx());
975 ids.push_back(e_it.h1().to().idx());
985 }
else if (_from ==
"Halfedge Selection") {
986 if(_to ==
"Vertex Selection") {
991 }
else if (_to ==
"Edge Selection") {
996 }
else if (_to ==
"Face Selection") {
1001 }
else if (_to ==
"Handle Region") {
1004 std::vector<int> ids;
1005 for(
auto h_it : mesh->halfedges()) {
1006 if(mesh->status(h_it).selected()) {
1007 ids.push_back(h_it.to().idx());
1008 ids.push_back(h_it.from().idx());
1014 std::vector<int> ids;
1015 for(
auto h_it : mesh->halfedges()) {
1016 if(mesh->status(h_it).selected()) {
1017 ids.push_back(h_it.to().idx());
1018 ids.push_back(h_it.from().idx());
1023 }
else if (_to ==
"Modeling Region") {
1026 std::vector<int> ids;
1027 for(
auto h_it : mesh->halfedges()) {
1028 if(mesh->status(h_it).selected()) {
1029 ids.push_back(h_it.to().idx());
1030 ids.push_back(h_it.from().idx());
1036 std::vector<int> ids;
1037 for(
auto h_it : mesh->halfedges()) {
1038 if(mesh->status(h_it).selected()) {
1039 ids.push_back(h_it.to().idx());
1040 ids.push_back(h_it.from().idx());
1050 }
else if (_from ==
"Face Selection") {
1051 if(_to ==
"Vertex Selection") {
1056 }
else if (_to ==
"Edge Selection") {
1061 }
else if (_to ==
"Feature Faces") {
1066 }
else if (_to ==
"Halfedge Selection") {
1071 }
else if (_to ==
"Handle Region") {
1074 std::vector<int> ids;
1075 for(
auto f_it : mesh->faces()) {
1076 if(mesh->status(f_it).selected()) {
1077 for(
auto fv_it : f_it.vertices()) {
1078 ids.push_back(fv_it.idx());
1085 std::vector<int> ids;
1086 for(
auto f_it : mesh->faces()) {
1087 if(mesh->status(f_it).selected()) {
1088 for(
auto fv_it : f_it.vertices()) {
1089 ids.push_back(fv_it.idx());
1095 }
else if (_to ==
"Modeling Region") {
1098 std::vector<int> ids;
1099 for(
auto f_it : mesh->faces()) {
1100 if(mesh->status(f_it).selected()) {
1101 for(
auto fv_it : f_it.vertices()) {
1102 ids.push_back(fv_it.idx());
1109 std::vector<int> ids;
1110 for(
auto f_it : mesh->faces()) {
1111 if(mesh->status(f_it).selected()) {
1112 for(
auto fv_it : f_it.vertices()) {
1113 ids.push_back(fv_it.idx());
1124 }
else if (_from ==
"Feature Vertices") {
1126 if (_to ==
"Vertex Selection") {
1139 }
else if (_from ==
"Feature Edges") {
1141 if (_to ==
"Edge Selection") {
1154 }
else if (_from ==
"Feature Faces") {
1156 if (_to ==
"Face Selection") {
1169 }
else if (_from ==
"Handle Region") {
1171 if(_to ==
"Vertex Selection") {
1173 }
else if (_to ==
"Edge Selection") {
1178 }
else if (_to ==
"Halfedge Selection") {
1183 }
else if (_to ==
"Face Selection") {
1188 }
else if (_to ==
"Modeling Region") {
1196 }
else if (_from ==
"Modeling Region") {
1198 if(_to ==
"Vertex Selection") {
1200 }
else if (_to ==
"Edge Selection") {
1205 }
else if (_to ==
"Halfedge Selection") {
1210 }
else if (_to ==
"Face Selection") {
1215 }
else if (_to ==
"Handle Region") {
1244 size_t node_idx, target_idx;
1249 _event->pos(), node_idx, target_idx, &hit_point)) {
1266 if (mesh->n_vertices() && !mesh->n_faces()) {
1270 mesh->status(vh).set_selected(!mesh->status(vh).selected());
1272 if (mesh->status(vh).selected())
1273 emit scriptInfo(
"selectVertices(ObjectId(" + QString::number(object->
id()) +
") , [" + QString::number(vh.idx()) +
"])");
1275 emit scriptInfo(
"unselectVertices(ObjectId(" + QString::number(object->
id()) +
") , [" + QString::number(vh.idx()) +
"])");
1299 if(_event->type() == QEvent::MouseButtonPress) {
1306 }
else if(_event->type() == QEvent::MouseButtonDblClick) {
1326 if(_event->type() == QEvent::MouseButtonPress) {
1333 }
else if(_event->type() == QEvent::MouseButtonDblClick) {
1340 QRegion region = QRegion(p);
1357 size_t node_idx, target_idx;
1373 if ( _event->type() == QEvent::MouseButtonRelease )
1384 size_t node_idx, target_idx;
1424 size_t node_idx, target_idx;
1427 if(!OpenFlipper::Options::nogui())
1432 _event->pos(), node_idx, target_idx, &hit_point)) {
1449 _currentType, _deselect);
1467 _currentType, _deselect);
1475 emit log(
LOGERR,tr(
"floodFillSelection: Unsupported dataType"));
1486 size_t node_idx, target_idx;
1491 _event->pos(), node_idx, target_idx, &hit_point)) {
1503 object->
id(), target_idx, hit_point, _currentType);
1512 object->
id(), target_idx, hit_point, _currentType);
1521void MeshObjectSelectionPlugin::slotIndexSelection(
int _key)
1524 bool targetsOnly =
false;
1525 emit targetObjectsOnly(targetsOnly);
1529 int visible_objects = 0;
1533 if (o_it->visible()) {
1538 bool fly = visible_objects == 1;
1544 idx = QInputDialog::getInt(
nullptr, tr(
"Vertex to mark"), tr(
"Vertex idx:"), -1);
1547 idx = QInputDialog::getInt(
nullptr, tr(
"Halfedge to mark"), tr(
"Halfedge idx:"), -1);
1550 idx = QInputDialog::getInt(
nullptr, tr(
"Edge to mark"), tr(
"Edge idx:"), -1);
1553 idx = QInputDialog::getInt(
nullptr, tr(
"Face to mark"), tr(
"Face idx:"), -1);
1564 bool selected_something =
false;
1565 if (o_it->visible()) {
1566 if(_key == Qt::Key_V)
1567 selected_something =
selectVertex(o_it->id(), idx, fly);
1568 if(_key == Qt::Key_H)
1570 if(_key == Qt::Key_E)
1571 selected_something =
selectEdge(o_it->id(), idx, fly);
1572 if(_key == Qt::Key_F)
1573 selected_something =
selectFace(o_it->id(), idx, fly);
1575 if (selected_something)
1583void MeshObjectSelectionPlugin::loadSelection(
int _objId,
const QString& _filename) {
1588 if(!file.
connect(_filename,
false)) {
1589 emit log(
LOGERR, QString(
"Could not read file '%1'!").arg(_filename));
1594 loadIniFile(file, _objId);
1597void MeshObjectSelectionPlugin::loadIniFile(
INIFile& _ini,
int _id) {
1601 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id) + tr(
" in saveFile") );
1605 std::vector<int> ids;
1606 bool invert =
false;
1608 bool updated_selection =
false;
1609 bool updated_modeling_regions =
false;
1611 QString sectionName =
object->name();
1613 if (_ini.
get_entry(ids, sectionName ,
"ModelingRegion")) {
1615 _ini.
get_entry(invert, sectionName,
"InvertModeling");
1633 updated_modeling_regions =
true;
1636 if(_ini.
get_entry(ids, sectionName,
"HandleRegion")) {
1638 _ini.
get_entry(invert, sectionName,
"InvertHandle");
1656 updated_modeling_regions =
true;
1659 if(_ini.
get_entry(ids, sectionName,
"VertexSelection")) {
1661 _ini.
get_entry(invert, sectionName,
"InvertVertexSelection");
1671 updated_selection =
true;
1674 if(_ini.
get_entry(ids, sectionName,
"EdgeSelection")) {
1676 _ini.
get_entry(invert, sectionName,
"InvertEdgeSelection");
1688 updated_selection =
true;
1691 if(_ini.
get_entry(ids, sectionName,
"FaceSelection")) {
1693 _ini.
get_entry(invert, sectionName,
"InvertFaceSelection");
1703 updated_selection =
true;
1706 if(updated_modeling_regions) {
1711 }
else if(updated_selection) {
1717 if ( updated_modeling_regions || updated_selection )
1721void MeshObjectSelectionPlugin::saveIniFile(
INIFile& _ini,
int _id) {
1725 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id) + tr(
" in saveFile") );
1730 QString sectionName =
object->name();
1732 emit log(
LOGERR,tr(
"Cannot find object section id ") + QString::number(_id) + tr(
" in saveFile") );
1755 QString section = QString(
"MeshObjectSelection") +
"//" + o_it->name();
1760 std::vector<int> ids;
1762 _file.
get_entry(ids, section,
"VertexSelection");
1766 _file.
get_entry(ids, section,
"EdgeSelection");
1770 _file.
get_entry(ids, section,
"HalfedgeSelection");
1774 _file.
get_entry(ids, section,
"FaceSelection");
1778 _file.
get_entry(ids, section,
"HandleRegion");
1782 _file.
get_entry(ids, section,
"ModelingRegion");
1800 QString section = QString(
"MeshObjectSelection") +
"//" + o_it->name();
1819 if (((_key == Qt::Key_V) || (_key == Qt::Key_H) || (_key == Qt::Key_E) || (_key == Qt::Key_F)) && _modifiers == Qt::NoModifier)
1820 slotIndexSelection(_key);
1822 SelectionInterface::PrimitiveType type = 0u;
1823 emit getActivePrimitiveType(type);
1831 bool targetsOnly =
false;
1832 emit targetObjectsOnly(targetsOnly);
1836 if(_key == Qt::Key_A && _modifiers == Qt::ControlModifier) {
1840 if (o_it->visible()) {
1854 }
else if (_key == Qt::Key_C && ( _modifiers == Qt::NoModifier || _modifiers == Qt::ShiftModifier) ) {
1858 if (o_it->visible()) {
1860 if ( _modifiers == Qt::NoModifier ) {
1882 }
else if(_key == Qt::Key_I && _modifiers == Qt::NoModifier) {
1886 if (o_it->visible()) {
1900 }
else if (_key == Qt::Key_Delete && _modifiers == Qt::NoModifier) {
1904 if (o_it->visible()) {
1922 SelectionInterface::PrimitiveType type = 0u;
1923 emit getActivePrimitiveType(type);
1932 bool targetsOnly =
false;
1933 emit targetObjectsOnly(targetsOnly);
1937 if(event->modifiers() == Qt::ShiftModifier) {
1939 if (event->angleDelta().y() > 0) {
1942 if (o_it->visible()) {
1956 if (o_it->visible()) {
1971 PrimitiveType _primitiveType,
1972 bool _deselection) {
1975 QList <QPair<size_t, size_t> > list;
1980 std::set<int> alreadySelectedObjects;
1982 for(
int i = 0; i < list.size(); ++i) {
1984 if(alreadySelectedObjects.count(list[i].first) != 0)
1992 for(
int j = 0; j < list.size(); ++j) {
1993 if(list[j].first == list[i].first) {
1995 elements.push_back(list[j].second);
2002 alreadySelectedObjects.insert(list[i].first);
2011 std::set<int> alreadySelectedObjects;
2013 for(
int i = 0; i < list.size(); ++i) {
2015 if(alreadySelectedObjects.count(list[i].first) != 0)
2023 for(
int j = 0; j < list.size(); ++j) {
2024 if(list[j].first == list[i].first) {
2026 elements.push_back(list[j].second);
2033 alreadySelectedObjects.insert(list[i].first);
2042 std::set<int> alreadySelectedObjects;
2044 for(
int i = 0; i < list.size(); ++i) {
2046 if(alreadySelectedObjects.count(list[i].first) != 0)
2054 for(
int j = 0; j < list.size(); ++j) {
2055 if(list[j].first == list[i].first) {
2057 elements.push_back(list[j].second);
2090 alreadySelectedObjects.insert(list[i].first);
2099 std::set<int> alreadySelectedObjects;
2101 for(
int i = 0; i < list.size(); ++i) {
2103 if(alreadySelectedObjects.count(list[i].first) != 0)
2111 for(
int j = 0; j < list.size(); ++j) {
2112 if(list[j].first == list[i].first) {
2114 elements.push_back(list[j].second);
2121 alreadySelectedObjects.insert(list[i].first);
2135 bool selected =
false;
2139 selected = plugin_->
volumeSelection(m, object->
id(), state_, ®ion_, type_, deselection_);
2144 selected = plugin_->
volumeSelection(m, object->
id(), state_, ®ion_, type_, deselection_);
2164 emit log(
LOGERR, tr(
"Unable to get object"));
2172 emit log(
LOGERR, tr(
"Unable to get mesh"));
2181 emit log(
LOGERR, tr(
"Unable to add empty object"));
2191 emit log(
LOGERR, tr(
"Unable to get mesh"));
2206 emit log(
LOGERR, tr(
"Unable to get mesh"));
2215 emit log(
LOGERR, tr(
"Unable to add empty object"));
2225 emit log(
LOGERR, tr(
"Unable to get mesh"));
2236 emit log(
LOGERR, tr(
"DataType not supported"));
2244 if (OpenFlipper::Options::gui())
2253 std::stringstream sstream;
2286 _widget =
new QWidget();
2287 QVBoxLayout* vLayout =
new QVBoxLayout();
2288 QHBoxLayout* hLayout =
new QHBoxLayout();
2290 hLayout->addWidget(
new QLabel(
"Select default colors for newly created objects. Does not affect already created objects."));
2291 vLayout->addLayout(hLayout);
2293 hLayout =
new QHBoxLayout();
2295 hLayout->addWidget(
new QLabel(
"Selection Color: "));
2297 vLayout->addLayout(hLayout);
2299 hLayout =
new QHBoxLayout();
2301 hLayout->addWidget(
new QLabel(
"Handle Color: "));
2303 vLayout->addLayout(hLayout);
2305 hLayout =
new QHBoxLayout();
2307 hLayout->addWidget(
new QLabel(
"Feature Color: "));
2309 vLayout->addLayout(hLayout);
2311 hLayout =
new QHBoxLayout();
2313 hLayout->addWidget(
new QLabel(
"Area Color: "));
2315 vLayout->addLayout(hLayout);
2317 hLayout =
new QHBoxLayout();
2318 QPushButton* restoreDefault =
new QPushButton();
2320 restoreDefault->setText(
"Restore Default");
2321 hLayout->addWidget(restoreDefault);
2322 hLayout->addStretch();
2323 vLayout->addLayout(hLayout);
2325 _widget->setLayout(vLayout);
2330void MeshObjectSelectionPlugin::applyOptions()
2342 if (OpenFlipper::Options::nogui())
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Functions for selection on a mesh.
#define DATA_TRIANGLE_MESH
void set_updateGL(bool _b)
should GL matrices be updated after each matrix operation
bool updateGL() const
should GL matrices be updated after each matrix operation
virtual bool picked(uint _node_idx)
detect if the node has been picked
bool dataType(DataType _type) const
Class for the handling of simple configuration files.
bool connect(const QString &name, const bool create)
Connect INIFile object with given filename.
bool get_entry(QString &_val, const QString &_section, const QString &_key) const
Access to a string entry.
bool section_exists(const QString &_section) const
Check if given section exists in the current INI file.
void add_entry(const QString &_section, const QString &_key, const QString &_value)
Addition / modification of a string entry.
void selectAllVertices(int _objectId)
Select all Vertices.
void deleteFaceSelection(int _objectId)
Delete face that are currently selected.
IdList getModelingVertices(int objectId)
Get a list of all modeling vertices.
double get_max_angle()
get max angle for flood fill selection
QString environmentHandle_
Handle to selection environment.
IdList convertVertexPairsToEdges(int _id, const IdList &_vertices)
Inverse of function above.
bool initializeOptionsWidget(QWidget *&_widget)
Initialize the Options Widget.
QPolygon lasso_2Dpoints_
Used for lasso selection tool.
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers)
One of the previously registered keys has been pressed.
void selectVertices(int objectId, IdList _vertexList)
select given vertices
IdList getHandleVertices(int objectId)
Get a list of all handle vertices.
void invertFaceSelection(int objectId)
Invert the current face selection.
void clearHandleVertices(int objectId)
Clear handle Area.
void selectBoundaryHalfedges(int objectId)
Select boundary edges.
void clearModelingVertices(int objectId)
Clear Modeling Area.
void createMeshFromSelection(MeshT &_mesh, MeshT &_newMesh, PrimitiveType _primitiveType)
Create a new mesh from the selection.
void unselectEdges(int objectId, IdList _edgeList)
Unselect given Edges.
void selectBoundaryVertices(int _objectId)
Select all boundary vertices of the given object.
ParameterWidget * parameterWidget_
Handle to selection environment.
bool selectHalfedge(int _objectId, int _idx, bool _fly_to_halfedge)
Select halfedge with id _idx and maybe fly to it.
void slotLoadSelection(const INIFile &_file)
Load selection for specific objects in the scene.
void clearFaceSelection(int objectId)
Unselect all faces.
void selectAllFaces(int objectId)
Select all faces.
IdList getEdgeSelection(int objectId)
Return a list of all selected edges.
double get_dihedral_angle_threshold()
get dihedral angle threshold for edge selection
SelectionInterface::PrimitiveType vertexType_
Primitive type handles:
void selectAllHalfedges(int objectId)
Select all Halfedges.
void colorizeFaceSelection(int objectId, int r, int g, int b, int a)
Colorize the face selection.
void unselectFaces(int objectId, IdList _facesList)
Unselect given faces.
IdList getHalfedgeSelection(int objectId)
Return a list of all selected edges.
void invertHalfedgeSelection(int objectId)
Unselect all Halfedges.
void updateSlotDescriptions()
Set descriptions for local public slots.
void slotToggleSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a toggle selection.
ACG::Vec4f featureColor_
Handle to selection environment.
void invertVertexSelection(int _objectId)
Invert the current vertex selection.
double max_angle_
Handle to selection environment.
MeshObjectSelectionPlugin()
Default constructor.
IdList convertVertexPairsToHalfedges(int _id, const IdList &_vertices)
Inverse of function above.
double dihedral_angle_threshold_
Handle to selection environment.
ACG::Vec4f handleColor_
Handle to selection environment.
void floodFillSelection(MeshT *_mesh, int _objectId, uint _fh, double _maxAngle, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are connected (and do not exceed the maximum dihedral angle)
void slotFloodFillSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a flood fill selection.
void toggleMeshSelection(int _objectId, MeshT *_mesh, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Toggle mesh selection.
void invertEdgeSelection(int objectId)
Unselect all Edges.
QtColorChooserButton * colorButtonFeature_
Handle to selection environment.
void slotComponentsSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a connected components selection.
void closestBoundarySelection(MeshT *_mesh, int _vh, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are incident to closest boundary.
void lassoSelect(QRegion &_region, PrimitiveType _primitiveType, bool _deselection)
Lasso selection tool.
ACG::Vec4f areaColor_
Handle to selection environment.
void setAllHandleVertices(int objectId)
Set all vertices to be part of the handle area.
bool selectVertex(int _objectId, int _idx, bool _fly_to_vertex)
select vertex with id _idx and maybe fly to it
void selectHalfedges(int objectId, IdList _vertexList)
Select given Halfedges.
void selectEdges(int objectId, IdList _edgeList, const double _dihedral_angle_threshold=0.0)
Select given Edges.
void clearHalfedgeSelection(int objectId)
Invert the current edge selection.
void shrinkVertexSelection(int _objectId)
Shrink the current vertex selection.
bool selectFace(int _objectId, int _idx, bool _fly_to_face)
Select face with id _idx and maybe fly to it.
void conversion(const QString &_from, const QString &_to, bool _deselect)
Convert the selection on all target objects.
void growVertexSelection(int _objectId)
Grow the current vertex selection.
void slotSphereSelection(QMouseEvent *_event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a sphere selection.
void set_dihedral_angle_threshold(const double _a)
set dihedral angle threshold for edge selection
void setDefaultColorValues()
sets the default color values for selection/handle/region/feature nodes for all objects of this type
void unselectHandleVertices(int objectId, IdList _vertexList)
Remove vertices from handle area.
void clearVertexSelection(int _objectId)
Unselect all vertices.
bool selectEdge(int _objectId, int _idx, bool _fly_to_edge)
Select edge with id _idx and maybe fly to it.
void slotClosestBoundarySelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a closest boundary selection.
void selectAllEdges(int objectId)
Select all Edges.
void selectModelingVertices(int objectId, IdList _vertexList)
Set vertices to be part of the modeling area.
void growFaceSelection(int objectId)
Grow the current face selection.
void clearEdgeSelection(int objectId)
Invert the current edge selection.
void traceEdgePath(int objectId, double threshold)
Trace Edge Path.
IdList getVertexSelection(int _objectId)
Return a list of all selected vertices.
void set_max_angle(const double _a)
set max angle for flood fill selection
IdList convertHalfedgesToVertexPairs(int _id, const IdList &_halfedges)
Convert halfedge ids to vertex pairs.
void update_regions(MeshT *_mesh)
Update face selection to correspond to the vertex selection.
void slotSaveSelection(INIFile &_file)
Save selection for all objects in the scene.
void loadFlipperModelingSelection(int _objectId, QString _filename)
Load a selection from an Flipper selection file for the given object.
bool volumeSelection(MeshT *_mesh, int _objectId, ACG::GLState &_state, QRegion *_region, PrimitiveType _primitiveTypes, bool _deselection)
Surface volume selection tool.
QtColorChooserButton * colorButtonSelection_
Options.
void updateColorValues()
Set descriptions for local public slots.
void selectFaces(int objectId, IdList _facesList)
Select given faces.
SelectionInterface::PrimitiveType edgeType_
Handle to selection environment.
SelectionInterface::PrimitiveType halfedgeType_
Handle to selection environment.
QtColorChooserButton * colorButtonHandle_
Handle to selection environment.
void unselectModelingVertices(int objectId, IdList _vertexList)
Remove vertices from modeling area.
void colorizeHalfedgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
void selectBoundaryEdges(int objectId)
select boundary edges
void update_dihedral_angle_threshold_from_ui()
set dihedral angle threshold for edge selection
void addedEmptyObject(int _id)
An empty object has been added.
IdList getFaceSelection(int objectId)
Return a list of all selected faces.
void componentsMeshSelection(MeshT *_mesh, int _objectId, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Connected component mesh selection.
void setColorForSelection(const int _objectId, const PrimitiveType _primitiveType)
Set color for selection.
void selectHandleVertices(int objectId, IdList _vertexList)
Set vertices to be part of the handle area.
void colorizeEdgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
IdList convertEdgesToVertexPairs(int _id, const IdList &_edges)
Convert edge ids to vertex pairs.
void unselectVertices(int objectId, IdList _vertexList)
unselect given vertices
void slotLassoSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a lasso selection.
SelectionInterface::PrimitiveType allSupportedTypes_
Handle to selection environment.
void convertSelection(const int &_objectId, const QString &_from, const QString &_to, bool _deselect)
Convert the selection on one object.
void selectBoundaryFaces(int objectId)
Select all boundary faces of the given object.
ConversionDialog * conversionDialog_
Handle to selection environment.
void slotVolumeLassoSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a volume lasso selection.
void paintSphereSelection(MeshT *_mesh, int _objectId, int _target_idx, typename MeshT::Point _hitpoint, double _radius, PrimitiveType _primitiveTypes, bool _deselection)
Use the event to paint selection with a sphere.
ACG::Vec4f statusColor_
Handle to selection environment.
void slotSelectionOperation(QString _operation)
A specific operation is requested.
QtColorChooserButton * colorButtonArea_
Handle to selection environment.
void shrinkFaceSelection(int objectId)
Shrink the current face selection.
void slotMouseWheelEvent(QWheelEvent *event, std::string const &mode)
Wheel Event from main application.
void deleteVertexSelection(int _objectId)
Delete vertices and faces that are currently selected.
void colorizeVertexSelection(int _objectId, int _r, int _g, int _b, int a)
Colorize the vertex selection.
void deleteEdgeSelection(int _objectId)
Delete edges that are currently selected.
void conversionRequested()
Show selection conversion dialog.
~MeshObjectSelectionPlugin()
Default destructor.
QVector< QPoint > volumeLassoPoints_
Used for volume lasso tool.
SelectionInterface::PrimitiveType faceType_
Handle to selection environment.
void setAllModelingVertices(int objectId)
Set all vertices to be part of the modeling area.
void setHandleColor(const ACG::Vec4f &_color)
set color for handles
void setAreaColor(const ACG::Vec4f &_color)
set color for areas
void setFeatureColor(const ACG::Vec4f &_color)
set color for features
void setSelectionColor(const ACG::Vec4f &_color)
set color for selection
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Type for a Meshobject containing a poly mesh.
Traverse the scenegraph and call the selection function for all mesh nodes.
bool operator()(BaseNode *_node)
Traverse the scenegraph and call the selection function for all mesh nodes.
Type for a MeshObject containing a triangle mesh.
ACG::GLState & glState()
Get the glState of the Viewer.
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(8))
Topology updated.
const UpdateType UPDATE_SELECTION_VERTICES(UpdateTypeSet(32))
Vertex selection has changed.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(16))
Selection updated.
void traverse(BaseNode *_node, Action &_action)
@ PICK_ANYTHING
pick any of the prior targets (should be implemented for all nodes)
@ PICK_FRONT_VERTEX
picks only visible front verices (may not be implemented for all nodes)
@ PICK_FACE
picks faces (should be implemented for all nodes)
@ PICK_VERTEX
picks verices (may not be implemented for all nodes)
@ PICK_FRONT_EDGE
picks only visible front edges (may not be implemented for all nodes)
VectorT< float, 4 > Vec4f
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
TriMeshObject * triMeshObject(BaseObjectData *_object)
Cast an BaseObject to a TriMeshObject if possible.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
bool scenegraphRegionPick(ACG::SceneGraph::PickTarget _pickTarget, const QRegion &_region, QList< QPair< size_t, size_t > > &_list, QVector< float > *_depths, QVector< ACG::Vec3d > *_points)
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
PolyMeshObject * polyMeshObject(BaseObjectData *_object)
Cast an BaseObject to a PolyMeshObject if possible.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
QStringList IteratorRestriction
Iterable object range.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
const QStringList ALL_OBJECTS
Iterable object range.