diff options
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_utils.c | 27 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 31 |
3 files changed, 34 insertions, 26 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index f5ab002e0ef..2ecbaf778ce 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -130,7 +130,7 @@ struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace * void EDBM_uv_vert_map_free(struct UvVertMap *vmap); struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v); -struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, const float limit[2]); +struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, bool use_select, const float limit[2]); void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag); void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index b95c8a05353..4fd85383446 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -682,8 +682,10 @@ void undo_push_mesh(bContext *C, const char *name) undo_editmode_push(C, name, getEditMesh, free_undo, undoMesh_to_editbtMesh, editbtMesh_to_undoMesh, NULL); } -/* write comment here */ -UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, const float limit[2]) +/** + * Return a new UVVertMap from the editmesh + */ +UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, bool use_select, const float limit[2]) { BMVert *ev; BMFace *efa; @@ -696,6 +698,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, const float lim MLoopUV *luv; unsigned int a; int totverts, i, totuv; + const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); BM_mesh_elem_index_ensure(em->bm, BM_VERT | BM_FACE); @@ -704,8 +707,9 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, const float lim /* generate UvMapVert array */ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT))) + if ((use_select == false) || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { totuv += efa->len; + } } if (totuv == 0) { @@ -726,7 +730,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, const float lim a = 0; BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT))) { + if ((use_select == false) || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { i = 0; BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { buf->tfindex = i; @@ -761,7 +765,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, const float lim /* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ l = BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa, v->tfindex); - luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); + luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); uv = luv->uv; lastv = NULL; @@ -773,7 +777,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, const float lim /* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */ l = BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa, iterv->tfindex); - luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); + luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); uv2 = luv->uv; sub_v2_v2v2(uvdiff, uv2, uv); @@ -831,6 +835,8 @@ UvElementMap *EDBM_uv_element_map_create(BMEditMesh *em, int selected, int do_is BMFace **stack; int stacksize = 0; + const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); + BM_mesh_elem_index_ensure(em->bm, BM_VERT | BM_FACE); totverts = em->bm->totvert; @@ -843,8 +849,9 @@ UvElementMap *EDBM_uv_element_map_create(BMEditMesh *em, int selected, int do_is /* generate UvElement array */ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { - if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT))) + if (!selected || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { totuv += efa->len; + } } if (totuv == 0) { @@ -869,7 +876,7 @@ UvElementMap *EDBM_uv_element_map_create(BMEditMesh *em, int selected, int do_is j = 0; BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { island_number[j++] = INVALID_ISLAND; - if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT))) { + if (!selected || BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) { buf->l = l; buf->separate = 0; @@ -898,7 +905,7 @@ UvElementMap *EDBM_uv_element_map_create(BMEditMesh *em, int selected, int do_is newvlist = v; l = v->l; - luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); + luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); uv = luv->uv; lastv = NULL; @@ -908,7 +915,7 @@ UvElementMap *EDBM_uv_element_map_create(BMEditMesh *em, int selected, int do_is next = iterv->next; l = iterv->l; - luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); + luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); uv2 = luv->uv; sub_v2_v2v2(uvdiff, uv2, uv); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5b5e5206e9c..2f037de31e5 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -52,12 +52,14 @@ #include "DNA_movieclip_types.h" #include "DNA_scene_types.h" /* PET modes */ -#include "RNA_access.h" - -#include "BIF_gl.h" -#include "BIF_glutil.h" - -#include "BLF_api.h" +#include "BLI_utildefines.h" +#include "BLI_math.h" +#include "BLI_rect.h" +#include "BLI_listbase.h" +#include "BLI_string.h" +#include "BLI_ghash.h" +#include "BLI_linklist.h" +#include "BLI_smallhash.h" #include "BKE_nla.h" #include "BKE_bmesh.h" @@ -69,6 +71,9 @@ #include "BKE_unit.h" #include "BKE_mask.h" +#include "BIF_gl.h" +#include "BIF_glutil.h" + #include "ED_image.h" #include "ED_keyframing.h" #include "ED_screen.h" @@ -79,21 +84,17 @@ #include "ED_clip.h" #include "ED_mask.h" -#include "UI_view2d.h" #include "WM_types.h" #include "WM_api.h" -#include "BLI_math.h" -#include "BLI_blenlib.h" -#include "BLI_utildefines.h" -#include "BLI_ghash.h" -#include "BLI_linklist.h" -#include "BLI_smallhash.h" -#include "BLI_array.h" - +#include "UI_view2d.h" #include "UI_interface_icons.h" #include "UI_resources.h" +#include "RNA_access.h" + +#include "BLF_api.h" + #include "transform.h" static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg); |