diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index e785ec809b6..9d8feb2583b 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -307,10 +307,10 @@ typedef struct TimeMarker { } TimeMarker; typedef struct ToolSettings { - // Subdivide Settings + /* Subdivide Settings */ short cornertype; short editbutflag; - // Extrude Tools + /* Extrude Tools */ short degr; short step; short turn; @@ -320,15 +320,15 @@ typedef struct ToolSettings { float extr_offs; float doublimit; - // Primitive Settings - // UV Sphere + /* Primitive Settings */ + /* UV Sphere */ short segments; short rings; - // Cylinder - Tube - Circle + /* Cylinder - Tube - Circle */ short vertices; - // UV Calculation + /* UV Calculation */ short unwrapper; float uvcalc_radius; float uvcalc_cubesize; @@ -337,6 +337,10 @@ typedef struct ToolSettings { short uvcalc_flag; short pad2; + + /* Select Group Threshold */ + float select_thresh; + } ToolSettings; typedef struct Scene { diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index f96954786dc..2b9a7d78a39 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -3382,45 +3382,46 @@ static void editing_panel_mesh_tools(Object *ob, Mesh *me) uiBlockBeginAlign(block); //uiDefButBitS(block, TOG, B_AUTOFGON, 0, "FGon", 10,195,30,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' To create FGon on inner edges where possible"); - uiDefButBitS(block, TOG, B_BEAUTY, 0, "Beauty", 10,195,40,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' to split faces in halves instead of quarters using long edges unless 'Short' is selected"); - uiDefButBitS(block, TOG, B_BEAUTY_SHORT, 0, "Short", 50,195,40,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "If Beauty is set, 'Subdivide' splits faces in halves using short edges"); + uiDefButBitS(block, TOG, B_BEAUTY, 0, "Beauty", 10,195,53,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Causes 'Subdivide' to split faces in halves instead of quarters using long edges unless 'Short' is selected"); + uiDefButBitS(block, TOG, B_BEAUTY_SHORT, 0, "Short", 63,195,52,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "If Beauty is set, 'Subdivide' splits faces in halves using short edges"); - uiDefBut(block, BUT,B_SUBDIV,"Subdivide", 90,195,80,19, 0, 0, 0, 0, 0, "Splits selected faces into halves or quarters"); + uiDefBut(block, BUT,B_SUBDIV,"Subdivide", 115,195,105,19, 0, 0, 0, 0, 0, "Splits selected faces into halves or quarters"); uiDefButS(block, MENU, B_DIFF, "Corner Cut Type %t|Path %x0|Innervert %x1|Fan %x2", - 170, 195, 85, 19, &G.scene->toolsettings->cornertype , 0, 0, 0, 0, "Choose Quad Corner Cut Type"); + 220, 195, 105, 19, &G.scene->toolsettings->cornertype , 0, 0, 0, 0, "Choose Quad Corner Cut Type"); - uiDefBut(block, BUT,B_VERTEXNOISE,"Noise", 10,175,60,19, 0, 0, 0, 0, 0, "Use vertex coordinate as texture coordinate"); - uiDefBut(block, BUT,B_HASH,"Hash", 70,175,60,19, 0, 0, 0, 0, 0, "Randomizes selected vertex sequence data"); - uiDefBut(block, BUT,B_XSORT,"Xsort", 130,175,60,19, 0, 0, 0, 0, 0, "Sorts selected vertex data in the X direction"); - uiDefBut(block, BUT,B_FRACSUBDIV, "Fractal", 190,175,65,19, 0, 0, 0, 0, 0, "Subdivides selected faces with a random factor"); + uiDefBut(block, BUT,B_VERTEXNOISE,"Noise", 10,175,78,19, 0, 0, 0, 0, 0, "Use vertex coordinate as texture coordinate"); + uiDefBut(block, BUT,B_HASH,"Hash", 88,175,78,19, 0, 0, 0, 0, 0, "Randomizes selected vertex sequence data"); + uiDefBut(block, BUT,B_XSORT,"Xsort", 166,175,78,19, 0, 0, 0, 0, 0, "Sorts selected vertex data in the X direction"); + uiDefBut(block, BUT,B_FRACSUBDIV, "Fractal", 244,175,81,19, 0, 0, 0, 0, 0, "Subdivides selected faces with a random factor"); - uiDefBut(block, BUT,B_TOSPHERE,"To Sphere", 10,155,80,19, 0, 0, 0, 0, 0, "Moves selected vertices outwards into a spherical shape"); - uiDefBut(block, BUT,B_VERTEXSMOOTH,"Smooth", 90,155,80,19, 0, 0, 0, 0, 0, "Flattens angles of selected faces"); - uiDefBut(block, BUT,B_SPLIT,"Split", 170,155,85,19, 0, 0, 0, 0, 0, "Splits selected vertices to separate sub-mesh"); - - uiDefBut(block, BUT,B_FLIPNORM,"Flip Normals", 10,135,80,19, 0, 0, 0, 0, 0, "Toggles the direction of the selected face's normals"); - uiDefBut(block, BUT,B_REMDOUB,"Rem Doubles", 90,135,80,19, 0, 0, 0, 0, 0, "Removes duplicates from selected vertices"); - uiDefButF(block, NUM, B_DIFF, "Limit:", 170,135,85,19, &G.scene->toolsettings->doublimit, 0.0001, 1.0, 10, 0, "Specifies the max distance 'Rem Doubles' will consider vertices as 'doubled'"); + uiDefBut(block, BUT,B_TOSPHERE,"To Sphere", 10,155,78,19, 0, 0, 0, 0, 0, "Moves selected vertices outwards into a spherical shape"); + uiDefBut(block, BUT,B_VERTEXSMOOTH,"Smooth", 88,155,78,19, 0, 0, 0, 0, 0, "Flattens angles of selected faces"); + uiDefBut(block, BUT,B_SPLIT,"Split", 166,155,78,19, 0, 0, 0, 0, 0, "Splits selected vertices to separate sub-mesh"); + uiDefBut(block, BUT,B_FLIPNORM,"Flip Normals", 244,155,81,19, 0, 0, 0, 0, 0, "Toggles the direction of the selected face's normals"); + + uiDefBut(block, BUT,B_REMDOUB,"Rem Doubles", 10,135,78,19, 0, 0, 0, 0, 0, "Removes duplicates from selected vertices"); + uiDefButF(block, NUM, B_DIFF, "Limit:", 88,135,117,19, &G.scene->toolsettings->doublimit, 0.0001, 1.0, 10, 0, "Specifies the max distance 'Rem Doubles' will consider vertices as 'doubled'"); + uiDefButF(block, NUM, B_DIFF, "Threshold:", 205,135,120,19, &G.scene->toolsettings->select_thresh, 0.0001, 1.0, 10, 0, "Tolerence for the 'Select Group' tool (Shift+G)."); uiBlockEndAlign(block); - uiDefBut(block, BUT,B_EXTR,"Extrude", 10,105,245,24, 0, 0, 0, 0, 0, "Converts selected edges to faces and selects the new vertices"); + uiDefBut(block, BUT,B_EXTR,"Extrude", 10,105,315,24, 0, 0, 0, 0, 0, "Converts selected edges to faces and selects the new vertices"); uiBlockBeginAlign(block); - uiDefBut(block, BUT,B_SCREW,"Screw", 10,75,80,24, 0, 0, 0, 0, 0, "Activates the screw tool"); // Bish - This could use some more definition - uiDefBut(block, BUT,B_SPIN, "Spin", 90,75,80,24, 0, 0, 0, 0, 0, "Extrudes the selected vertices in a circle around the cursor in the indicated viewport"); - uiDefBut(block, BUT,B_SPINDUP,"Spin Dup", 170,75,85,24, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a circle around the cursor in the indicated viewport"); + uiDefBut(block, BUT,B_SCREW,"Screw", 10,75,100,24, 0, 0, 0, 0, 0, "Activates the screw tool"); // Bish - This could use some more definition + uiDefBut(block, BUT,B_SPIN, "Spin", 110,75,100,24, 0, 0, 0, 0, 0, "Extrudes the selected vertices in a circle around the cursor in the indicated viewport"); + uiDefBut(block, BUT,B_SPINDUP,"Spin Dup", 210,75,115,24, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a circle around the cursor in the indicated viewport"); - uiDefButS(block, NUM, B_DIFF, "Degr:", 10,55,80,19, &G.scene->toolsettings->degr,10.0,360.0, 0, 0, "Specifies the number of degrees 'Spin' revolves"); - uiDefButS(block, NUM, B_DIFF, "Steps:", 90,55,80,19, &G.scene->toolsettings->step,1.0,180.0, 0, 0, "Specifies the total number of 'Spin' slices"); - uiDefButS(block, NUM, B_DIFF, "Turns:", 170,55,85,19, &G.scene->toolsettings->turn,1.0,360.0, 0, 0, "Specifies the number of revolutions the screw turns"); - uiDefButBitS(block, TOG, B_KEEPORIG, B_DIFF, "Keep Original",10,35,160,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Keeps a copy of the original vertices and faces after executing tools"); - uiDefButBitS(block, TOG, B_CLOCKWISE, B_DIFF, "Clockwise", 170,35,85,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw' and 'Spin'"); + uiDefButS(block, NUM, B_DIFF, "Degr:", 10,55,100,19, &G.scene->toolsettings->degr,10.0,360.0, 0, 0, "Specifies the number of degrees 'Spin' revolves"); + uiDefButS(block, NUM, B_DIFF, "Steps:", 110,55,100,19, &G.scene->toolsettings->step,1.0,180.0, 0, 0, "Specifies the total number of 'Spin' slices"); + uiDefButS(block, NUM, B_DIFF, "Turns:", 210,55,115,19, &G.scene->toolsettings->turn,1.0,360.0, 0, 0, "Specifies the number of revolutions the screw turns"); + uiDefButBitS(block, TOG, B_KEEPORIG, B_DIFF, "Keep Original",10,35,200,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Keeps a copy of the original vertices and faces after executing tools"); + uiDefButBitS(block, TOG, B_CLOCKWISE, B_DIFF, "Clockwise", 210,35,115,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw' and 'Spin'"); uiBlockBeginAlign(block); - uiDefBut(block, BUT,B_EXTREP, "Extrude Dup", 10,10,120,19, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a straight line away from the current viewport"); - uiDefButF(block, NUM, B_DIFF, "Offset:", 130,10,125,19, &G.scene->toolsettings->extr_offs, 0.01, 100.0, 100, 0, "Sets the distance between each copy for 'Extrude Dup'"); + uiDefBut(block, BUT,B_EXTREP, "Extrude Dup", 10,10,150,19, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a straight line away from the current viewport"); + uiDefButF(block, NUM, B_DIFF, "Offset:", 160,10,165,19, &G.scene->toolsettings->extr_offs, 0.01, 100.0, 100, 0, "Sets the distance between each copy for 'Extrude Dup'"); uiBlockEndAlign(block); } diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 84738bfbb0f..7e976d2c89a 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -744,6 +744,9 @@ static int unified_findnearest(EditVert **eve, EditEdge **eed, EditFace **efa) return (*eve || *eed || *efa); } +/* this as a way to compare the ares, perim of 2 faces thay will scale to different sizes */ +#define SCALE_CMP(a,b) (a>0 && fabs(b/a-1)<=thresh) + /* **************** GROUP SELECTS ************** */ /* selects new faces/edges/verts based on the existing selection @@ -767,7 +770,7 @@ int facegroup_select(short mode) unsigned int deselcount=0; short ok=0; - float thresh=G.scene->toolsettings->doublimit; /* todo. better var for this */ + float thresh=G.scene->toolsettings->select_thresh; for(efa= em->faces.first; efa; efa= efa->next) { if (!efa->h) { @@ -824,7 +827,8 @@ int facegroup_select(short mode) } else if (mode==3 || mode==4) { /* same area OR same perimeter, both use the same temp var */ for(efa= em->faces.first; efa; efa= efa->next) { if (!(efa->f & SELECT) && !efa->h) { - if (fabs(efa->tmp.fp-base_efa->tmp.fp)<=thresh) { + if SCALE_CMP(base_efa->tmp.fp, efa->tmp.fp) { + EM_select_face(efa, 1); selcount++; deselcount--; @@ -838,7 +842,7 @@ int facegroup_select(short mode) for(efa= em->faces.first; efa; efa= efa->next) { if (!(efa->f & SELECT) && !efa->h) { angle= VecAngle2(base_efa->n, efa->n); - if (angle<=thresh) { + if (angle/180.0<=thresh) { EM_select_face(efa, 1); selcount++; deselcount--; @@ -853,7 +857,7 @@ int facegroup_select(short mode) for(efa= em->faces.first; efa; efa= efa->next) { if (!(efa->f & SELECT) && !efa->h) { angle= VecAngle2(base_efa->n, efa->n); - if (angle<=thresh) { + if (angle/180.0<=thresh) { dot=Inpf(efa->cent, base_efa->n); if (fabs(base_dot-dot) <= thresh) { EM_select_face(efa, 1); @@ -895,7 +899,7 @@ int edgegroup_select(short mode) unsigned int deselcount=0; short ok=0; - float thresh=G.scene->toolsettings->doublimit; /* todo. better var for this */ + float thresh=G.scene->toolsettings->select_thresh; for(eed= em->edges.first; eed; eed= eed->next) { if (!eed->h) { @@ -974,7 +978,7 @@ int edgegroup_select(short mode) if ( !(eed->f & SELECT) && !eed->h && - fabs(base_eed->tmp.fp - eed->tmp.fp) <= thresh + SCALE_CMP(base_eed->tmp.fp, eed->tmp.fp) ) { EM_select_edge(eed, 1); selcount++; @@ -994,7 +998,7 @@ int edgegroup_select(short mode) if (angle>90) /* use the smallest angle between the edges */ angle= fabs(angle-180.0f); - if (angle<=thresh) { + if (angle/90.0<=thresh) { EM_select_edge(eed, 1); selcount++; deselcount--; @@ -1023,7 +1027,7 @@ int edgegroup_select(short mode) !(eed->f & SELECT) && !eed->h && eed->f2==2 && - (fabs(base_eed->tmp.fp - eed->tmp.fp) <= thresh) + SCALE_CMP(base_eed->tmp.fp, eed->tmp.fp) ) { EM_select_edge(eed, 1); selcount++; @@ -1058,7 +1062,7 @@ int vertgroup_select(short mode) unsigned int deselcount=0; short ok=0; - float thresh=G.scene->toolsettings->doublimit; /* todo. better var for this */ + float thresh=G.scene->toolsettings->select_thresh; for(eve= em->verts.first; eve; eve= eve->next) { if (!eve->h) { @@ -1100,7 +1104,7 @@ int vertgroup_select(short mode) for(eve= em->verts.first; eve; eve= eve->next) { if (!(eve->f & SELECT) && !eve->h) { angle= VecAngle2(base_eve->no, eve->no); - if (angle<=thresh) { + if (angle/180.0<=thresh) { eve->f |= SELECT; selcount++; deselcount--; diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index 7ca4b4b1a55..f6d65b7affe 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -887,6 +887,9 @@ void do_view3d_select_meshmenu(void *arg, int event) case 20: /* region to loop */ region_to_loop(); break; + case 21: /* Select grouped */ + select_mesh_group_menu(); + break; } allqueue(REDRAWVIEW3D, 0); } @@ -933,6 +936,9 @@ static uiBlock *view3d_select_meshmenu(void *arg_unused) 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, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, + "Group From Selection|Shift G", + 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index c0700de8ad2..798ca55f5a0 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -858,6 +858,7 @@ static TBitem tb_mesh_select[]= { { 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, "Group From Selection|Shift G", 21, NULL}, { 0, "SEPR", 0, NULL}, { 0, "More|Ctrl NumPad +", 7, NULL}, { 0, "Less|Ctrl NumPad -", 8, NULL},