diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-11-25 15:37:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-11-25 15:54:39 +0300 |
commit | a9ddee0e568578ff02cc2dee9dfb8a63e7cc522c (patch) | |
tree | 368537eecb1987be1cca0155dfa69fc5b6b5bc5b /source/blender/editors | |
parent | d7d1fc5c748234218d24210f0739104a8195a532 (diff) |
Fix T46867: Face-Mask hiding failed on mode switch
Since GPU refactor, hidden faces are cached.
However this needs to be re-calculated when state of hidden faces changes.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editface.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 4 |
3 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 8e19ec839d8..c509aeb4ac2 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -196,7 +196,7 @@ void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct BMEd /* editface.c */ -void paintface_flush_flags(struct Object *ob); +void paintface_flush_flags(struct Object *ob, short flag); bool paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], bool extend, bool deselect, bool toggle); int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, bool select, bool extend); void paintface_deselect_all_visible(struct Object *ob, int action, bool flush_flags); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 0017cd3c2ae..e5b4e661773 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -53,11 +53,13 @@ #include "WM_api.h" #include "WM_types.h" +#include "GPU_buffers.h" + /* own include */ /* copy the face flags, most importantly selection from the mesh to the final derived mesh, * use in object mode when selecting faces (while painting) */ -void paintface_flush_flags(Object *ob) +void paintface_flush_flags(Object *ob, short flag) { Mesh *me = BKE_mesh_from_object(ob); DerivedMesh *dm = ob->derivedFinal; @@ -66,6 +68,8 @@ void paintface_flush_flags(Object *ob) int totpoly; int i; + BLI_assert((flag & ~(SELECT | ME_HIDE)) == 0); + if (me == NULL) return; @@ -73,7 +77,9 @@ void paintface_flush_flags(Object *ob) /* we could call this directly in all areas that change selection, * since this could become slow for realtime updates (circle-select for eg) */ - BKE_mesh_flush_select_from_polys(me); + if (flag & SELECT) { + BKE_mesh_flush_select_from_polys(me); + } if (dm == NULL) return; @@ -90,9 +96,15 @@ void paintface_flush_flags(Object *ob) /* Copy flags onto the final derived poly from the original mesh poly */ mp_orig = me->mpoly + index_array[i]; polys[i].flag = mp_orig->flag; + } } } + + if (flag & ME_HIDE) { + /* draw-object caches hidden faces, force re-generation T46867 */ + GPU_drawobject_free(dm); + } } void paintface_hide(Object *ob, const bool unselected) @@ -122,7 +134,7 @@ void paintface_hide(Object *ob, const bool unselected) BKE_mesh_flush_hidden_from_polys(me); - paintface_flush_flags(ob); + paintface_flush_flags(ob, SELECT | ME_HIDE); } @@ -147,7 +159,7 @@ void paintface_reveal(Object *ob) BKE_mesh_flush_hidden_from_polys(me); - paintface_flush_flags(ob); + paintface_flush_flags(ob, SELECT | ME_HIDE); } /* Set tface seams based on edge data, uses hash table to find seam edges. */ @@ -241,7 +253,7 @@ void paintface_select_linked(bContext *C, Object *ob, const int mval[2], const b select_linked_tfaces_with_seams(me, index, select); - paintface_flush_flags(ob); + paintface_flush_flags(ob, SELECT); } void paintface_deselect_all_visible(Object *ob, int action, bool flush_flags) @@ -287,7 +299,7 @@ void paintface_deselect_all_visible(Object *ob, int action, bool flush_flags) } if (flush_flags) { - paintface_flush_flags(ob); + paintface_flush_flags(ob, SELECT); } } @@ -376,7 +388,7 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b /* image window redraw */ - paintface_flush_flags(ob); + paintface_flush_flags(ob, SELECT); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data); ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views return true; @@ -454,7 +466,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool exten glReadBuffer(GL_BACK); #endif - paintface_flush_flags(vc->obact); + paintface_flush_flags(vc->obact, SELECT); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 3c0987221bd..0a465c751d2 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -784,7 +784,7 @@ static void do_lasso_select_paintface(ViewContext *vc, const int mcords[][2], sh EDBM_backbuf_free(); - paintface_flush_flags(ob); + paintface_flush_flags(ob, SELECT); } #if 0 @@ -2462,7 +2462,7 @@ static void paint_facesel_circle_select(ViewContext *vc, const bool select, cons if (bbsel) { edbm_backbuf_check_and_select_tfaces(me, select); EDBM_backbuf_free(); - paintface_flush_flags(ob); + paintface_flush_flags(ob, SELECT); } } |