diff options
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 28 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_uv.c | 8 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_convert_mesh.c | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 4 |
5 files changed, 34 insertions, 12 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 4bf43a2034a..90ad90058e7 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -109,7 +109,9 @@ void EDBM_update_generic(struct BMEditMesh *em, const bool is_destructive); struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm, - const bool selected, + struct Scene *scene, + const bool face_selected, + const bool uv_selected, const bool use_winding, const bool do_islands); void BM_uv_element_map_free(struct UvElementMap *vmap); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 42404554ed8..67f8db71e54 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -51,6 +51,7 @@ #include "ED_mesh.h" #include "ED_screen.h" +#include "ED_uvedit.h" #include "ED_view3d.h" #include "mesh_intern.h" /* own include */ @@ -662,7 +663,9 @@ UvMapVert *BM_uv_vert_map_at_index(UvVertMap *vmap, unsigned int v) /* A specialized vert map used by stitch operator */ UvElementMap *BM_uv_element_map_create(BMesh *bm, - const bool selected, + const Scene *scene, + const bool face_selected, + const bool uv_selected, const bool use_winding, const bool do_islands) { @@ -689,8 +692,17 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, /* generate UvElement array */ BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { - if (!selected || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - totuv += efa->len; + if (!face_selected || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { + if (!uv_selected) { + totuv += efa->len; + } + else { + BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { + if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { + totuv++; + } + } + } } } @@ -715,7 +727,7 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, winding[j] = false; } - if (!selected || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { + if (!face_selected || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { float(*tf_uv)[2] = NULL; if (use_winding) { @@ -723,6 +735,10 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, } BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) { + if (uv_selected && !uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { + continue; + } + buf->l = l; buf->separate = 0; buf->island = INVALID_ISLAND; @@ -832,6 +848,10 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, efa = stack[--stacksize]; BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { + if (uv_selected && !uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { + continue; + } + UvElement *element, *initelement = element_map->vert[BM_elem_index_get(l->v)]; for (element = initelement; element; element = element->next) { diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 8fbaf3396bd..72b02436b92 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -521,18 +521,18 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm if (do_island_optimization) { /* We will need island information */ if (ts->uv_flag & UV_SYNC_SELECTION) { - data->elementMap = BM_uv_element_map_create(bm, false, true, true); + data->elementMap = BM_uv_element_map_create(bm, scene, false, false, true, true); } else { - data->elementMap = BM_uv_element_map_create(bm, true, true, true); + data->elementMap = BM_uv_element_map_create(bm, scene, true, false, true, true); } } else { if (ts->uv_flag & UV_SYNC_SELECTION) { - data->elementMap = BM_uv_element_map_create(bm, false, true, false); + data->elementMap = BM_uv_element_map_create(bm, scene, false, false, true, false); } else { - data->elementMap = BM_uv_element_map_create(bm, true, true, false); + data->elementMap = BM_uv_element_map_create(bm, scene, true, false, true, false); } } diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 8b7dcecf9e8..006f913f218 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1451,7 +1451,7 @@ void createTransUVs(bContext *C, TransInfo *t) if (is_prop_connected || is_island_center) { /* create element map with island information */ const bool use_facesel = (ts->uv_flag & UV_SYNC_SELECTION) == 0; - elementmap = BM_uv_element_map_create(em->bm, use_facesel, false, true); + elementmap = BM_uv_element_map_create(em->bm, scene, use_facesel, true, false, true); if (elementmap == NULL) { continue; } diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 5a8301fae67..5d3d016e6c1 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1935,10 +1935,10 @@ static StitchState *stitch_init(bContext *C, /* in uv synch selection, all uv's are visible */ if (ts->uv_flag & UV_SYNC_SELECTION) { - state->element_map = BM_uv_element_map_create(state->em->bm, false, true, true); + state->element_map = BM_uv_element_map_create(state->em->bm, scene, false, false, true, true); } else { - state->element_map = BM_uv_element_map_create(state->em->bm, true, true, true); + state->element_map = BM_uv_element_map_create(state->em->bm, scene, true, false, true, true); } if (!state->element_map) { state_delete(state); |