Fix T44530 UV islands fail on subsurf after mirror modifier.

Caused by own commit that changed island detection code. In the case of
modifiers we don't want to take winding information into account, but
left the code since there are use cases (like painting) which could use
this.
This commit is contained in:
Antonis Ryakiotakis 2015-04-28 11:12:47 +02:00
parent eee666583f
commit d920b8e075
Notes: blender-bot 2023-02-14 09:12:01 +01:00
Referenced by issue #44530, Regression: Texture UV Mapping incorrect on meshes with Subsuf and Mirror modifiers
3 changed files with 7 additions and 4 deletions

View File

@ -102,7 +102,7 @@ typedef struct MeshElemMap {
/* mapping */
UvVertMap *BKE_mesh_uv_vert_map_create(
struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv,
unsigned int totpoly, unsigned int totvert, int selected, float *limit);
unsigned int totpoly, unsigned int totvert, int selected, float *limit, bool use_winding);
UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v);
void BKE_mesh_uv_vert_map_free(UvVertMap *vmap);

View File

@ -55,7 +55,7 @@
* but for now this replaces it because its unused. */
UvVertMap *BKE_mesh_uv_vert_map_create(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv,
unsigned int totpoly, unsigned int totvert, int selected, float *limit)
unsigned int totpoly, unsigned int totvert, int selected, float *limit, bool use_winding)
{
UvVertMap *vmap;
UvMapVert *buf;
@ -109,7 +109,10 @@ UvVertMap *BKE_mesh_uv_vert_map_create(struct MPoly *mpoly, struct MLoop *mloop,
buf++;
}
winding[a] = cross_poly_v2((const float (*)[2])tf_uv, (unsigned int)nverts) > 0;
if (use_winding)
winding[a] = cross_poly_v2((const float (*)[2])tf_uv, (unsigned int)nverts) > 0;
else
winding[a] = 0;
}
}

View File

@ -300,7 +300,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
float uv[3] = {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */
limit[0] = limit[1] = STD_UV_CONNECT_LIMIT;
vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, 0, limit);
vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, 0, limit, false);
if (!vmap)
return 0;