diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-06-29 16:41:39 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-06-29 16:41:39 +0400 |
commit | 4f294a8f02949a85cb85e054836626e9c2584944 (patch) | |
tree | 4814a5c41d5f506258ed1b27f8550d569c13bbc5 | |
parent | 8a3d571744a57fb021f818e286205b70130f0e9b (diff) |
Fixing a bug found while checking "[#31937] UV/Image Editor: Copy Mirrored UV Coords" (which isn't a bug at all).
The tool works OK, except it was messing vertices' order of polys, often giving ugly results! Now only using sorted list of vertices indices to find matching polys.
-rw-r--r-- | release/scripts/startup/bl_operators/mesh.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py index 4ed43a68e48..51645bfeeab 100644 --- a/release/scripts/startup/bl_operators/mesh.py +++ b/release/scripts/startup/bl_operators/mesh.py @@ -58,12 +58,9 @@ class MeshMirrorUV(Operator): vcos = (v.co.to_tuple(5) for v in mesh.vertices) for i, co in enumerate(vcos): - if co[0] > 0.0: - mirror_gt[co] = i - elif co[0] < 0.0: - mirror_lt[co] = i - else: + if co[0] >= 0.0: mirror_gt[co] = i + if co[0] <= 0.0: mirror_lt[co] = i #for i, v in enumerate(mesh.vertices): @@ -97,14 +94,13 @@ class MeshMirrorUV(Operator): puvsel[i] = (False not in (uv.select for uv in uv_loops[lstart:lend])) # Vert idx of the poly. - vidxs[i] = tuple(sorted(l.vertex_index - for l in loops[lstart:lend])) + vidxs[i] = tuple(l.vertex_index for l in loops[lstart:lend]) # As we have no poly.center yet... pcents[i] = tuple(map(lambda x: x / p.loop_total, map(sum, zip(*(verts[idx].co for idx in vidxs[i]))))) # Preparing next step finding matching polys. - mirror_pm[vidxs[i]] = i + mirror_pm[tuple(sorted(vidxs[i]))] = i for i in range(nbr_polys): # Find matching mirror poly. |