diff options
author | Daniel Dunbar <daniel@zuster.org> | 2005-08-21 11:19:20 +0400 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2005-08-21 11:19:20 +0400 |
commit | 7804860cf61b8fc522405740180d10181d174187 (patch) | |
tree | 6331ac308c233fca06416e95d0c0473d3606aa20 /source/blender/src/editface.c | |
parent | d29f7c2c8489442bbca4a76774d4f961dad0173b (diff) |
- added mesh_strip_loose_faces, works in conjunction with make_edges
to get rid of faces with MFace.v3==0
- change all Mesh's to have ->medge now. This is forced by make_edges
on readfile, and in the various exotic important routines, and on
conversion back in python.
- make python NMesh structure always have medges now (needs testing)
- with above two changes it is guarenteed that mf->v3 is never ==0
in main blender code (i.e., all MFace's are actually triangles
or quads) and so I went through and removed all the historic tests
to deal with MFace.v3==0. Equals lots of deleting, I am in heaven!
- removed MEdge edcode flag, no longer needed
- added experimental replacement for edge flag system
Still are some inconsistencies in FACESELECT mode edge drawing to
be ironed out.
NOTE: This commit adds an experimental edge flag calc system, based
on 10-seconds-of-thought algorithm by yours truly. Would appreciate
feedback on how this system works, esp compared to old one and esp
on complex or interesting models.
To Use: New system is enabled by setting G.rt to a value between
1 and 1000 (Value of 0 uses old system). Value 1000 is reserved for
"auto" edge, which is more or less identical to old system but also
makes sure that at least 10% of edges are drawn (solves errors for
super subdivided meshes). Values between 1 and 999 act as percent
(out of 1000) of edges that should be drawn, starting with "most
interesting" edges first. Please try it and comment!
Diffstat (limited to 'source/blender/src/editface.c')
-rw-r--r-- | source/blender/src/editface.c | 111 |
1 files changed, 9 insertions, 102 deletions
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c index e735f9c1254..0a084afe4f8 100644 --- a/source/blender/src/editface.c +++ b/source/blender/src/editface.c @@ -117,7 +117,7 @@ static void uv_calc_center_vector(float *result, Object *ob, Mesh *me) tface= me->tface; mface= me->mface; for(a=0; a<me->totface; a++, mface++, tface++) { - if(tface->flag & TF_SELECT && mface->v3) { + if(tface->flag & TF_SELECT) { DO_MINMAX((me->mvert+mface->v1)->co, min, max); DO_MINMAX((me->mvert+mface->v2)->co, min, max); DO_MINMAX((me->mvert+mface->v3)->co, min, max); @@ -311,7 +311,7 @@ void calculate_uv_map(unsigned short mapmode) tface= me->tface; mface= me->mface; for(a=0; a<me->totface; a++, mface++, tface++) { - if(tface->flag & TF_SELECT && mface->v3) { + if(tface->flag & TF_SELECT) { uv_calc_shift_project(tface->uv[0],cent,rotatematrix,3,(me->mvert+mface->v1)->co,min,max); uv_calc_shift_project(tface->uv[1],cent,rotatematrix,3,(me->mvert+mface->v2)->co,min,max); uv_calc_shift_project(tface->uv[2],cent,rotatematrix,3,(me->mvert+mface->v3)->co,min,max); @@ -327,7 +327,7 @@ void calculate_uv_map(unsigned short mapmode) tface= me->tface; mface= me->mface; for(a=0; a<me->totface; a++, mface++, tface++) { - if(tface->flag & TF_SELECT && mface->v3) { + if(tface->flag & TF_SELECT) { if(mface->v4) b= 3; else b= 2; for(; b>=0; b--) { tface->uv[b][0]= ((tface->uv[b][0]-min[0])*fac)/dx; @@ -344,7 +344,7 @@ void calculate_uv_map(unsigned short mapmode) tface= me->tface; mface= me->mface; for(a=0; a<me->totface; a++, mface++, tface++) { - if(tface->flag & TF_SELECT && mface->v3) { + if(tface->flag & TF_SELECT) { uv_calc_shift_project(tface->uv[0],cent,rotatematrix,4,(me->mvert+mface->v1)->co,NULL,NULL); uv_calc_shift_project(tface->uv[1],cent,rotatematrix,4,(me->mvert+mface->v2)->co,NULL,NULL); uv_calc_shift_project(tface->uv[2],cent,rotatematrix,4,(me->mvert+mface->v3)->co,NULL,NULL); @@ -385,7 +385,7 @@ void calculate_uv_map(unsigned short mapmode) tface= me->tface; mface= me->mface; for(a=0; a<me->totface; a++, mface++, tface++) { - if(tface->flag & TF_SELECT && mface->v3) { + if(tface->flag & TF_SELECT) { uv_calc_shift_project(tface->uv[0],cent,rotatematrix,mapmode,(me->mvert+mface->v1)->co,NULL,NULL); uv_calc_shift_project(tface->uv[1],cent,rotatematrix,mapmode,(me->mvert+mface->v2)->co,NULL,NULL); uv_calc_shift_project(tface->uv[2],cent,rotatematrix,mapmode,(me->mvert+mface->v3)->co,NULL,NULL); @@ -422,7 +422,7 @@ void calculate_uv_map(unsigned short mapmode) tface= me->tface; mface= me->mface; for(a=0; a<me->totface; a++, mface++, tface++) { - if(tface->flag & TF_SELECT && mface->v3) { + if(tface->flag & TF_SELECT) { CalcNormFloat((mv+mface->v1)->co, (mv+mface->v2)->co, (mv+mface->v3)->co, no); no[0]= fabs(no[0]); @@ -467,7 +467,7 @@ void calculate_uv_map(unsigned short mapmode) tface= me->tface; mface= me->mface; for(a=0; a<me->totface; a++, mface++, tface++) { - if(!(tface->flag & TF_SELECT && mface->v3)) continue; + if(!(tface->flag & TF_SELECT)) continue; dx= dy= 0; if(mface->v4) b= 3; else b= 2; @@ -656,10 +656,6 @@ void select_linked_tfaces(int mode) { Object *ob; Mesh *me; - TFace *tf; - MFace *mf; - int a, doit=1, mark=0; - char *cpmain, *linkflag; short mval[2]; unsigned int index=0; @@ -675,96 +671,7 @@ void select_linked_tfaces(int mode) if (!face_pick(me, mval[0], mval[1], &index)) return; } - if(me->medge) { - select_linked_tfaces_with_seams(mode, me, index); - return; - } - - cpmain= MEM_callocN(me->totvert, "cpmain"); - linkflag= MEM_callocN(sizeof(char)*me->totface, "linkflaguv"); - - if (mode==0 || mode==1) { - /* only put face under cursor in array */ - mf= ((MFace*)me->mface) + index; - cpmain[mf->v1]= cpmain[mf->v2]= cpmain[mf->v3]= 1; - if (mf->v4) cpmain[mf->v4]= 1; - linkflag[index]= 1; - } - else { - /* fill array by selection */ - tf= me->tface; - mf= me->mface; - for(a=0; a<me->totface; a++, tf++, mf++) { - if(tf->flag & TF_HIDE); - else if(tf->flag & TF_SELECT) { - if(mf->v3) { - cpmain[mf->v1]= 1; - cpmain[mf->v2]= 1; - cpmain[mf->v3]= 1; - if(mf->v4) cpmain[mf->v4]= 1; - linkflag[a]= 1; - } - } - } - } - - while(doit) { - doit= 0; - - /* expand selection */ - tf= me->tface; - mf= me->mface; - for(a=0; a<me->totface; a++, tf++, mf++) { - if(tf->flag & TF_HIDE); - else if(mf->v3 && !linkflag[a]) { - mark= 0; - - if(cpmain[mf->v1] || cpmain[mf->v2] || cpmain[mf->v3]) - mark= 1; - else if(mf->v4 && cpmain[mf->v4]) - mark= 1; - - if(mark) { - linkflag[a]= 1; - cpmain[mf->v1]= cpmain[mf->v2]= cpmain[mf->v3]= 1; - if(mf->v4) cpmain[mf->v4]= 1; - doit= 1; - } - } - } - - } - - if(mode==0 || mode==2) { - for(a=0, tf=me->tface; a<me->totface; a++, tf++) - if(linkflag[a]) - tf->flag |= TF_SELECT; - else - tf->flag &= ~TF_SELECT; - } - else if(mode==1) { - for(a=0, tf=me->tface; a<me->totface; a++, tf++) - if(linkflag[a] && (tf->flag & TF_SELECT)) - break; - - if (a<me->totface) { - for(a=0, tf=me->tface; a<me->totface; a++, tf++) - if(linkflag[a]) - tf->flag &= ~TF_SELECT; - } - else { - for(a=0, tf=me->tface; a<me->totface; a++, tf++) - if(linkflag[a]) - tf->flag |= TF_SELECT; - } - } - - MEM_freeN(cpmain); - MEM_freeN(linkflag); - - BIF_undo_push("Select linked UV face"); - - object_tface_flags_changed(OBACT, 0); + select_linked_tfaces_with_seams(mode, me, index); } void deselectall_tface() @@ -984,7 +891,7 @@ void minmax_tface(float *min, float *max) mf= me->mface; tf= me->tface; for (a=me->totface; a>0; a--, mf++, tf++) { - if (!mf->v3 || tf->flag & TF_HIDE || !(tf->flag & TF_SELECT)) + if (tf->flag & TF_HIDE || !(tf->flag & TF_SELECT)) continue; VECCOPY(vec, (mv+mf->v1)->co); |