Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-06-20 12:28:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-06-20 12:28:51 +0300
commite019d8fb8c3bdab9c2eb20f6217c93af704979f5 (patch)
tree45d2c477590c18c3b03d303fa3786b23e8633a65 /source/blender/editors
parente3fe56d9d1463bd0ac313b10dc1a1ad5b340f942 (diff)
Transform: UV islands were split by winding
This meant front/back faces from a projection would be seen as separate islands.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/include/ED_mesh.h4
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c34
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c8
-rw-r--r--source/blender/editors/transform/transform_conversions.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c4
5 files changed, 35 insertions, 17 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 3f16055e762..9534da622fb 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -107,7 +107,9 @@ void EDBM_mesh_reveal(struct BMEditMesh *em);
void EDBM_update_generic(struct BMEditMesh *em, const bool do_tessface, const bool is_destructive);
-struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm, const bool selected, const bool do_islands);
+struct UvElementMap *BM_uv_element_map_create(
+ struct BMesh *bm,
+ const bool selected, const bool use_winding, const bool do_islands);
void BM_uv_element_map_free(struct UvElementMap *vmap);
struct UvElement *BM_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 2e43c9b0be8..d521b2c01e5 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -768,7 +768,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 bool do_islands)
+UvElementMap *BM_uv_element_map_create(
+ BMesh *bm,
+ const bool selected, const bool use_winding, const bool do_islands)
{
BMVert *ev;
BMFace *efa;
@@ -807,14 +809,22 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, const bool selected, const boo
element_map->vert = (UvElement **)MEM_callocN(sizeof(*element_map->vert) * totverts, "UvElementVerts");
buf = element_map->buf = (UvElement *)MEM_callocN(sizeof(*element_map->buf) * totuv, "UvElement");
- winding = MEM_mallocN(sizeof(*winding) * totfaces, "winding");
+ if (use_winding) {
+ winding = MEM_mallocN(sizeof(*winding) * totfaces, "winding");
+ }
BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, j) {
- winding[j] = false;
+ if (use_winding) {
+ winding[j] = false;
+ }
if (!selected || BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
- float (*tf_uv)[2] = (float (*)[2])BLI_buffer_resize_data(&tf_uv_buf, vec2f, efa->len);
+ float (*tf_uv)[2];
+
+ if (use_winding) {
+ tf_uv = (float (*)[2])BLI_buffer_resize_data(&tf_uv_buf, vec2f, efa->len);
+ }
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
buf->l = l;
@@ -825,13 +835,17 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, const bool selected, const boo
buf->next = element_map->vert[BM_elem_index_get(l->v)];
element_map->vert[BM_elem_index_get(l->v)] = buf;
- luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
- copy_v2_v2(tf_uv[i], luv->uv);
+ if (use_winding) {
+ luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
+ copy_v2_v2(tf_uv[i], luv->uv);
+ }
buf++;
}
- winding[j] = cross_poly_v2((const float (*)[2])tf_uv, efa->len) > 0;
+ if (use_winding) {
+ winding[j] = cross_poly_v2((const float (*)[2])tf_uv, efa->len) > 0;
+ }
}
}
@@ -864,7 +878,7 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, const bool selected, const boo
sub_v2_v2v2(uvdiff, uv2, uv);
if (fabsf(uvdiff[0]) < STD_UV_CONNECT_LIMIT && fabsf(uvdiff[1]) < STD_UV_CONNECT_LIMIT &&
- winding[BM_elem_index_get(iterv->l->f)] == winding[BM_elem_index_get(v->l->f)])
+ (!use_winding || winding[BM_elem_index_get(iterv->l->f)] == winding[BM_elem_index_get(v->l->f)]))
{
if (lastv) lastv->next = next;
else vlist = next;
@@ -884,7 +898,9 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm, const bool selected, const boo
element_map->vert[i] = newvlist;
}
- MEM_freeN(winding);
+ if (use_winding) {
+ MEM_freeN(winding);
+ }
if (do_islands) {
unsigned int *map;
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 4e1517b4e0d..03ca38f2df7 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -612,18 +612,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);
+ data->elementMap = BM_uv_element_map_create(bm, false, true, true);
}
else {
- data->elementMap = BM_uv_element_map_create(bm, true, true);
+ data->elementMap = BM_uv_element_map_create(bm, true, true, true);
}
}
else {
if (ts->uv_flag & UV_SYNC_SELECTION) {
- data->elementMap = BM_uv_element_map_create(bm, false, false);
+ data->elementMap = BM_uv_element_map_create(bm, false, false, true);
}
else {
- data->elementMap = BM_uv_element_map_create(bm, true, false);
+ data->elementMap = BM_uv_element_map_create(bm, true, false, true);
}
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index bcd69538b44..abaa55e3e9c 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2741,7 +2741,7 @@ static 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, true);
+ elementmap = BM_uv_element_map_create(em->bm, use_facesel, false, true);
if (elementmap == NULL) {
return;
}
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index f7a8735ccca..828537fd585 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -1649,10 +1649,10 @@ static int stitch_init(bContext *C, wmOperator *op)
/* 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);
+ state->element_map = BM_uv_element_map_create(state->em->bm, false, true, true);
}
else {
- state->element_map = BM_uv_element_map_create(state->em->bm, true, true);
+ state->element_map = BM_uv_element_map_create(state->em->bm, true, true, true);
}
if (!state->element_map) {
state_delete(state);