[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48406] trunk/blender/release/scripts/ startup/bl_operators/mesh.py: Fixing a bug found while checking "[#31937] UV/Image Editor: Copy Mirrored UV Coords" (which isn't a bug at all).

Bastien Montagne montagne29 at wanadoo.fr
Fri Jun 29 14:41:49 CEST 2012


Revision: 48406
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48406
Author:   mont29
Date:     2012-06-29 12:41:39 +0000 (Fri, 29 Jun 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/mesh.py

Modified: trunk/blender/release/scripts/startup/bl_operators/mesh.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/mesh.py	2012-06-29 11:59:47 UTC (rev 48405)
+++ trunk/blender/release/scripts/startup/bl_operators/mesh.py	2012-06-29 12:41:39 UTC (rev 48406)
@@ -58,13 +58,10 @@
         vcos = (v.co.to_tuple(5) for v in mesh.vertices)
 
         for i, co in enumerate(vcos):
-            if co[0] > 0.0:
+            if co[0] >= 0.0:
                 mirror_gt[co] = i
-            elif co[0] < 0.0:
+            if co[0] <= 0.0:
                 mirror_lt[co] = i
-            else:
-                mirror_gt[co] = i
-                mirror_lt[co] = i
 
         #for i, v in enumerate(mesh.vertices):
         vmap = {}
@@ -97,14 +94,13 @@
             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.




More information about the Bf-blender-cvs mailing list