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()) {
142 QRect scr = QApplication::desktop()->screenGeometry();
150 QString(
"Vertex Selection;Edge Selection;Halfedge Selection;Face Selection;" \
151 "Feature Vertices;Feature Edges;Feature Faces;Handle Region;Modeling Region").split(
";"));
153 QString(
"Vertex Selection;Edge Selection;Halfedge Selection;Face Selection;" \
154 "Feature Vertices;Feature Edges;Feature Faces;Handle Region;Modeling Region").split(
";"));
161 void MeshObjectSelectionPlugin::pluginsInitialized() {
166 QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
168 emit addSelectionEnvironment(
"Mesh Object Selections",
"Select mesh object primitives such as vertices, (half-)edges and faces.",
196 QStringList generalOperations;
197 generalOperations.append(G_CLEAR_HANDLE);
198 generalOperations.append(G_CLEAR_MODEL);
199 generalOperations.append(G_CONVERT);
202 QStringList vertexOperations;
203 vertexOperations.append(V_SELECT_ALL);
204 vertexOperations.append(V_CLEAR);
205 vertexOperations.append(V_INVERT);
206 vertexOperations.append(V_BOUNDARY);
207 vertexOperations.append(V_SHRINK);
208 vertexOperations.append(V_GROW);
209 vertexOperations.append(V_DELETE);
210 vertexOperations.append(V_COLORIZE);
211 vertexOperations.append(V_COPYSELECTION);
212 vertexOperations.append(V_HANDLE);
213 vertexOperations.append(V_MODELING);
214 vertexOperations.append(V_LOAD_FLIPPER);
217 QStringList edgeOperations;
218 edgeOperations.append(E_SELECT_ALL);
219 edgeOperations.append(E_CLEAR);
220 edgeOperations.append(E_INVERT);
221 edgeOperations.append(E_DELETE);
222 edgeOperations.append(E_BOUNDARY);
223 edgeOperations.append(E_COLORIZE);
224 edgeOperations.append(E_COPYSELECTION);
225 edgeOperations.append(E_TRACE_PATH);
228 QStringList hedgeOperations;
229 hedgeOperations.append(HE_SELECT_ALL);
230 hedgeOperations.append(HE_CLEAR);
231 hedgeOperations.append(HE_INVERT);
232 hedgeOperations.append(HE_BOUNDARY);
233 hedgeOperations.append(HE_COLORIZE);
236 QStringList faceOperations;
237 faceOperations.append(F_SELECT_ALL);
238 faceOperations.append(F_CLEAR);
239 faceOperations.append(F_INVERT);
240 faceOperations.append(F_DELETE);
241 faceOperations.append(F_BOUNDARY);
242 faceOperations.append(F_SHRINK);
243 faceOperations.append(F_GROW);
244 faceOperations.append(F_COLORIZE);
245 faceOperations.append(F_COPYSELECTION);
248 QStringList colorOperations;
249 colorOperations.append(C_SELECTIONCOLOR);
250 colorOperations.append(C_FEATURECOLOR);
251 colorOperations.append(C_AREACOLOR);
252 colorOperations.append(C_HANDLECOLOR);
254 emit addSelectionOperations(
environmentHandle_, generalOperations,
"Selection Operations");
259 emit addSelectionOperations(
environmentHandle_, colorOperations,
"Highlight Operations");
261 if(!OpenFlipper::Options::nogui())
267 emit registerKeyShortcut(Qt::Key_A, Qt::ControlModifier);
269 emit registerKeyShortcut(Qt::Key_C, Qt::NoModifier);
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(TriMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
941 if(mesh->status(*e_it).selected()) {
942 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
943 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).idx());
949 std::vector<int> ids;
950 for(PolyMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
951 if(mesh->status(*e_it).selected()) {
952 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
953 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).idx());
958 }
else if (_to ==
"Modeling Region") {
961 std::vector<int> ids;
962 for(TriMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
963 if(mesh->status(*e_it).selected()) {
964 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
965 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).idx());
971 std::vector<int> ids;
972 for(PolyMesh::EdgeIter e_it = mesh->edges_begin(); e_it != mesh->edges_end(); ++e_it) {
973 if(mesh->status(*e_it).selected()) {
974 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 0)).idx());
975 ids.push_back(mesh->to_vertex_handle(mesh->halfedge_handle(*e_it, 1)).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(TriMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1006 if(mesh->status(*h_it).selected()) {
1007 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1008 ids.push_back(mesh->from_vertex_handle(*h_it).idx());
1014 std::vector<int> ids;
1015 for(PolyMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1016 if(mesh->status(*h_it).selected()) {
1017 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1018 ids.push_back(mesh->from_vertex_handle(*h_it).idx());
1023 }
else if (_to ==
"Modeling Region") {
1026 std::vector<int> ids;
1027 for(TriMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1028 if(mesh->status(*h_it).selected()) {
1029 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1030 ids.push_back(mesh->from_vertex_handle(*h_it).idx());
1036 std::vector<int> ids;
1037 for(PolyMesh::HalfedgeIter h_it = mesh->halfedges_begin(); h_it != mesh->halfedges_end(); ++h_it) {
1038 if(mesh->status(*h_it).selected()) {
1039 ids.push_back(mesh->to_vertex_handle(*h_it).idx());
1040 ids.push_back(mesh->from_vertex_handle(*h_it).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(TriMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1076 if(mesh->status(*f_it).selected()) {
1078 ids.push_back(fv_it->idx());
1085 std::vector<int> ids;
1086 for(PolyMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1087 if(mesh->status(*f_it).selected()) {
1089 ids.push_back(fv_it->idx());
1095 }
else if (_to ==
"Modeling Region") {
1098 std::vector<int> ids;
1099 for(TriMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1100 if(mesh->status(*f_it).selected()) {
1102 ids.push_back(fv_it->idx());
1109 std::vector<int> ids;
1110 for(PolyMesh::FaceIter f_it = mesh->faces_begin(); f_it != mesh->faces_end(); ++f_it) {
1111 if(mesh->status(*f_it).selected()) {
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);
1521 void 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)
1583 void 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);
1597 void 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 )
1721 void 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) {
1858 if (o_it->visible()) {
1872 }
else if(_key == Qt::Key_I && _modifiers == Qt::NoModifier) {
1876 if (o_it->visible()) {
1890 }
else if (_key == Qt::Key_Delete && _modifiers == Qt::NoModifier) {
1894 if (o_it->visible()) {
1912 SelectionInterface::PrimitiveType type = 0u;
1913 emit getActivePrimitiveType(type);
1922 bool targetsOnly =
false;
1923 emit targetObjectsOnly(targetsOnly);
1927 if(event->modifiers() == Qt::ShiftModifier) {
1929 if (event->delta() > 0) {
1932 if (o_it->visible()) {
1946 if (o_it->visible()) {
1961 PrimitiveType _primitiveType,
1962 bool _deselection) {
1965 QList <QPair<size_t, size_t> > list;
1970 std::set<int> alreadySelectedObjects;
1972 for(
int i = 0; i < list.size(); ++i) {
1974 if(alreadySelectedObjects.count(list[i].first) != 0)
1982 for(
int j = 0; j < list.size(); ++j) {
1983 if(list[j].first == list[i].first) {
1985 elements.push_back(list[j].second);
1992 alreadySelectedObjects.insert(list[i].first);
2001 std::set<int> alreadySelectedObjects;
2003 for(
int i = 0; i < list.size(); ++i) {
2005 if(alreadySelectedObjects.count(list[i].first) != 0)
2013 for(
int j = 0; j < list.size(); ++j) {
2014 if(list[j].first == list[i].first) {
2016 elements.push_back(list[j].second);
2023 alreadySelectedObjects.insert(list[i].first);
2032 std::set<int> alreadySelectedObjects;
2034 for(
int i = 0; i < list.size(); ++i) {
2036 if(alreadySelectedObjects.count(list[i].first) != 0)
2044 for(
int j = 0; j < list.size(); ++j) {
2045 if(list[j].first == list[i].first) {
2047 elements.push_back(list[j].second);
2080 alreadySelectedObjects.insert(list[i].first);
2089 std::set<int> alreadySelectedObjects;
2091 for(
int i = 0; i < list.size(); ++i) {
2093 if(alreadySelectedObjects.count(list[i].first) != 0)
2101 for(
int j = 0; j < list.size(); ++j) {
2102 if(list[j].first == list[i].first) {
2104 elements.push_back(list[j].second);
2111 alreadySelectedObjects.insert(list[i].first);
2125 bool selected =
false;
2129 selected = plugin_->volumeSelection(m, object->
id(), state_, ®ion_, type_, deselection_);
2134 selected = plugin_->volumeSelection(m, object->
id(), state_, ®ion_, type_, deselection_);
2154 emit log(
LOGERR, tr(
"Unable to get object"));
2162 emit log(
LOGERR, tr(
"Unable to get mesh"));
2171 emit log(
LOGERR, tr(
"Unable to add empty object"));
2181 emit log(
LOGERR, tr(
"Unable to get mesh"));
2196 emit log(
LOGERR, tr(
"Unable to get mesh"));
2205 emit log(
LOGERR, tr(
"Unable to add empty object"));
2215 emit log(
LOGERR, tr(
"Unable to get mesh"));
2226 emit log(
LOGERR, tr(
"DataType not supported"));
2234 if (OpenFlipper::Options::gui())
2243 std::stringstream sstream;
2276 _widget =
new QWidget();
2277 QVBoxLayout* vLayout =
new QVBoxLayout();
2278 QHBoxLayout* hLayout =
new QHBoxLayout();
2280 hLayout->addWidget(
new QLabel(
"Select default colors for newly created objects. Does not affect already created objects."));
2281 vLayout->addLayout(hLayout);
2283 hLayout =
new QHBoxLayout();
2285 hLayout->addWidget(
new QLabel(
"Selection Color: "));
2287 vLayout->addLayout(hLayout);
2289 hLayout =
new QHBoxLayout();
2291 hLayout->addWidget(
new QLabel(
"Handle Color: "));
2293 vLayout->addLayout(hLayout);
2295 hLayout =
new QHBoxLayout();
2297 hLayout->addWidget(
new QLabel(
"Feature Color: "));
2299 vLayout->addLayout(hLayout);
2301 hLayout =
new QHBoxLayout();
2303 hLayout->addWidget(
new QLabel(
"Area Color: "));
2305 vLayout->addLayout(hLayout);
2307 hLayout =
new QHBoxLayout();
2308 QPushButton* restoreDefault =
new QPushButton();
2310 restoreDefault->setText(
"Restore Default");
2311 hLayout->addWidget(restoreDefault);
2312 hLayout->addStretch();
2313 vLayout->addLayout(hLayout);
2315 _widget->setLayout(vLayout);
2320 void MeshObjectSelectionPlugin::applyOptions()
2332 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.
void deleteEdgeSelection(int _objectId)
Delete edges that are currently selected.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
#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.
const UpdateType UPDATE_SELECTION_VERTICES(UpdateTypeSet(1)<< 5)
Vertex selection has changed.
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.
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 UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
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.
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.
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
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.
bool initializeOptionsWidget(QWidget *&_widget)
Initialize the Options Widget.
void colorizeFaceSelection(int objectId, int r, int g, int b, int a)
Colorize the face selection.