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/mesh/editface.c | |
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/mesh/editface.c')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 28 |
1 files changed, 20 insertions, 8 deletions
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; } |