diff options
author | Chris Want <cwant@ualberta.ca> | 2005-08-17 02:11:40 +0400 |
---|---|---|
committer | Chris Want <cwant@ualberta.ca> | 2005-08-17 02:11:40 +0400 |
commit | c6abd2d1061bc648500a093e12f6e40eb9ac870f (patch) | |
tree | 7886369c1923cfd7868e7cef909187bd4c6f1e3b /source/blender | |
parent | 235733d220b62f74ddb3bb29f1924f9187b9c71b (diff) |
For lukep:
In face select mode, select faces by triangle/quad/other.
Available through header menu, toolbox, or hot keys.
Hot keys are:
ctrl-shift-alt-3: Select all triangles
ctrl-shift-alt-4: Select all quads
ctrl-shift-alt-5: Select all non-triangles/quads
(maybe a bit sore for the wrist)
And also available through the menu/toolbox.
I've never used f-gons so I don't know if the 'select other'
function works there (or works at all, for that matter).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/include/BIF_editmesh.h | 1 | ||||
-rw-r--r-- | source/blender/src/editmesh_mods.c | 38 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 23 | ||||
-rw-r--r-- | source/blender/src/space.c | 16 | ||||
-rw-r--r-- | source/blender/src/toolbox.c | 3 |
5 files changed, 80 insertions, 1 deletions
diff --git a/source/blender/include/BIF_editmesh.h b/source/blender/include/BIF_editmesh.h index fa03da8ed76..ffb89be9687 100644 --- a/source/blender/include/BIF_editmesh.h +++ b/source/blender/include/BIF_editmesh.h @@ -127,6 +127,7 @@ extern void editmesh_align_view_to_selected(struct View3D *v3d, int axis); /* Selection */ extern void select_non_manifold(void); +extern void select_faces_by_numverts(int numverts); extern void select_more(void); extern void select_less(void); extern void selectrandom_mesh(void); diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index de07b865f21..650271ac73c 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -1395,6 +1395,44 @@ void reveal_mesh(void) BIF_undo_push("Reveal"); } +void select_faces_by_numverts(int numverts) +{ + EditMesh *em = G.editMesh; + EditFace *efa; + + /* Selects isolated verts, and edges that do not have 2 neighboring + * faces + */ + + if(G.scene->selectmode!=SCE_SELECT_FACE) { + error("Only works in face selection mode"); + return; + } + + efa= em->faces.first; + while(efa) { + if (efa->e4) { + EM_select_face(efa, (numverts==4) ); + } + else if (efa->e3) { + EM_select_face(efa, (numverts==3) ); + } + else + EM_select_face(efa, (numverts!=3) && (numverts!=4) ); + efa= efa->next; + } + + countall(); + addqueue(curarea->win, REDRAW, 0); + + if (numverts==3) + BIF_undo_push("Select Triangles"); + else if (numverts==4) + BIF_undo_push("Select Quads"); + else + BIF_undo_push("Select non-Triangles/Quads"); +} + void select_non_manifold(void) { EditMesh *em = G.editMesh; diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 031a6fec5e0..6f2d48b0ef0 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -828,6 +828,16 @@ void do_view3d_select_meshmenu(void *arg, int event) case 9: /* select less */ select_non_manifold(); break; + case 11: /* select triangles */ + select_faces_by_numverts(3); + break; + case 12: /* select quads */ + select_faces_by_numverts(4); + break; + case 13: /* select non-triangles/quads */ + select_faces_by_numverts(5); + break; + } allqueue(REDRAWVIEW3D, 0); } @@ -859,6 +869,19 @@ static uiBlock *view3d_select_meshmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Triangles|Ctrl Alt Shift 3", + 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Quads|Ctrl Alt Shift 4", + 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Non-Triangles/Quads|Ctrl Alt Shift 5", + 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, + menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "More|Ctrl NumPad +", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Less|Ctrl NumPad -", diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 2f17181874e..4943e9d2064 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1026,6 +1026,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) flip_subdivison(ob, 3); } } + else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) { + if ( (G.obedit) && (G.obedit->type==OB_MESH) ) + select_faces_by_numverts(3); + } else do_layer_buttons(2); break; @@ -1035,11 +1039,21 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) flip_subdivison(ob, 4); } } + else if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) { + if ( (G.obedit) && (G.obedit->type==OB_MESH) ) + select_faces_by_numverts(4); + } else do_layer_buttons(3); break; case FIVEKEY: - do_layer_buttons(4); break; + if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) { + if ( (G.obedit) && (G.obedit->type==OB_MESH) ) + select_faces_by_numverts(5); + } + else do_layer_buttons(4); + break; + case SIXKEY: do_layer_buttons(5); break; case SEVENKEY: diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index 712eaa47020..d64bca254a6 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -1645,6 +1645,9 @@ static TBitem tb_mesh_select[]= { { 0, "SEPR", 0, NULL}, { 0, "Random...", 5, NULL}, { 0, "Non-Manifold|Shift Ctrl Alt M", 9, NULL}, +{ 0, "Triangles|Shift Ctrl Alt 3", 11, NULL}, +{ 0, "Quads|Shift Ctrl Alt 4", 12, NULL}, +{ 0, "Non-Triangles/Quads|Shift Ctrl Alt 5", 13, NULL}, { 0, "SEPR", 0, NULL}, { 0, "More|Ctrl NumPad +", 7, NULL}, { 0, "Less|Ctrl NumPad -", 8, NULL}, |