diff options
-rw-r--r-- | source/blender/include/BIF_editmesh.h | 1 | ||||
-rw-r--r-- | source/blender/src/editmesh_loop.c | 77 | ||||
-rw-r--r-- | source/blender/src/editmesh_mods.c | 2 | ||||
-rw-r--r-- | source/blender/src/editmesh_tools.c | 14 |
4 files changed, 51 insertions, 43 deletions
diff --git a/source/blender/include/BIF_editmesh.h b/source/blender/include/BIF_editmesh.h index 76cb9cada9c..7c5554de198 100644 --- a/source/blender/include/BIF_editmesh.h +++ b/source/blender/include/BIF_editmesh.h @@ -182,6 +182,7 @@ extern short sharesFace(struct EditEdge* e1, struct EditEdge* e2); #define SUBDIV_SELECT_ORIG 0 #define SUBDIV_SELECT_INNER 1 #define SUBDIV_SELECT_INNER_SEL 2 +#define SUBDIV_SELECT_LOOPCUT 3 extern void convert_to_triface(int direction); extern int removedoublesflag(short flag, float limit); diff --git a/source/blender/src/editmesh_loop.c b/source/blender/src/editmesh_loop.c index e3d910fef10..609b68b5cf5 100644 --- a/source/blender/src/editmesh_loop.c +++ b/source/blender/src/editmesh_loop.c @@ -126,7 +126,7 @@ static void edgering_sel(EditEdge *startedge, int select, int previewlines) looking= 0; for(efa= em->faces.first; efa; efa= efa->next) { - if(efa->e4 && efa->f1==0) { // not done quad + if(efa->e4 && efa->f1==0 && efa->h == 0) { // not done quad if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { // valence ok // if edge tagged, select opposing edge and mark face ok @@ -166,36 +166,38 @@ static void edgering_sel(EditEdge *startedge, int select, int previewlines) //glEnd(); for(efa= em->faces.first; efa; efa= efa->next) { if(efa->v4 == NULL) { continue; } - if(efa->e1->f2 == 1){ - if(efa->e1->h == 1 || efa->e3->h == 1 ) - continue; - - v[0][0] = efa->v1; - v[0][1] = efa->v2; - v[1][0] = efa->v4; - v[1][1] = efa->v3; - } else if(efa->e2->f2 == 1){ - if(efa->e2->h == 1 || efa->e4->h == 1) - continue; - v[0][0] = efa->v2; - v[0][1] = efa->v3; - v[1][0] = efa->v1; - v[1][1] = efa->v4; - } else { continue; } - - for(i=1;i<=previewlines;i++){ - co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0])*(i/((float)previewlines+1))+v[0][0]->co[0]; - co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1])*(i/((float)previewlines+1))+v[0][0]->co[1]; - co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2])*(i/((float)previewlines+1))+v[0][0]->co[2]; - - co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0])*(i/((float)previewlines+1))+v[1][0]->co[0]; - co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1]; - co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2]; - glColor3ub(255, 0, 255); - glBegin(GL_LINES); - glVertex3f(co[0][0],co[0][1],co[0][2]); - glVertex3f(co[1][0],co[1][1],co[1][2]); - glEnd(); + if(efa->h == 0){ + if(efa->e1->f2 == 1){ + if(efa->e1->h == 1 || efa->e3->h == 1 ) + continue; + + v[0][0] = efa->v1; + v[0][1] = efa->v2; + v[1][0] = efa->v4; + v[1][1] = efa->v3; + } else if(efa->e2->f2 == 1){ + if(efa->e2->h == 1 || efa->e4->h == 1) + continue; + v[0][0] = efa->v2; + v[0][1] = efa->v3; + v[1][0] = efa->v1; + v[1][1] = efa->v4; + } else { continue; } + + for(i=1;i<=previewlines;i++){ + co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0])*(i/((float)previewlines+1))+v[0][0]->co[0]; + co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1])*(i/((float)previewlines+1))+v[0][0]->co[1]; + co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2])*(i/((float)previewlines+1))+v[0][0]->co[2]; + + co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0])*(i/((float)previewlines+1))+v[1][0]->co[0]; + co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1]; + co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2]; + glColor3ub(255, 0, 255); + glBegin(GL_LINES); + glVertex3f(co[0][0],co[0][1],co[0][2]); + glVertex3f(co[1][0],co[1][1],co[1][2]); + glEnd(); + } } } glPopMatrix(); @@ -373,23 +375,14 @@ void CutEdgeloop(int numcuts) /* select edge ring */ edgering_sel(nearest, 1, 0); - /* Deselect Hidden Edges */ - for(eed=em->edges.first; eed; eed = eed->next){ - if(eed->h == 1 || (eed->v1->h == 1 || eed->v2->h == 1)){ - EM_select_edge(eed,0); - hasHidden = 1; - } - } - - /* now cut the loops */ if(smooth){ fac= 1.0f; if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return; fac= 0.292f*fac; - esubdivideflag(SELECT,fac,B_SMOOTH,numcuts,SUBDIV_SELECT_INNER_SEL); + esubdivideflag(SELECT,fac,B_SMOOTH,numcuts,SUBDIV_SELECT_LOOPCUT); } else { - esubdivideflag(SELECT,0,0,numcuts,SUBDIV_SELECT_INNER_SEL); + esubdivideflag(SELECT,0,0,numcuts,SUBDIV_SELECT_LOOPCUT); } /* if this was a single cut, enter edgeslide mode */ if(numcuts == 1 && hasHidden == 0){ diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 19c6d6d509e..14d30401c1d 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -1407,7 +1407,7 @@ static void edgering_select(EditEdge *startedge, int select){ looking= 0; for(efa= em->faces.first; efa; efa= efa->next) { - if(efa->e4 && efa->f1==0) { /* not done quad */ + if(efa->e4 && efa->f1==0 && !efa->h) { /* not done quad */ if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { /* valence ok */ /* if edge tagged, select opposing edge and mark face ok */ diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index 1d3b218362f..45369e05883 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -1190,6 +1190,9 @@ void fill_mesh(void) #define EDGEINNER 4 #define EDGEOLD 8 +/*used by faceloop cut to select only edges valid for edge slide*/ +#define DOUBLEOPFILL 16 + /* Mostly mirrored from editdeform.c, here only used for the function below */ /* Only to be used to add new weights in eve, the value of weight has been premultiplied with subdiv factor, so is added only */ static void subdiv_add_defweight (EditVert *eve, int defgroup, float weight) @@ -1718,6 +1721,7 @@ static void fill_quad_double_op(EditFace *efa, struct GHash *gh, int numcuts) hold = addfacelist(verts[0][i],verts[0][i+1],verts[1][vertsize-2-i],verts[1][vertsize-1-i],NULL,NULL); if(i < vertsize-2) { hold->e2->f2 |= EDGEINNER; + hold->e2->f2 |= DOUBLEOPFILL; } facecopy(efa,hold); } @@ -2656,6 +2660,16 @@ void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype) EM_select_edge(eed,0); } } + } else if(seltype == SUBDIV_SELECT_LOOPCUT){ + for(eed = em->edges.first;eed;eed = eed->next) { + if(eed->f2 & DOUBLEOPFILL){ + eed->f |= flag; + EM_select_edge(eed,1); + }else{ + eed->f &= !flag; + EM_select_edge(eed,0); + } + } } if(G.scene->selectmode & SCE_SELECT_VERTEX) { for(eed = em->edges.first;eed;eed = eed->next) { |