From 8c70caf9665217554708318362e8a6c8ffef2906 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 13 Apr 2012 03:41:07 +0000 Subject: fix for UV reveal (wasnt selecting all verts because check for unselected vert was incorrect after selecting the first face). --- intern/utfconv/CMakeLists.txt | 2 +- source/blender/bmesh/intern/bmesh_marking.c | 4 ++-- source/blender/bmesh/intern/bmesh_marking.h | 2 +- source/blender/editors/mesh/editmesh_tools.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 30 +++++++++++++++++++--------- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/intern/utfconv/CMakeLists.txt b/intern/utfconv/CMakeLists.txt index 8da03427c37..118d1710e53 100644 --- a/intern/utfconv/CMakeLists.txt +++ b/intern/utfconv/CMakeLists.txt @@ -21,7 +21,7 @@ set(INC ) set(INC_SYS - ${GLEW_INCLUDE_PATH} + ) set(SRC diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index a83987be94c..1b80bda318e 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -452,7 +452,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode) * Deselect's one type of elements then re-selects another, * Use case is to de-select stray edges or verts. */ -void BM_mesh_select_flush_strip(BMesh *bm, const char htype_desel, const char htype_sel) +void BM_mesh_select_flush_strip(BMesh *bm, const char htype_desel, const char htype_sel, const char hflag_test) { const char iter_types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, @@ -477,7 +477,7 @@ void BM_mesh_select_flush_strip(BMesh *bm, const char htype_desel, const char ht if (htype_sel & flag_types[i]) { ele = BM_iter_new(&iter, bm, iter_types[i], NULL); for ( ; ele; ele = BM_iter_step(&iter)) { - if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { + if (BM_elem_flag_test(ele, hflag_test)) { BM_elem_select_set(bm, ele, TRUE); } } diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index b981f917df6..b72b3f73950 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -60,7 +60,7 @@ void BM_mesh_select_mode_flush(BMesh *bm); void BM_mesh_deselect_flush(BMesh *bm); void BM_mesh_select_flush(BMesh *bm); -void BM_mesh_select_flush_strip(BMesh *bm, const char htype_desel, const char htype_sel); +void BM_mesh_select_flush_strip(BMesh *bm, const char htype_desel, const char htype_sel, const char hflag_test); int BM_mesh_enabled_flag_count(BMesh *bm, const char htype, const char hflag, int respecthide); int BM_mesh_disabled_flag_count(BMesh *bm, const char htype, const char hflag, int respecthide); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 9ceb30267d1..43a0cf1c6a4 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4534,7 +4534,7 @@ static int edbm_inset_exec(bContext *C, wmOperator *op) BM_mesh_elem_flag_disable_all(em->bm, BM_VERT | BM_EDGE, BM_ELEM_SELECT, FALSE); BMO_slot_buffer_hflag_disable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, FALSE); /* so selected faces verts & edges get selected */ - BM_mesh_select_flush_strip(em->bm, BM_VERT | BM_EDGE, BM_FACE); + BM_mesh_select_flush_strip(em->bm, BM_VERT | BM_EDGE, BM_FACE, BM_ELEM_SELECT); } if (!EDBM_op_finish(em, &bmop, op, TRUE)) { diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 96511ed2bac..53826eec758 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3094,6 +3094,9 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) int facemode= sima ? sima->flag & SI_SELACTFACE : 0; int stickymode= sima ? (sima->sticky != SI_STICKY_DISABLE) : 1; + /* note on tagging, selecting faces needs to be delayed so it doesn't select the verts and + * confuse our checks on selected verts. */ + /* call the mesh function if we are in mesh sync sel */ if (ts->uv_flag & UV_SYNC_SELECTION) { EDBM_mesh_reveal(em); @@ -3104,12 +3107,14 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) if (facemode) { if (em->selectmode == SCE_SELECT_FACE) { BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { + BM_elem_flag_disable(efa, BM_ELEM_TAG); if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - BM_elem_select_set(em->bm, efa, TRUE); BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); luv->flag |= MLOOPUV_VERTSEL; } + /* BM_elem_select_set(em->bm, efa, TRUE); */ + BM_elem_flag_enable(efa, BM_ELEM_TAG); } } } @@ -3117,6 +3122,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) /* enable adjacent faces to have disconnected UV selections if sticky is disabled */ if (!stickymode) { BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { + BM_elem_flag_disable(efa, BM_ELEM_TAG); if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { int totsel=0; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { @@ -3128,14 +3134,15 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); luv->flag |= MLOOPUV_VERTSEL; } - - BM_elem_select_set(em->bm, efa, TRUE); + /* BM_elem_select_set(em->bm, efa, TRUE); */ + BM_elem_flag_enable(efa, BM_ELEM_TAG); } } } } else { BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { + BM_elem_flag_disable(efa, BM_ELEM_TAG); if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)==0) { @@ -3143,8 +3150,8 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) luv->flag |= MLOOPUV_VERTSEL; } } - - BM_elem_select_set(em->bm, efa, TRUE); + /* BM_elem_select_set(em->bm, efa, TRUE); */ + BM_elem_flag_enable(efa, BM_ELEM_TAG); } } } @@ -3152,18 +3159,20 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) } else if (em->selectmode == SCE_SELECT_FACE) { BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { + BM_elem_flag_disable(efa, BM_ELEM_TAG); if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); luv->flag |= MLOOPUV_VERTSEL; } - - BM_elem_select_set(em->bm, efa, TRUE); + /* BM_elem_select_set(em->bm, efa, TRUE); */ + BM_elem_flag_enable(efa, BM_ELEM_TAG); } } } else { BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { + BM_elem_flag_disable(efa, BM_ELEM_TAG); if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)==0) { @@ -3171,12 +3180,15 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op)) luv->flag |= MLOOPUV_VERTSEL; } } - - BM_elem_select_set(em->bm, efa, TRUE); + /* BM_elem_select_set(em->bm, efa, TRUE); */ + BM_elem_flag_enable(efa, BM_ELEM_TAG); } } } + /* de-select none, re-select tagged faces */ + BM_mesh_select_flush_strip(em->bm, 0, BM_FACE, BM_ELEM_TAG); + WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); return OPERATOR_FINISHED; -- cgit v1.2.3