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/blenkernel/intern
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/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/mesh_mapping.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index 8b41aded3d9..1d8978586b6 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -79,14 +79,12 @@ UvVertMap *BKE_mesh_uv_vert_map_create(
if (totuv == 0)
return NULL;
- winding = MEM_callocN(sizeof(*winding) * totpoly, "winding");
vmap = (UvVertMap *)MEM_callocN(sizeof(*vmap), "UvVertMap");
-
- if (!vmap)
- return NULL;
-
- vmap->vert = (UvMapVert **)MEM_callocN(sizeof(*vmap->vert) * totvert, "UvMapVert*");
buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * (size_t)totuv, "UvMapVert");
+ vmap->vert = (UvMapVert **)MEM_callocN(sizeof(*vmap->vert) * totvert, "UvMapVert*");
+ if (use_winding) {
+ winding = MEM_callocN(sizeof(*winding) * totpoly, "winding");
+ }
if (!vmap->vert || !vmap->buf) {
BKE_mesh_uv_vert_map_free(vmap);
@@ -96,7 +94,11 @@ UvVertMap *BKE_mesh_uv_vert_map_create(
mp = mpoly;
for (a = 0; a < totpoly; a++, mp++) {
if (!selected || (!(mp->flag & ME_HIDE) && (mp->flag & ME_FACE_SEL))) {
- float (*tf_uv)[2] = (float (*)[2])BLI_buffer_resize_data(&tf_uv_buf, vec2f, mp->totloop);
+ float (*tf_uv)[2];
+
+ if (use_winding) {
+ tf_uv = (float (*)[2])BLI_buffer_resize_data(&tf_uv_buf, vec2f, mp->totloop);
+ }
nverts = mp->totloop;
@@ -107,14 +109,16 @@ UvVertMap *BKE_mesh_uv_vert_map_create(
buf->next = vmap->vert[mloop[mp->loopstart + i].v];
vmap->vert[mloop[mp->loopstart + i].v] = buf;
- copy_v2_v2(tf_uv[i], mloopuv[mpoly[a].loopstart + i].uv);
+ if (use_winding) {
+ copy_v2_v2(tf_uv[i], mloopuv[mpoly[a].loopstart + i].uv);
+ }
+
buf++;
}
- if (use_winding)
+ if (use_winding) {
winding[a] = cross_poly_v2((const float (*)[2])tf_uv, (unsigned int)nverts) > 0;
- else
- winding[a] = 0;
+ }
}
}
@@ -142,7 +146,7 @@ UvVertMap *BKE_mesh_uv_vert_map_create(
if (fabsf(uv[0] - uv2[0]) < limit[0] && fabsf(uv[1] - uv2[1]) < limit[1] &&
- winding[iterv->f] == winding[v->f])
+ (!use_winding || winding[iterv->f] == winding[v->f]))
{
if (lastv) lastv->next = next;
else vlist = next;
@@ -161,7 +165,10 @@ UvVertMap *BKE_mesh_uv_vert_map_create(
vmap->vert[a] = newvlist;
}
- MEM_freeN(winding);
+ if (use_winding) {
+ MEM_freeN(winding);
+ }
+
BLI_buffer_free(&tf_uv_buf);
return vmap;