diff options
Diffstat (limited to 'source/blender/editors/mesh/editface.c')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 9754a7db4fe..4fa7a19a1b3 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -99,15 +99,17 @@ void object_facesel_flush_dm(Object *ob) int totface; int i; - - if(me==NULL || dm==NULL || !CustomData_has_layer( &dm->faceData, CD_ORIGINDEX)) + if(me==NULL || dm==NULL) + return; + + index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX); + + if(!index_array) return; faces = dm->getTessFaceArray(dm); totface = dm->getNumTessFaces(dm); - index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX); - mf= faces; for (i= 0; i<totface; i++, mf++) { /* loop over derived mesh faces */ @@ -125,7 +127,7 @@ int facesel_face_pick(struct bContext *C, Mesh *me, short *mval, unsigned int *i if (!me || me->totface==0) return 0; -// XXX if (v3d->flag & V3D_NEEDBACKBUFDRAW) { +// XXX if (v3d->flag & V3D_INVALID_BACKBUF) { // XXX drawview.c! check_backbuf(); // XXX persp(PERSP_VIEW); // XXX } @@ -378,34 +380,44 @@ void select_linked_tfaces(bContext *C, Object *ob, short mval[2], int mode) object_facesel_flush_dm(ob); } -void deselectall_tface(Object *ob) +void selectall_tface(Object *ob, int action) { Mesh *me; MFace *mface; - int a, sel; + int a; me= get_mesh(ob); if(me==0) return; - mface= me->mface; - a= me->totface; - sel= 0; - while(a--) { - if(mface->flag & ME_HIDE); - else if(mface->flag & ME_FACE_SEL) { - sel= 1; - break; + if (action == SEL_TOGGLE) { + action = SEL_SELECT; + + mface= me->mface; + a= me->totface; + while(a--) { + if((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) { + action = SEL_DESELECT; + break; + } + mface++; } - mface++; } mface= me->mface; a= me->totface; while(a--) { - if(mface->flag & ME_HIDE); - else { - if(sel) mface->flag &= ~ME_FACE_SEL; - else mface->flag |= ME_FACE_SEL; + if((mface->flag & ME_HIDE) == 0) { + switch (action) { + case SEL_SELECT: + mface->flag |= ME_FACE_SEL; + break; + case SEL_DESELECT: + mface->flag &= ~ME_FACE_SEL; + break; + case SEL_INVERT: + mface->flag ^= ME_FACE_SEL; + break; + } } mface++; } @@ -815,7 +827,7 @@ int face_select(struct bContext *C, Object *ob, short mval[2], int extend) return 1; } -void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select) +void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select, int extend) { Mesh *me; MFace *mface; @@ -837,6 +849,14 @@ void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select) sy= (rect->ymax-rect->ymin+1); if(sx*sy<=0) return; + if (extend == 0 && select) { + mface= me->mface; + for(a=1; a<=me->totface; a++, mface++) { + if((mface->flag & ME_HIDE) == 0) + mface->flag &= ~ME_FACE_SEL; + } + } + view3d_validate_backbuf(&vc); ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0); |