42 #include "MeshObjectSelectionPlugin.hh" 43 #include "widgets/ParameterWidget.hh" 48 #include <QDesktopWidget> 49 #include <QColorDialog> 50 #include <QInputDialog> 53 #define VERTEX_TYPE "selection_vertex.png" 54 #define EDGE_TYPE "selection_edge.png" 55 #define HEDGE_TYPE "selection_halfedge.png" 56 #define FACE_TYPE "selection_face.png" 61 #define G_CLEAR_HANDLE "Clear Handle Region" 62 #define G_CLEAR_MODEL "Clear Modeling Region" 63 #define G_CONVERT "Convert Selection" 65 #define V_SELECT_ALL "Select All Vertices" 66 #define V_CLEAR "Clear Vertex Selection" 67 #define V_INVERT "Invert Vertex Selection" 68 #define V_BOUNDARY "Select Boundary Vertices" 69 #define V_SHRINK "Shrink Vertex Selection" 70 #define V_GROW "Grow Vertex Selection" 71 #define V_DELETE "Delete selected Vertices" 72 #define V_COLORIZE "Colorize selected Vertices" 73 #define V_COPYSELECTION "Create mesh from Vertex Selection" 74 #define V_HANDLE "Set to Handle Region" 75 #define V_MODELING "Set to Modeling Region" 76 #define V_LOAD_FLIPPER "Load Flipper Selection" 78 #define E_SELECT_ALL "Select All Edges" 79 #define E_CLEAR "Clear Edge Selection" 80 #define E_INVERT "Invert Edge Selection" 81 #define E_DELETE "Delete selected Edges" 82 #define E_BOUNDARY "Select Boundary Edges" 83 #define E_COLORIZE "Colorize selected Edges" 84 #define E_COPYSELECTION "Create mesh from Edge Selection" 85 #define E_TRACE_PATH "Trace Edge Path" 88 #define HE_SELECT_ALL "Select All Halfedges" 89 #define HE_CLEAR "Clear Halfedge Selection" 90 #define HE_INVERT "Invert Halfedge Selection" 91 #define HE_BOUNDARY "Select Boundary Halfedges" 92 #define HE_COLORIZE "Colorize selected Halfedges" 94 #define F_SELECT_ALL "Select All Faces" 95 #define F_CLEAR "Clear Face Selection" 96 #define F_INVERT "Invert Face Selection" 97 #define F_DELETE "Delete selected Faces" 98 #define F_BOUNDARY "Select Boundary Faces" 99 #define F_SHRINK "Shrink Face Selection" 100 #define F_GROW "Grow Face Selection" 101 #define F_COLORIZE "Colorize selected Faces" 102 #define F_COPYSELECTION "Create mesh from Face Selection" 105 #define C_SELECTIONCOLOR "Selection Color" 106 #define C_FEATURECOLOR "Feature Color" 107 #define C_HANDLECOLOR "Handle Color" 108 #define C_AREACOLOR "Area Color" 116 allSupportedTypes_(0u),
117 conversionDialog_(0),
118 parameterWidget_(nullptr),
119 colorButtonSelection_(0),
121 colorButtonHandle_(0),
122 colorButtonFeature_(0),
123 dihedral_angle_threshold_(0.0),
134 void MeshObjectSelectionPlugin::initializePlugin() {
140 if(!OpenFlipper::Options::nogui()) {
146 QString(
"Vertex Selection;Edge Selection;Halfedge Selection;Face Selection;" \
147 "Feature Vertices;Feature Edges;Feature Faces;Handle Region;Modeling Region").split(
";"));
149 QString(
"Vertex Selection;Edge Selection;Halfedge Selection;Face Selection;" \
150 "Feature Vertices;Feature Edges;Feature Faces;Handle Region;Modeling Region").split(
";"));
157 void MeshObjectSelectionPlugin::pluginsInitialized() {
162 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
164 emit addSelectionEnvironment(
"Mesh Object Selections",
"Select mesh object primitives such as vertices, (half-)edges and faces.",
192 QStringList generalOperations;
193 generalOperations.append(G_CLEAR_HANDLE);
194 generalOperations.append(G_CLEAR_MODEL);
195 generalOperations.append(G_CONVERT);
198 QStringList vertexOperations;
199 vertexOperations.append(V_SELECT_ALL);
200 vertexOperations.append(V_CLEAR);
201 vertexOperations.append(V_INVERT);
202 vertexOperations.append(V_BOUNDARY);
203 vertexOperations.append(V_SHRINK);
204 vertexOperations.append(V_GROW);
205 vertexOperations.append(V_DELETE);
206 vertexOperations.append(V_COLORIZE);
207 vertexOperations.append(V_COPYSELECTION);
208 vertexOperations.append(V_HANDLE);
209 vertexOperations.append(V_MODELING);
210 vertexOperations.append(V_LOAD_FLIPPER);
213 QStringList edgeOperations;
214 edgeOperations.append(E_SELECT_ALL);
215 edgeOperations.append(E_CLEAR);
216 edgeOperations.append(E_INVERT);
217 edgeOperations.append(E_DELETE);
218 edgeOperations.append(E_BOUNDARY);
219 edgeOperations.append(E_COLORIZE);
220 edgeOperations.append(E_COPYSELECTION);
221 edgeOperations.append(E_TRACE_PATH);
224 QStringList hedgeOperations;
225 hedgeOperations.append(HE_SELECT_ALL);
226 hedgeOperations.append(HE_CLEAR);
227 hedgeOperations.append(HE_INVERT);
228 hedgeOperations.append(HE_BOUNDARY);
229 hedgeOperations.append(HE_COLORIZE);
232 QStringList faceOperations;
233 faceOperations.append(F_SELECT_ALL);
234 faceOperations.append(F_CLEAR);
235 faceOperations.append(F_INVERT);
236 faceOperations.append(F_DELETE);
237 faceOperations.append(F_BOUNDARY);
238 faceOperations.append(F_SHRINK);
239 faceOperations.append(F_GROW);
240 faceOperations.append(F_COLORIZE);
241 faceOperations.append(F_COPYSELECTION);
244 QStringList colorOperations;
245 colorOperations.append(C_SELECTIONCOLOR);
246 colorOperations.append(C_FEATURECOLOR);
247 colorOperations.append(C_AREACOLOR);
248 colorOperations.append(C_HANDLECOLOR);
250 emit addSelectionOperations(
environmentHandle_, generalOperations,
"Selection Operations");
255 emit addSelectionOperations(
environmentHandle_, colorOperations,
"Highlight Operations");
257 if(!OpenFlipper::Options::nogui())
263 emit registerKeyShortcut(Qt::Key_A, Qt::ControlModifier);
265 emit registerKeyShortcut(Qt::Key_C, Qt::NoModifier);
267 emit registerKeyShortcut(Qt::Key_C, Qt::ShiftModifier);
269 emit registerKeyShortcut(Qt::Key_I, Qt::NoModifier);
271 emit registerKeyShortcut(Qt::Key_Delete, Qt::NoModifier);
273 emit registerKeyShortcut(Qt::Key_V, Qt::NoModifier);
275 emit registerKeyShortcut(Qt::Key_H, Qt::NoModifier);
277 emit registerKeyShortcut(Qt::Key_E, Qt::NoModifier);
279 emit registerKeyShortcut(Qt::Key_F, Qt::NoModifier);
282 std::string statusStr =
OpenFlipperQSettings().
value(
"SelectionMeshObject/StatusColor",QString()).toString().toStdString();
283 std::string handleStr =
OpenFlipperQSettings().
value(
"SelectionMeshObject/HandleColor",QString()).toString().toStdString();
284 std::string featureStr =
OpenFlipperQSettings().
value(
"SelectionMeshObject/FeatureColor",QString()).toString().toStdString();
286 if (statusStr.empty() || handleStr.empty() || featureStr.empty() || areaStr.empty())
292 std::stringstream sstream;
294 sstream.str(statusStr);
299 sstream.str(handleStr);
304 sstream.str(featureStr);
309 sstream.str(areaStr);
318 emit setSlotDescription(
"selectVertices(int,IdList)", tr(
"Select the specified vertices"),
319 QString(
"objectId,vertexList").split(
","), QString(
"Id of object,List of vertices").split(
","));
320 emit setSlotDescription(
"unselectVertices(int,IdList)", tr(
"Unselect the specified vertices"),
321 QString(
"objectId,vertexList").split(
","), QString(
"Id of object,List of vertices").split(
","));
322 emit setSlotDescription(
"selectAllVertices(int)", tr(
"Select all vertices of an object"),
323 QStringList(
"objectId"), QStringList(
"Id of object"));
324 emit setSlotDescription(
"clearVertexSelection(int)", tr(
"Clear vertex selection of an object"),
325 QStringList(
"objectId"), QStringList(
"Id of an object"));
326 emit setSlotDescription(
"invertVertexSelection(int)", tr(
"Invert vertex selection of an object"),
327 QStringList(
"objectId"), QStringList(
"Id of an object"));
328 emit setSlotDescription(
"selectBoundaryVertices(int)", tr(
"Select all boundary vertices of an object"),
329 QStringList(
"objectId"), QStringList(
"Id of an object"));
330 emit setSlotDescription(
"selectClosestBoundaryVertices(int,int)", tr(
"Select boundary vertices closest to a specific vertex"),
331 QString(
"objectId,vertexId").split(
","), QString(
"Id of an object,Id of closest vertex").split(
","));
332 emit setSlotDescription(
"shrinkVertexSelection(int)", tr(
"Shrink vertex selection by outer selection ring"),
333 QStringList(
"objectId"), QStringList(
"Id of an object"));
334 emit setSlotDescription(
"growVertexSelection(int)", tr(
"Grow vertex selection by an-ring of selection"),
335 QStringList(
"objectId"), QStringList(
"Id of an object"));
336 emit setSlotDescription(
"deleteVertexSelection(int)", tr(
"Delete selected vertices"),
337 QStringList(
"objectId"), QStringList(
"Id of an object"));
338 emit setSlotDescription(
"createMeshFromVertexSelection(int)", tr(
"Take vertex selection and create a new mesh from it"),
339 QString(
"objectId").split(
","), QString(
"Id of an object where the selection should be used to create a new mesh").split(
","));
341 emit setSlotDescription(
"selectVerticesByValue(int,QString,bool,double)", tr(
"Select vertices based on the value of their component"),
342 QString(
"objectId,component,greater,value").split(
","),
343 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(
","));
345 emit setSlotDescription(
"colorizeVertexSelection(int,int,int,int)", tr(
"Colorize the selected vertices"),
346 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
347 emit setSlotDescription(
"selectHandleVertices(int,IdList)", tr(
"Add specified vertices to handle area"),
348 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
349 emit setSlotDescription(
"unselectHandleVertices(int,IdList)", tr(
"Remove specified vertices from handle area"),
350 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
351 emit setSlotDescription(
"clearHandleVertices(int)", tr(
"Clear handle area"),
352 QStringList(
"objectId"), QStringList(
"Id of an object"));
353 emit setSlotDescription(
"setAllHandleVertices(int)", tr(
"Add all vertices of an object to handle area"),
354 QStringList(
"objectId"), QStringList(
"Id of an object"));
355 emit setSlotDescription(
"selectModelingVertices(int,IdList)", tr(
"Add specified vertices to modeling area"),
356 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
357 emit setSlotDescription(
"unselectModelingVertices(int,IdList)", tr(
"Remove specified vertices to modeling area"),
358 QString(
"objectId,vertexList").split(
","), QString(
"Id of an object,List of vertices").split(
","));
359 emit setSlotDescription(
"clearModelingVertices(int)", tr(
"Clear modeling area"),
360 QStringList(
"objectId"), QStringList(
"Id of an object"));
361 emit setSlotDescription(
"setAllModelingVertices(int)", tr(
"Add al vertices of an object to modeling area"),
362 QStringList(
"objectId"), QStringList(
"Id of an object"));
364 emit setSlotDescription(
"loadSelection(int,QString)", tr(
"Load selection from selection file"),
365 QString(
"objectId,filename").split(
","), QString(
"Id of an object,Selection file").split(
","));
367 emit setSlotDescription(
"loadFlipperModelingSelection(int,QString)", tr(
"Load selection from Flipper selection file"),
368 QString(
"objectId,filename").split(
","), QString(
"Id of an object,Flipper selection file").split(
","));
369 emit setSlotDescription(
"saveFlipperModelingSelection(int,QString)", tr(
"Save selection into Flipper selection file"),
370 QString(
"objectId,filename").split(
","), QString(
"Id of an object,Flipper selection file").split(
","));
372 emit setSlotDescription(
"selectEdges(int,IdList)", tr(
"Select the specified edges"),
373 QString(
"objectId,edgeList").split(
","), QString(
"Id of an object,List of edges").split(
","));
374 emit setSlotDescription(
"unselectEdges(int,IdList)", tr(
"Unselect the specified edges"),
375 QString(
"objectId,edgeList").split(
","), QString(
"Id of an object,List of edges").split(
","));
376 emit setSlotDescription(
"selectAllEdges(int)", tr(
"Select all edges of an object"),
377 QStringList(
"objectId"), QStringList(
"Id of an object"));
378 emit setSlotDescription(
"invertEdgeSelection(int)", tr(
"Invert edge selection of an object"),
379 QStringList(
"objectId"), QStringList(
"Id of an object"));
380 emit setSlotDescription(
"clearEdgeSelection(int)", tr(
"Clear edge selection of an object"),
381 QStringList(
"objectId"), QStringList(
"Id of an object"));
382 emit setSlotDescription(
"selectBoundaryEdges(int)", tr(
"Select all boundary edges of an object"),
383 QStringList(
"objectId"), QStringList(
"Id of an object"));
385 emit setSlotDescription(
"colorizeEdgeSelection(int,int,int,int)", tr(
"Colorize the selected edges"),
386 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
387 emit setSlotDescription(
"createMeshFromEdgeSelection(int)", tr(
"Take edge selection and create a new mesh from it"),
388 QString(
"objectId").split(
","), QString(
"Id of an object where the selection should be used to create a new mesh").split(
","));
390 emit setSlotDescription(
"selectHalfedges(int,IdList)", tr(
"Select the specified halfedges"),
391 QString(
"objectId,halfedgeList").split(
","), QString(
"Id of an object,List of halfedges").split(
","));
392 emit setSlotDescription(
"unselectHalfedges(int,IdList)", tr(
"Unselect the specified halfedges"),
393 QString(
"objectId,halfedgeList").split(
","), QString(
"Id of an object,List of halfedges").split(
","));
394 emit setSlotDescription(
"selectAllHalfedges(int)", tr(
"Select all halfedges of an object"),
395 QStringList(
"objectId"), QStringList(
"Id of an object"));
396 emit setSlotDescription(
"invertHalfedgeSelection(int)", tr(
"Invert halfedge selection of an object"),
397 QStringList(
"objectId"), QStringList(
"Id of an object"));
398 emit setSlotDescription(
"clearHalfedgeSelection(int)", tr(
"Clear halfedge selection of an object"),
399 QStringList(
"objectId"), QStringList(
"Id of an object"));
400 emit setSlotDescription(
"selectBoundaryHalfedges(int)", tr(
"Select all boundary halfedges of an object"),
401 QStringList(
"objectId"), QStringList(
"Id of an object"));
403 emit setSlotDescription(
"colorizeHalfedgeSelection(int,int,int,int)", tr(
"Colorize the selected halfedges"),
404 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
406 emit setSlotDescription(
"selectFaces(int,IdList)", tr(
"Select the specified faces"),
407 QString(
"objectId,faceList").split(
","), QString(
"Id of an object,List of faces").split(
","));
408 emit setSlotDescription(
"unselectFaces(int,IdList)", tr(
"Unselect the specified faces"),
409 QString(
"objectId,faceList").split(
","), QString(
"Id of an object,List of faces").split(
","));
410 emit setSlotDescription(
"selectAllFaces(int)", tr(
"Select all vertices of an object"),
411 QStringList(
"objectId"), QStringList(
"Id of an object"));
412 emit setSlotDescription(
"clearFaceSelection(int)", tr(
"Clear face selection of an object"),
413 QStringList(
"objectId"), QStringList(
"Id of an object"));
414 emit setSlotDescription(
"invertFaceSelection(int)", tr(
"Invert face selection of an object"),
415 QStringList(
"objectId"), QStringList(
"Id of an object"));
416 emit setSlotDescription(
"selectBoundaryFaces(int)", tr(
"Select all boundary faces of an object"),
417 QStringList(
"objectId"), QStringList(
"Id of an object"));
418 emit setSlotDescription(
"shrinkFaceSelection(int)", tr(
"Shrink face selection by outer face ring of selection"),
419 QStringList(
"objectId"), QStringList(
"Id of an object"));
420 emit setSlotDescription(
"growFaceSelection(int)", tr(
"Grow face selection by an-ring of faces around selection"),
421 QStringList(
"objectId"), QStringList(
"Id of an object"));
422 emit setSlotDescription(
"colorizeFaceSelection(int,int,int,int)", tr(
"Colorize the selected faces"),
423 QString(
"objectId,r,g,b").split(
","), QString(
"Id of an object,Red,Green,Blue").split(
","));
425 emit setSlotDescription(
"createMeshFromFaceSelection(int)", tr(
"Take face selection and create a new mesh from it"),
426 QString(
"objectId").split(
","), QString(
"Id of an object where the selection should be used to create a new mesh").split(
","));
429 QString conversionStrings = tr(
" Possible strings:\n" 430 "- Vertex/Edge/Halfedge/Face Selection\n" 431 "- Model/Handle Region\n" 432 "- Feature Vertices/Edges/Faces");
434 emit setSlotDescription(
"convertSelection(int,QString,QString,bool)", tr(
"Convert the selection on given object. Conversion must be given as strings.")+conversionStrings ,
435 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(
","));
437 emit setSlotDescription(
"conversion(QString,QString,bool)", tr(
"Convert selection on all target Objects.")+conversionStrings,
438 QString(
"from,to,deselect").split(
","), QString(
"string of selection which will be converted,resulting selection region or feature,deselect selection after conversion").split(
","));
440 emit setSlotDescription(
"convertEdgesToVertexPairs(int,IdList)", tr(
"Convert edge ids to vertex pair ids. Returns vertex Idlist."),
441 QString(
"objectId, edgeIds").split(
","), QString(
"Id of an object, Ids of edges").split(
","));
442 emit setSlotDescription(
"convertHalfedgesToVertexPairs(int,IdList)", tr(
"Convert halfedge ids to vertex pair ids. Returns vertex Idlist."),
443 QString(
"objectId, halfedgeIds").split(
","), QString(
"Id of an object, Ids of halfedges").split(
","));
445 emit setSlotDescription(
"convertVertexPairsToHalfedges(int,IdList)", tr(
"Convert vertex pair ids to halfedge ids. Returns halfedge Idlist."),
446 QString(
"objectId, vertexIds").split(
","), QString(
"Id of an object, Ids of paired vertices").split(
","));
447 emit setSlotDescription(
"convertVertexPairsToEdges(int,IdList)", tr(
"Convert vertex pair ids to edge ids. Returns edge Idlist."),
448 QString(
"objectId, vertexIds").split(
","), QString(
"Id of an object, Ids of paired vertices").split(
","));
453 SelectionInterface::PrimitiveType type = 0u;
454 emit getActivePrimitiveType(type);
460 bool targetsOnly =
false;
461 emit targetObjectsOnly(targetsOnly);
465 if(_operation == G_CLEAR_HANDLE) {
472 }
else if(_operation == G_CLEAR_MODEL) {
479 }
else if(_operation == G_CONVERT) {
481 if(!OpenFlipper::Options::nogui())
483 }
else if(_operation == V_SELECT_ALL) {
490 }
else if(_operation == V_CLEAR) {
497 }
else if(_operation == V_INVERT) {
504 }
else if(_operation == V_BOUNDARY) {
511 }
else if(_operation == V_SHRINK) {
518 }
else if(_operation == V_GROW) {
525 }
else if(_operation == V_DELETE) {
529 if (o_it->visible()){
535 }
else if(_operation == V_COLORIZE) {
539 if (o_it->visible()) {
543 }
else if(_operation == V_COPYSELECTION) {
545 std::vector<int> objects;
548 if (o_it->visible()) {
549 objects.push_back(o_it->id());
553 for (
unsigned int i = 0 ; i < objects.size() ; ++i)
556 }
else if(_operation == V_HANDLE) {
560 if (o_it->visible()) {
566 }
else if(_operation == V_MODELING) {
570 if (o_it->visible()) {
576 }
else if(_operation == V_LOAD_FLIPPER) {
578 QString fileName = QFileDialog::getOpenFileName(0,
579 tr(
"Open Flipper Selection File"), OpenFlipper::Options::dataDirStr(),
580 tr(
"Flipper Selection Files (*.sel)"));
583 if (o_it->visible()) {
587 }
else if(_operation == E_SELECT_ALL) {
594 }
else if(_operation == E_CLEAR) {
601 }
else if(_operation == E_INVERT) {
608 }
else if(_operation == E_DELETE) {
615 }
else if(_operation == E_BOUNDARY) {
622 }
else if(_operation == E_COLORIZE) {
626 if (o_it->visible()) {
630 }
else if(_operation == E_COPYSELECTION) {
632 std::vector<int> objects;
635 if (o_it->visible()) {
636 objects.push_back(o_it->id());
640 for (
unsigned int i = 0 ; i < objects.size() ; ++i)
643 }
else if (_operation == E_TRACE_PATH) {
646 if (o_it->visible()) {
650 }
else if(_operation == HE_SELECT_ALL) {
657 }
else if(_operation == HE_CLEAR) {
664 }
else if(_operation == HE_INVERT) {
671 }
else if(_operation == HE_BOUNDARY) {
678 }
else if(_operation == HE_COLORIZE) {
682 if (o_it->visible()) {
686 }
else if(_operation == F_SELECT_ALL) {
693 }
else if(_operation == F_CLEAR) {
700 }
else if(_operation == F_INVERT) {
707 }
else if(_operation == F_DELETE) {
714 }
else if(_operation == F_BOUNDARY) {
721 }
else if(_operation == F_SHRINK) {
728 }
else if(_operation == F_GROW) {
735 }
else if(_operation == F_COLORIZE) {
739 if (o_it->visible()) {
743 }
else if(_operation == F_COPYSELECTION) {
745 std::vector<int> objects;
748 if (o_it->visible()) {
749 objects.push_back(o_it->id());
753 for (
unsigned int i = 0 ; i < objects.size() ; ++i)
755 }
else if(_operation == C_SELECTIONCOLOR) {
757 if (newColor.isValid())
774 }
else if(_operation == C_FEATURECOLOR) {
776 if (newColor.isValid())
793 }
else if(_operation == C_HANDLECOLOR) {
795 if (newColor.isValid())
812 }
else if(_operation == C_AREACOLOR) {
814 if (newColor.isValid())
836 QColor c = QColorDialog::getColor(Qt::red, 0, tr(
"Choose color"),QColorDialog::ShowAlphaChannel);
842 }
else if (_primitiveTypes &
edgeType_) {
848 }
else if (_primitiveTypes &
faceType_) {
862 if(from == to)
return;
864 bool deselect =
true;
865 if(!OpenFlipper::Options::nogui()) {
878 emit log(
LOGERR,
"Object not found in convertSelection");
882 if(_from ==
"Vertex Selection") {
883 if (_to ==
"Edge Selection") {
888 }
else if (_to ==
"Halfedge Selection") {
893 }
else if (_to ==
"Face Selection") {
898 }
else if (_to ==
"Feature Vertices") {
903 }
else if (_to ==
"Handle Region") {
905 }
else if (_to ==
"Modeling Region") {
913 }
else if (_from ==
"Edge Selection") {
914 if(_to ==
"Vertex Selection") {
919 }
else if (_to ==
"Halfedge Selection") {
924 }
else if (_to ==
"Face Selection") {
929 }
else if (_to ==
"Feature Edges") {
934 }
else if (_to ==
"Handle Region") {
937 std::vector<int> ids;
938 for(TriMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
939 if(mesh->status(*e_it).selected()) {
940 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
941 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).idx());
947 std::vector<int> ids;
948 for(PolyMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
949 if(mesh->status(*e_it).selected()) {
950 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
951 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).idx());
956 }
else if (_to ==
"Modeling Region") {
959 std::vector<int> ids;
960 for(TriMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
961 if(mesh->status(*e_it).selected()) {
962 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
963 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).idx());
969 std::vector<int> ids;
970 for(PolyMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
971 if(mesh->status(*e_it).selected()) {
972 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
973 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).idx());
983 }
else if (_from ==
"Halfedge Selection") {
984 if(_to ==
"Vertex Selection") {
989 }
else if (_to ==
"Edge Selection") {
994 }
else if (_to ==
"Face Selection") {
999 }
else if (_to ==
"Handle Region") {
1002 std::vector<int> ids;
1003 for(TriMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1004 if(mesh->status(*h_it).selected()) {
1005 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1006 ids.push_back(mesh->from_vertex_handle(*h_it).idx());
1012 std::vector<int> ids;
1013 for(PolyMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1014 if(mesh->status(*h_it).selected()) {
1015 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1016 ids.push_back(mesh->from_vertex_handle(*h_it).idx());
1021 }
else if (_to ==
"Modeling Region") {
1024 std::vector<int> ids;
1025 for(TriMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1026 if(mesh->status(*h_it).selected()) {
1027 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1028 ids.push_back(mesh->from_vertex_handle(*h_it).idx());
1034 std::vector<int> ids;
1035 for(PolyMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1036 if(mesh->status(*h_it).selected()) {
1037 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1038 ids.push_back(mesh->from_vertex_handle(*h_it).idx());
1048 }
else if (_from ==
"Face Selection") {
1049 if(_to ==
"Vertex Selection") {
1054 }
else if (_to ==
"Edge Selection") {
1059 }
else if (_to ==
"Feature Faces") {
1064 }
else if (_to ==
"Halfedge Selection") {
1069 }
else if (_to ==
"Handle Region") {
1072 std::vector<int> ids;
1073 for(TriMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1074 if(mesh->status(*f_it).selected()) {
1076 ids.push_back(fv_it->idx());
1083 std::vector<int> ids;
1084 for(PolyMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1085 if(mesh->status(*f_it).selected()) {
1087 ids.push_back(fv_it->idx());
1093 }
else if (_to ==
"Modeling Region") {
1096 std::vector<int> ids;
1097 for(TriMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1098 if(mesh->status(*f_it).selected()) {
1100 ids.push_back(fv_it->idx());
1107 std::vector<int> ids;
1108 for(PolyMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1109 if(mesh->status(*f_it).selected()) {
1111 ids.push_back(fv_it->idx());
1122 }
else if (_from ==
"Feature Vertices") {
1124 if (_to ==
"Vertex Selection") {
1137 }
else if (_from ==
"Feature Edges") {
1139 if (_to ==
"Edge Selection") {
1152 }
else if (_from ==
"Feature Faces") {
1154 if (_to ==
"Face Selection") {
1167 }
else if (_from ==
"Handle Region") {
1169 if(_to ==
"Vertex Selection") {
1171 }
else if (_to ==
"Edge Selection") {
1176 }
else if (_to ==
"Halfedge Selection") {
1181 }
else if (_to ==
"Face Selection") {
1186 }
else if (_to ==
"Modeling Region") {
1194 }
else if (_from ==
"Modeling Region") {
1196 if(_to ==
"Vertex Selection") {
1198 }
else if (_to ==
"Edge Selection") {
1203 }
else if (_to ==
"Halfedge Selection") {
1208 }
else if (_to ==
"Face Selection") {
1213 }
else if (_to ==
"Handle Region") {
1242 size_t node_idx, target_idx;
1247 _event->pos(), node_idx, target_idx, &hit_point)) {
1264 if (mesh->n_vertices() && !mesh->n_faces()) {
1268 mesh->status(vh).set_selected(!mesh->status(vh).selected());
1270 if (mesh->status(vh).selected())
1271 emit scriptInfo(
"selectVertices(ObjectId(" + QString::number(object->
id()) +
") , [" + QString::number(vh.idx()) +
"])");
1273 emit scriptInfo(
"unselectVertices(ObjectId(" + QString::number(object->
id()) +
") , [" + QString::number(vh.idx()) +
"])");
1297 if(_event->type() == QEvent::MouseButtonPress) {
1304 }
else if(_event->type() == QEvent::MouseButtonDblClick) {
1324 if(_event->type() == QEvent::MouseButtonPress) {
1331 }
else if(_event->type() == QEvent::MouseButtonDblClick) {
1338 QRegion region = QRegion(p);
1355 size_t node_idx, target_idx;
1371 if ( _event->type() == QEvent::MouseButtonRelease )
1382 size_t node_idx, target_idx;
1422 size_t node_idx, target_idx;
1425 if(!OpenFlipper::Options::nogui())
1430 _event->pos(), node_idx, target_idx, &hit_point)) {
1447 _currentType, _deselect);
1465 _currentType, _deselect);
1473 emit log(
LOGERR,tr(
"floodFillSelection: Unsupported dataType"));
1484 size_t node_idx, target_idx;
1489 _event->pos(), node_idx, target_idx, &hit_point)) {
1501 object->
id(), target_idx, hit_point, _currentType);
1510 object->
id(), target_idx, hit_point, _currentType);
1519 void MeshObjectSelectionPlugin::slotIndexSelection(
int _key)
1522 bool targetsOnly =
false;
1523 emit targetObjectsOnly(targetsOnly);
1527 int visible_objects = 0;
1531 if (o_it->visible()) {
1536 bool fly = visible_objects == 1;
1542 idx = QInputDialog::getInt(
nullptr, tr(
"Vertex to mark"), tr(
"Vertex idx:"), -1);
1545 idx = QInputDialog::getInt(
nullptr, tr(
"Halfedge to mark"), tr(
"Halfedge idx:"), -1);
1548 idx = QInputDialog::getInt(
nullptr, tr(
"Edge to mark"), tr(
"Edge idx:"), -1);
1551 idx = QInputDialog::getInt(
nullptr, tr(
"Face to mark"), tr(
"Face idx:"), -1);
1562 bool selected_something =
false;
1563 if (o_it->visible()) {
1564 if(_key == Qt::Key_V)
1565 selected_something =
selectVertex(o_it->id(), idx, fly);
1566 if(_key == Qt::Key_H)
1568 if(_key == Qt::Key_E)
1569 selected_something =
selectEdge(o_it->id(), idx, fly);
1570 if(_key == Qt::Key_F)
1571 selected_something =
selectFace(o_it->id(), idx, fly);
1573 if (selected_something)
1581 void MeshObjectSelectionPlugin::loadSelection(
int _objId,
const QString& _filename) {
1586 if(!file.
connect(_filename,
false)) {
1587 emit log(
LOGERR, QString(
"Could not read file '%1'!").arg(_filename));
1592 loadIniFile(file, _objId);
1595 void MeshObjectSelectionPlugin::loadIniFile(
INIFile& _ini,
int _id) {
1599 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id) + tr(
" in saveFile") );
1603 std::vector<int> ids;
1604 bool invert =
false;
1606 bool updated_selection =
false;
1607 bool updated_modeling_regions =
false;
1609 QString sectionName =
object->name();
1611 if (_ini.
get_entry(ids, sectionName ,
"ModelingRegion")) {
1613 _ini.
get_entry(invert, sectionName,
"InvertModeling");
1631 updated_modeling_regions =
true;
1634 if(_ini.
get_entry(ids, sectionName,
"HandleRegion")) {
1636 _ini.
get_entry(invert, sectionName,
"InvertHandle");
1654 updated_modeling_regions =
true;
1657 if(_ini.
get_entry(ids, sectionName,
"VertexSelection")) {
1659 _ini.
get_entry(invert, sectionName,
"InvertVertexSelection");
1669 updated_selection =
true;
1672 if(_ini.
get_entry(ids, sectionName,
"EdgeSelection")) {
1674 _ini.
get_entry(invert, sectionName,
"InvertEdgeSelection");
1686 updated_selection =
true;
1689 if(_ini.
get_entry(ids, sectionName,
"FaceSelection")) {
1691 _ini.
get_entry(invert, sectionName,
"InvertFaceSelection");
1701 updated_selection =
true;
1704 if(updated_modeling_regions) {
1709 }
else if(updated_selection) {
1715 if ( updated_modeling_regions || updated_selection )
1719 void MeshObjectSelectionPlugin::saveIniFile(
INIFile& _ini,
int _id) {
1723 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id) + tr(
" in saveFile") );
1728 QString sectionName =
object->name();
1730 emit log(
LOGERR,tr(
"Cannot find object section id ") + QString::number(_id) + tr(
" in saveFile") );
1753 QString section = QString(
"MeshObjectSelection") +
"//" + o_it->name();
1758 std::vector<int> ids;
1760 _file.
get_entry(ids, section,
"VertexSelection");
1764 _file.
get_entry(ids, section,
"EdgeSelection");
1768 _file.
get_entry(ids, section,
"HalfedgeSelection");
1772 _file.
get_entry(ids, section,
"FaceSelection");
1776 _file.
get_entry(ids, section,
"HandleRegion");
1780 _file.
get_entry(ids, section,
"ModelingRegion");
1798 QString section = QString(
"MeshObjectSelection") +
"//" + o_it->name();
1817 if (((_key == Qt::Key_V) || (_key == Qt::Key_H) || (_key == Qt::Key_E) || (_key == Qt::Key_F)) && _modifiers == Qt::NoModifier)
1818 slotIndexSelection(_key);
1820 SelectionInterface::PrimitiveType type = 0u;
1821 emit getActivePrimitiveType(type);
1829 bool targetsOnly =
false;
1830 emit targetObjectsOnly(targetsOnly);
1834 if(_key == Qt::Key_A && _modifiers == Qt::ControlModifier) {
1838 if (o_it->visible()) {
1852 }
else if (_key == Qt::Key_C && ( _modifiers == Qt::NoModifier || _modifiers == Qt::ShiftModifier) ) {
1856 if (o_it->visible()) {
1858 if ( _modifiers == Qt::NoModifier ) {
1880 }
else if(_key == Qt::Key_I && _modifiers == Qt::NoModifier) {
1884 if (o_it->visible()) {
1898 }
else if (_key == Qt::Key_Delete && _modifiers == Qt::NoModifier) {
1902 if (o_it->visible()) {
1920 SelectionInterface::PrimitiveType type = 0u;
1921 emit getActivePrimitiveType(type);
1930 bool targetsOnly =
false;
1931 emit targetObjectsOnly(targetsOnly);
1935 if(event->modifiers() == Qt::ShiftModifier) {
1937 if (event->angleDelta().y() > 0) {
1940 if (o_it->visible()) {
1954 if (o_it->visible()) {
1969 PrimitiveType _primitiveType,
1970 bool _deselection) {
1973 QList <QPair<size_t, size_t> > list;
1978 std::set<int> alreadySelectedObjects;
1980 for(
int i = 0; i < list.size(); ++i) {
1982 if(alreadySelectedObjects.count(list[i].first) != 0)
1990 for(
int j = 0; j < list.size(); ++j) {
1991 if(list[j].first == list[i].first) {
1993 elements.push_back(list[j].second);
2000 alreadySelectedObjects.insert(list[i].first);
2009 std::set<int> alreadySelectedObjects;
2011 for(
int i = 0; i < list.size(); ++i) {
2013 if(alreadySelectedObjects.count(list[i].first) != 0)
2021 for(
int j = 0; j < list.size(); ++j) {
2022 if(list[j].first == list[i].first) {
2024 elements.push_back(list[j].second);
2031 alreadySelectedObjects.insert(list[i].first);
2040 std::set<int> alreadySelectedObjects;
2042 for(
int i = 0; i < list.size(); ++i) {
2044 if(alreadySelectedObjects.count(list[i].first) != 0)
2052 for(
int j = 0; j < list.size(); ++j) {
2053 if(list[j].first == list[i].first) {
2055 elements.push_back(list[j].second);
2088 alreadySelectedObjects.insert(list[i].first);
2097 std::set<int> alreadySelectedObjects;
2099 for(
int i = 0; i < list.size(); ++i) {
2101 if(alreadySelectedObjects.count(list[i].first) != 0)
2109 for(
int j = 0; j < list.size(); ++j) {
2110 if(list[j].first == list[i].first) {
2112 elements.push_back(list[j].second);
2119 alreadySelectedObjects.insert(list[i].first);
2133 bool selected =
false;
2137 selected = plugin_->volumeSelection(m, object->
id(), state_, ®ion_, type_, deselection_);
2142 selected = plugin_->volumeSelection(m, object->
id(), state_, ®ion_, type_, deselection_);
2162 emit log(
LOGERR, tr(
"Unable to get object"));
2170 emit log(
LOGERR, tr(
"Unable to get mesh"));
2179 emit log(
LOGERR, tr(
"Unable to add empty object"));
2189 emit log(
LOGERR, tr(
"Unable to get mesh"));
2204 emit log(
LOGERR, tr(
"Unable to get mesh"));
2213 emit log(
LOGERR, tr(
"Unable to add empty object"));
2223 emit log(
LOGERR, tr(
"Unable to get mesh"));
2234 emit log(
LOGERR, tr(
"DataType not supported"));
2242 if (OpenFlipper::Options::gui())
2251 std::stringstream sstream;
2284 _widget =
new QWidget();
2285 QVBoxLayout* vLayout =
new QVBoxLayout();
2286 QHBoxLayout* hLayout =
new QHBoxLayout();
2288 hLayout->addWidget(
new QLabel(
"Select default colors for newly created objects. Does not affect already created objects."));
2289 vLayout->addLayout(hLayout);
2291 hLayout =
new QHBoxLayout();
2293 hLayout->addWidget(
new QLabel(
"Selection Color: "));
2295 vLayout->addLayout(hLayout);
2297 hLayout =
new QHBoxLayout();
2299 hLayout->addWidget(
new QLabel(
"Handle Color: "));
2301 vLayout->addLayout(hLayout);
2303 hLayout =
new QHBoxLayout();
2305 hLayout->addWidget(
new QLabel(
"Feature Color: "));
2307 vLayout->addLayout(hLayout);
2309 hLayout =
new QHBoxLayout();
2311 hLayout->addWidget(
new QLabel(
"Area Color: "));
2313 vLayout->addLayout(hLayout);
2315 hLayout =
new QHBoxLayout();
2316 QPushButton* restoreDefault =
new QPushButton();
2318 restoreDefault->setText(
"Restore Default");
2319 hLayout->addWidget(restoreDefault);
2320 hLayout->addStretch();
2321 vLayout->addLayout(hLayout);
2323 _widget->setLayout(vLayout);
2328 void MeshObjectSelectionPlugin::applyOptions()
2340 if (OpenFlipper::Options::nogui())
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
void unselectModelingVertices(int objectId, IdList _vertexList)
Remove vertices from modeling area.
void slotSelectionOperation(QString _operation)
A specific operation is requested.
void selectEdges(int objectId, IdList _edgeList, const double _dihedral_angle_threshold=0.0)
Select given Edges.
void selectBoundaryFaces(int objectId)
Select all boundary faces of the given object.
void selectHandleVertices(int objectId, IdList _vertexList)
Set vertices to be part of the handle area.
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(8))
Topology updated.
void deleteEdgeSelection(int _objectId)
Delete edges that are currently selected.
#define DATA_TRIANGLE_MESH
QVector< QPoint > volumeLassoPoints_
Used for volume lasso tool.
void conversion(const QString &_from, const QString &_to, bool _deselect)
Convert the selection on all target objects.
void selectBoundaryEdges(int objectId)
select boundary edges
void updateColorValues()
Set descriptions for local public slots.
ConversionDialog * conversionDialog_
Handle to selection environment.
void shrinkVertexSelection(int _objectId)
Shrink the current vertex selection.
virtual bool picked(uint _node_idx)
detect if the node has been picked
void setDefaultColorValues()
sets the default color values for selection/handle/region/feature nodes for all objects of this type ...
void unselectFaces(int objectId, IdList _facesList)
Unselect given faces.
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers)
One of the previously registered keys has been pressed.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void unselectHandleVertices(int objectId, IdList _vertexList)
Remove vertices from handle area.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
picks faces (should be implemented for all nodes)
Type for a Meshobject containing a poly mesh.
ACG::Vec4f handleColor_
Handle to selection environment.
void invertFaceSelection(int objectId)
Invert the current face selection.
void growFaceSelection(int objectId)
Grow the current face selection.
Kernel::FaceVertexIter FaceVertexIter
Circulator.
ACG::SceneGraph::BaseNode * getRootNode()
Get the root node for data objects.
void setAllHandleVertices(int objectId)
Set all vertices to be part of the handle area.
void add_entry(const QString &_section, const QString &_key, const QString &_value)
Addition / modification of a string entry.
double get_dihedral_angle_threshold()
get dihedral angle threshold for edge selection
double dihedral_angle_threshold_
Handle to selection environment.
QPolygon lasso_2Dpoints_
Used for lasso selection tool.
void slotFloodFillSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a flood fill selection.
void selectModelingVertices(int objectId, IdList _vertexList)
Set vertices to be part of the modeling area.
picks only visible front verices (may not be implemented for all nodes)
VectorT< float, 4 > Vec4f
void selectAllEdges(int objectId)
Select all Edges.
void slotMouseWheelEvent(QWheelEvent *event, std::string const &mode)
Wheel Event from main application.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(16))
Selection updated.
IdList convertVertexPairsToEdges(int _id, const IdList &_vertices)
Inverse of function above.
bool scenegraphRegionPick(ACG::SceneGraph::PickTarget _pickTarget, const QRegion &_region, QList< QPair< size_t, size_t > > &_list, QVector< float > *_depths, QVector< ACG::Vec3d > *_points)
void setHandleColor(const ACG::Vec4f &_color)
set color for handles
void slotLassoSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a lasso selection.
QtColorChooserButton * colorButtonArea_
Handle to selection environment.
void selectAllHalfedges(int objectId)
Select all Halfedges.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
const QStringList ALL_OBJECTS
Iterable object range.
ACG::Vec4f statusColor_
Handle to selection environment.
bool get_entry(QString &_val, const QString &_section, const QString &_key) const
Access to a string entry.
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 slotVolumeLassoSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a volume lasso selection.
bool selectFace(int _objectId, int _idx, bool _fly_to_face)
Select face with id _idx and maybe fly to it.
void invertHalfedgeSelection(int objectId)
Unselect all Halfedges.
void set_updateGL(bool _b)
should GL matrices be updated after each matrix operation
QtColorChooserButton * colorButtonHandle_
Handle to selection environment.
SelectionInterface::PrimitiveType faceType_
Handle to selection environment.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
void deleteFaceSelection(int _objectId)
Delete face that are currently selected.
bool dataType(DataType _type) const
std::vector< int > IdList
Standard Type for id Lists used for scripting.
SelectionInterface::PrimitiveType vertexType_
Primitive type handles:
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void slotSaveSelection(INIFile &_file)
Save selection for all objects in the scene.
void invertVertexSelection(int _objectId)
Invert the current vertex selection.
double max_angle_
Handle to selection environment.
void convertSelection(const int &_objectId, const QString &_from, const QString &_to, bool _deselect)
Convert the selection on one object.
bool updateGL() const
should GL matrices be updated after each matrix operation
void unselectVertices(int objectId, IdList _vertexList)
unselect given vertices
void slotComponentsSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a connected components selection.
void setAllModelingVertices(int objectId)
Set all vertices to be part of the modeling area.
void selectBoundaryVertices(int _objectId)
Select all boundary vertices of the given object.
IdList getHandleVertices(int objectId)
Get a list of all handle vertices.
void addedEmptyObject(int _id)
An empty object has been added.
void slotSphereSelection(QMouseEvent *_event, double _radius, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a sphere selection.
void update_dihedral_angle_threshold_from_ui()
set dihedral angle threshold for edge selection
bool operator()(BaseNode *_node)
Traverse the scenegraph and call the selection function for all mesh nodes.
QString environmentHandle_
Handle to selection environment.
QtColorChooserButton * colorButtonSelection_
Options.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
IdList convertHalfedgesToVertexPairs(int _id, const IdList &_halfedges)
Convert halfedge ids to vertex pairs.
pick any of the prior targets (should be implemented for all nodes)
void deleteVertexSelection(int _objectId)
Delete vertices and faces that are currently selected.
IdList getModelingVertices(int objectId)
Get a list of all modeling vertices.
void traceEdgePath(int objectId, double threshold)
Trace Edge Path.
void colorizeEdgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
picks verices (may not be implemented for all nodes)
void selectBoundaryHalfedges(int objectId)
Select boundary edges.
void set_dihedral_angle_threshold(const double _a)
set dihedral angle threshold for edge selection
void slotLoadSelection(const INIFile &_file)
Load selection for specific objects in the scene.
void setAreaColor(const ACG::Vec4f &_color)
set color for areas
picks only visible front edges (may not be implemented for all nodes)
PolyMeshObject * polyMeshObject(BaseObjectData *_object)
Cast an BaseObject to a PolyMeshObject if possible.
double get_max_angle()
get max angle for flood fill selection
void selectVertices(int objectId, IdList _vertexList)
select given vertices
Functions for selection on a mesh.
void clearHalfedgeSelection(int objectId)
Invert the current edge selection.
IdList convertVertexPairsToHalfedges(int _id, const IdList &_vertices)
Inverse of function above.
void unselectEdges(int objectId, IdList _edgeList)
Unselect given Edges.
QStringList IteratorRestriction
Iterable object range.
TriMeshObject * triMeshObject(BaseObjectData *_object)
Cast an BaseObject to a TriMeshObject if possible.
Type for a MeshObject containing a triangle mesh.
bool selectVertex(int _objectId, int _idx, bool _fly_to_vertex)
select vertex with id _idx and maybe fly to it
MeshObjectSelectionPlugin()
Default constructor.
IdList getFaceSelection(int objectId)
Return a list of all selected faces.
QtColorChooserButton * colorButtonFeature_
Handle to selection environment.
SelectionInterface::PrimitiveType edgeType_
Handle to selection environment.
void createMeshFromSelection(MeshT &_mesh, MeshT &_newMesh, PrimitiveType _primitiveType)
Create a new mesh from the selection.
IdList getHalfedgeSelection(int objectId)
Return a list of all selected edges.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
void selectFaces(int objectId, IdList _facesList)
Select given faces.
bool selectEdge(int _objectId, int _idx, bool _fly_to_edge)
Select edge with id _idx and maybe fly to it.
void componentsMeshSelection(MeshT *_mesh, int _objectId, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Connected component mesh selection.
void clearHandleVertices(int objectId)
Clear handle Area.
SelectionInterface::PrimitiveType halfedgeType_
Handle to selection environment.
void updateSlotDescriptions()
Set descriptions for local public slots.
Class for the handling of simple configuration files.
SelectionInterface::PrimitiveType allSupportedTypes_
Handle to selection environment.
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
void shrinkFaceSelection(int objectId)
Shrink the current face selection.
bool connect(const QString &name, const bool create)
Connect INIFile object with given filename.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void closestBoundarySelection(MeshT *_mesh, int _vh, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are incident to closest boundary.
void setColorForSelection(const int _objectId, const PrimitiveType _primitiveType)
Set color for selection.
void clearModelingVertices(int objectId)
Clear Modeling Area.
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.
ParameterWidget * parameterWidget_
Handle to selection environment.
void selectAllVertices(int _objectId)
Select all Vertices.
IdList convertEdgesToVertexPairs(int _id, const IdList &_edges)
Convert edge ids to vertex pairs.
bool selectHalfedge(int _objectId, int _idx, bool _fly_to_halfedge)
Select halfedge with id _idx and maybe fly to it.
void setFeatureColor(const ACG::Vec4f &_color)
set color for features
void selectHalfedges(int objectId, IdList _vertexList)
Select given Halfedges.
void setValue(const QString &key, const QVariant &value)
Wrapper function which makes it possible to enable Debugging output with -DOPENFLIPPER_SETTINGS_DEBUG...
void setSelectionColor(const ACG::Vec4f &_color)
set color for selection
void selectAllFaces(int objectId)
Select all faces.
bool section_exists(const QString &_section) const
Check if given section exists in the current INI file.
void conversionRequested()
Show selection conversion dialog.
void clearFaceSelection(int objectId)
Unselect all faces.
void toggleMeshSelection(int _objectId, MeshT *_mesh, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Toggle mesh selection.
void slotClosestBoundarySelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a closest boundary selection.
~MeshObjectSelectionPlugin()
Default destructor.
void colorizeHalfedgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
void lassoSelect(QRegion &_region, PrimitiveType _primitiveType, bool _deselection)
Lasso selection tool.
IdList getEdgeSelection(int objectId)
Return a list of all selected edges.
void invertEdgeSelection(int objectId)
Unselect all Edges.
void update_regions(MeshT *_mesh)
Update face selection to correspond to the vertex selection.
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
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 clearVertexSelection(int _objectId)
Unselect all vertices.
void clearEdgeSelection(int objectId)
Invert the current edge selection.
void growVertexSelection(int _objectId)
Grow the current vertex selection.
void loadFlipperModelingSelection(int _objectId, QString _filename)
Load a selection from an Flipper selection file for the given object.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
void traverse(BaseNode *_node, Action &_action)
void colorizeVertexSelection(int _objectId, int _r, int _g, int _b, int a)
Colorize the vertex selection.
ACG::Vec4f areaColor_
Handle to selection environment.
Traverse the scenegraph and call the selection function for all mesh nodes.
ACG::GLState & glState()
Get the glState of the Viewer.
const UpdateType UPDATE_SELECTION_VERTICES(UpdateTypeSet(32))
Vertex selection has changed.
bool initializeOptionsWidget(QWidget *&_widget)
Initialize the Options Widget.
void colorizeFaceSelection(int objectId, int r, int g, int b, int a)
Colorize the face selection.