diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-04-10 15:45:07 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-04-10 15:45:07 +0400 |
commit | 5a3ab0e32ecff0f1ff4cfc8cedf64f63b2291a5b (patch) | |
tree | cb38143220cd31d4cbe3775bb57853e46f3ffc9e /source/blender | |
parent | a64339d319a9e2b4de31adca0e546d3109c5f041 (diff) |
Found a bug where "make dupes real" would crash, when the group was an extternal link. - 1 liner fix from Ton.
Also added "sort faces by selection" to the sort menu.
DNA_meshdata_types use C comments for GCC verbose warnings to be quiet
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesdna/DNA_meshdata_types.h | 4 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 2 | ||||
-rw-r--r-- | source/blender/src/meshtools.c | 59 |
3 files changed, 39 insertions, 26 deletions
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index 6dceb73d253..f61b919a426 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -57,7 +57,7 @@ typedef struct MDeformWeight { typedef struct MDeformVert { struct MDeformWeight *dw; int totweight; - int flag; // flag only in use for weightpaint now + int flag; /* flag only in use for weightpaint now */ } MDeformVert; typedef struct MVert { @@ -150,7 +150,7 @@ typedef struct PartialVisibility { #define ME_EDGEDRAW (1<<1) #define ME_SEAM (1<<2) #define ME_FGON (1<<3) - // reserve 16 for ME_HIDE + /* reserve 16 for ME_HIDE */ #define ME_EDGERENDER (1<<5) #define ME_LOOSEEDGE (1<<7) #define ME_SEAM_LAST (1<<8) diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 0a1f29c0d48..27e05f60c70 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -4938,6 +4938,8 @@ void make_duplilist_real() if(okee("Make dupli objects real")==0) return; + clear_id_newpoins(); + base= FIRSTBASE; while(base) { if TESTBASELIB(base) { diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c index e61cfd12a86..90689feee2c 100644 --- a/source/blender/src/meshtools.c +++ b/source/blender/src/meshtools.c @@ -477,7 +477,7 @@ void sort_faces(void) if(G.obedit) return; if(ob->type!=OB_MESH) return; - event = pupmenu("Sort Faces by%t|View Axis (back to front)%x1|View Axis (front to back)%x2|Cursor Distance (near to far)%x3|Cursor Distance (far to near)%x4|Randomize%x5"); + event = pupmenu("Sort Faces by%t|View Axis (back to front)%x1|View Axis (front to back)%x2|Cursor Distance (near to far)%x3|Cursor Distance (far to near)%x4|Selected First%x5|Selected Last%x6|Randomize%x7"); if (event==-1) return; me= ob->data; @@ -493,12 +493,12 @@ void sort_faces(void) /* sort index list instead of faces itself and apply this permutation to all face layers */ - if (event == 5) { + if (event == 7) { /* Random */ for(i=0; i<me->totface; i++) { face_sort_floats[i] = BLI_frand(); } - qsort(index, me->totface, sizeof(int), float_sort); + qsort(index, me->totface, sizeof(int), float_sort); } else { /* event is 1 or 2*/ MFace *mf; float vec[3]; @@ -521,28 +521,39 @@ void sort_faces(void) mf= me->mface; for(i=0; i<me->totface; i++, mf++) { - /* find the faces center */ - VECADD(vec, (me->mvert+mf->v1)->co, (me->mvert+mf->v2)->co); - if (mf->v4) { - VECADD(vec, vec, (me->mvert+mf->v3)->co); - VECADD(vec, vec, (me->mvert+mf->v4)->co); - VECMUL(vec, 0.25f); - } else { - VECADD(vec, vec, (me->mvert+mf->v3)->co); - VECMUL(vec, 1.0f/3.0f); - } /* done */ - if (event == 1 || event == 2) { /* sort on view axis */ - Mat4MulVecfl(mat, vec); - if (event==2) - face_sort_floats[i] = -vec[2]; /* front to back */ - else - face_sort_floats[i] = vec[2]; /* back to front */ - } else { /* distance from cursor*/ - if (event==3) - face_sort_floats[i] = VecLenf(cur, vec); /* back to front */ - else if (event==4) - face_sort_floats[i] = -VecLenf(cur, vec); /* front to back*/ + if (event==5) { + /*selected first*/ + if (mf->flag & ME_FACE_SEL) face_sort_floats[i] = 0.0; + else face_sort_floats[i] = 1.0; + } else if (event==6) { + /*selected last*/ + if (mf->flag & ME_FACE_SEL) face_sort_floats[i] = 1.0; + else face_sort_floats[i] = 0.0; + } else { + /* find the faces center */ + VECADD(vec, (me->mvert+mf->v1)->co, (me->mvert+mf->v2)->co); + if (mf->v4) { + VECADD(vec, vec, (me->mvert+mf->v3)->co); + VECADD(vec, vec, (me->mvert+mf->v4)->co); + VECMUL(vec, 0.25f); + } else { + VECADD(vec, vec, (me->mvert+mf->v3)->co); + VECMUL(vec, 1.0f/3.0f); + } /* done */ + + if (event == 1 || event == 2) { /* sort on view axis */ + Mat4MulVecfl(mat, vec); + if (event==2) + face_sort_floats[i] = -vec[2]; /* front to back */ + else + face_sort_floats[i] = vec[2]; /* back to front */ + } else { /* distance from cursor*/ + if (event==3) + face_sort_floats[i] = VecLenf(cur, vec); /* back to front */ + else if (event==4) + face_sort_floats[i] = -VecLenf(cur, vec); /* front to back*/ + } } } qsort(index, me->totface, sizeof(int), float_sort); |