diff options
author | Ton Roosendaal <ton@blender.org> | 2004-11-30 16:06:00 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2004-11-30 16:06:00 +0300 |
commit | d9e4a8580e20594b6555273383d7cecb6e6da40a (patch) | |
tree | 3c9ba1e49459ad774997cc830de98d6095c0c5f3 | |
parent | 6d9c02be4cfd61b985af789e167f7fa78dbc0868 (diff) |
On report from IRC: expand/shrink selection (CTRL + numpad-plus/minus) did
not work with edge/face selection modes correctly yet.
-rw-r--r-- | source/blender/src/editmesh_lib.c | 1 | ||||
-rw-r--r-- | source/blender/src/editmesh_mods.c | 123 | ||||
-rw-r--r-- | source/blender/src/editscreen.c | 10 | ||||
-rw-r--r-- | source/blender/src/interface_draw.c | 11 |
4 files changed, 68 insertions, 77 deletions
diff --git a/source/blender/src/editmesh_lib.c b/source/blender/src/editmesh_lib.c index d74c4d77b47..3d6fc8e653a 100644 --- a/source/blender/src/editmesh_lib.c +++ b/source/blender/src/editmesh_lib.c @@ -227,6 +227,7 @@ void EM_set_flag_all(int flag) } +/* flush for changes in vertices only */ void EM_deselect_flush(void) { EditMesh *em = G.editMesh; diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 07fb23511ee..2e5c49ad26e 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -1477,13 +1477,15 @@ void select_more(void) } } - /* new selected edges */ - for(eed= em->edges.first; eed; eed= eed->next) { - if(eed->h==0) { - if(eed->v1->f1 && eed->v2->f1) EM_select_edge(eed, 1); + /* new selected edges, but not in facemode */ + if(G.scene->selectmode <= SCE_SELECT_EDGE) { + + for(eed= em->edges.first; eed; eed= eed->next) { + if(eed->h==0) { + if(eed->v1->f1 && eed->v2->f1) EM_select_edge(eed, 1); + } } } - /* new selected faces */ for(efa= em->faces.first; efa; efa= efa->next) { if(efa->h==0) { @@ -1500,81 +1502,64 @@ void select_more(void) void select_less(void) { EditMesh *em = G.editMesh; - EditVert *eve; EditEdge *eed; EditFace *efa; - /* eve->f1 & 1 => isolated */ - /* eve->f1 & 2 => on an edge */ - /* eve->f1 & 4 => shares edge with a deselected vert */ - /* eve->f1 & 8 => at most one neighbor */ - - for(eve= em->verts.first; eve; eve= eve->next) { - /* assume vert is isolated unless proven otherwise, */ - /* assume at most one neighbor too */ - eve->f1 = 1 | 8; - } - - for(eed= em->edges.first; eed; eed= eed->next) { - eed->f1= 0; - if(eed->h==0) { - /* this will count how many faces are connected to - * this edge */ - - /* if vert wasn't isolated, it now has more than one neighbor */ - if (~eed->v1->f1 & 1) eed->v1->f1 &= ~8; - if (~eed->v2->f1 & 1) eed->v2->f1 &= ~8; - - /* verts on edge are clearly not isolated */ - eed->v1->f1 &= ~1; - eed->v2->f1 &= ~1; - - /* if one of the verts on the edge is deselected, - * deselect the other */ - if ( (~eed->v1->f & SELECT) ) - eed->v2->f1 |= 4; - if ( (~eed->v2->f & SELECT) ) - eed->v1->f1 |= 4; - } - } + if(G.scene->selectmode <= SCE_SELECT_EDGE) { + /* eed->f1 == 1: edge with a selected and deselected vert */ - for(efa= em->faces.first; efa; efa= efa->next) { - /* increase face count for edges */ - if(efa->h==0) { - ++efa->e1->f1; - ++efa->e2->f1; - ++efa->e3->f1; - if (efa->e4) ++efa->e4->f1; + for(eed= em->edges.first; eed; eed= eed->next) { + eed->f1= 0; + if(eed->h==0) { + + if ( !(eed->v1->f & SELECT) && (eed->v2->f & SELECT) ) + eed->f1= 1; + if ( (eed->v1->f & SELECT) && !(eed->v2->f & SELECT) ) + eed->f1= 1; + } } - } - - for(eed= em->edges.first; eed; eed= eed->next) { - /* if the edge has only one neighboring face, then - * deselect attached verts */ - if (eed->h==0 && eed->f1 == 1) { - eed->v1->f1 |= 2; - eed->v2->f1 |= 2; + + /* deselect edges with flag set */ + for(eed= em->edges.first; eed; eed= eed->next) { + if (eed->h==0 && eed->f1 == 1) { + EM_select_edge(eed, 0); + } } + EM_deselect_flush(); + } + else { + /* deselect faces with 1 or more deselect edges */ + /* eed->f1 == mixed selection edge */ + for(eed= em->edges.first; eed; eed= eed->next) eed->f1= 0; - /* deselect verts */ - for(eve= em->verts.first; eve; eve= eve->next) { - if (eve->f1) { - eve->f &= ~SELECT; + for(efa= em->faces.first; efa; efa= efa->next) { + if(efa->h==0) { + if(efa->f & SELECT) { + efa->e1->f1 |= 1; + efa->e2->f1 |= 1; + efa->e3->f1 |= 1; + if(efa->e4) efa->e4->f1 |= 1; + } + else { + efa->e1->f1 |= 2; + efa->e2->f1 |= 2; + efa->e3->f1 |= 2; + if(efa->e4) efa->e4->f1 |= 2; + } + } } - } - - /* now rebuild selection state for edges & faces */ - for(eed= em->edges.first; eed; eed= eed->next) { - if(eed->v1->f1 && eed->v2->f1) EM_select_edge(eed, 0); - } - for(efa= em->faces.first; efa; efa= efa->next) { - if(efa->h==0) { - if(efa->v1->f1 && efa->v2->f1 && efa->v3->f1 && (efa->v4==NULL || efa->v4->f1)) - EM_select_face(efa, 0); + for(efa= em->faces.first; efa; efa= efa->next) { + if(efa->h==0) { + if(efa->e1->f1==3 || efa->e2->f1==3 || efa->e3->f1==3 || (efa->e4 && efa->e4->f1==3)) { + EM_select_face(efa, 0); + } + } } + EM_selectmode_flush(); + } - + countall(); allqueue(REDRAWVIEW3D, 0); } diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c index 6539eb8a447..8f85a87c23b 100644 --- a/source/blender/src/editscreen.c +++ b/source/blender/src/editscreen.c @@ -631,6 +631,7 @@ int is_allowed_to_change_screen(bScreen *new) void splash(void *data, int datasize, char *string) { + extern void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy); ImBuf *bbuf; int oldwin; short val; @@ -657,14 +658,7 @@ void splash(void *data, int datasize, char *string) } glDrawBuffer(GL_FRONT); - /* - // this dims the whole screen a bit. I didn't like it afterall - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f(0.0,0.0,0.0,0.3); - glRecti(0, 0, G.curscreen->sizex, G.curscreen->sizey); - glDisable(GL_BLEND); - */ + uiDrawBoxShadow(200, (prefsizx-bbuf->x)/2, (prefsizy-bbuf->y)/2, (prefsizx+bbuf->x)/2, (prefsizy+bbuf->y)/2); glRasterPos2i((prefsizx-bbuf->x)/2, (prefsizy-bbuf->y)/2); glDrawPixels(bbuf->x, bbuf->y, GL_RGBA, GL_UNSIGNED_BYTE, bbuf->rect); diff --git a/source/blender/src/interface_draw.c b/source/blender/src/interface_draw.c index 220b11e2cee..6553a9c75cb 100644 --- a/source/blender/src/interface_draw.c +++ b/source/blender/src/interface_draw.c @@ -1350,6 +1350,15 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s glShadeModel(GL_FLAT); } +void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) +{ + /* accumulated outline boxes to make shade not linear, is more pleasant */ + ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*alpha)>>8); + ui_shadowbox(minx, miny, maxx, maxy, 4.0, (70*alpha)>>8); + ui_shadowbox(minx, miny, maxx, maxy, 2.0, (100*alpha)>>8); + +} + // background for pulldowns, pullups, and other drawing temporal menus.... // has to be made themable still (now only color) @@ -1374,6 +1383,8 @@ void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag) glDisable(GL_BLEND); } + + /* pulldown menu item */ static void ui_draw_pulldown_item(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag) { |