diff options
Diffstat (limited to 'source/blender/editors/mesh/editface.c')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 133 |
1 files changed, 58 insertions, 75 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 72d1c703c0e..552f4b3b954 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -152,61 +152,55 @@ MTFace *EM_get_active_mtface(EditMesh *em, EditFace **act_efa, MCol **mcol, int return NULL; } -void paintface_unhide(Scene *scene) +void paintface_hide(Object *ob, const int unselected) { Mesh *me; MFace *mface; int a; - me= get_mesh(OBACT); + me= get_mesh(ob); if(me==0 || me->totface==0) return; - + mface= me->mface; a= me->totface; while(a--) { - if(mface->flag & ME_HIDE) { - mface->flag |= ME_FACE_SEL; - mface->flag -= ME_HIDE; + if((mface->flag & ME_HIDE) == 0) { + if(unselected) { + if( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE; + } + else { + if( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE; + } } + if(mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL; + mface++; } - - paintface_flush_flags(OBACT); + + paintface_flush_flags(ob); } -void paintface_hide(Scene *scene) + +void paintface_reveal(Object *ob) { Mesh *me; MFace *mface; int a; - int shift=0, alt= 0; // XXX - - me= get_mesh(OBACT); + + me= get_mesh(ob); if(me==0 || me->totface==0) return; - - if(alt) { - paintface_unhide(scene); - return; - } - + mface= me->mface; a= me->totface; while(a--) { - if(mface->flag & ME_HIDE); - else { - if(shift) { - if( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE; - } - else { - if( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE; - } + if(mface->flag & ME_HIDE) { + mface->flag |= ME_FACE_SEL; + mface->flag -= ME_HIDE; } - if(mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL; - mface++; } - - paintface_flush_flags(OBACT); + + paintface_flush_flags(ob); } /* Set tface seams based on edge data, uses hash table to find seam edges. */ @@ -359,37 +353,49 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags) me= get_mesh(ob); if(me==0) return; - if (action == SEL_TOGGLE) { - action = SEL_SELECT; - + if(action == SEL_INVERT) { mface= me->mface; a= me->totface; while(a--) { - if((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) { - action = SEL_DESELECT; - break; + if((mface->flag & ME_HIDE) == 0) { + mface->flag ^= ME_FACE_SEL; } mface++; } } - - mface= me->mface; - a= me->totface; - while(a--) { - 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; + else { + 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) == 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++; + } } if(flush_flags) { @@ -397,29 +403,6 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags) } } -void paintface_select_swap(Scene *scene) -{ - Mesh *me; - MFace *mface; - int a; - - me= get_mesh(OBACT); - if(me==0) return; - - mface= me->mface; - a= me->totface; - while(a--) { - if(mface->flag & ME_HIDE); - else { - if(mface->flag & ME_FACE_SEL) mface->flag &= ~ME_FACE_SEL; - else mface->flag |= ME_FACE_SEL; - } - mface++; - } - - paintface_flush_flags(OBACT); -} - int paintface_minmax(Object *ob, float *min, float *max) { Mesh *me= get_mesh(ob); |