fix [#31181] Lightmap UV unwrap still broken
authorCampbell Barton <ideasman42@gmail.com>
Mon, 30 Apr 2012 05:45:01 +0000 (05:45 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 30 Apr 2012 05:45:01 +0000 (05:45 +0000)
raised python error with triangles.

release/scripts/startup/bl_operators/uvcalc_lightmap.py

index 3bd0d6fa4ccbc7a62267fec41fae8d91f65befb2..b184c81d6a76ed96ea85d6a2d427d1bfe9194ea4 100644 (file)
@@ -157,18 +157,17 @@ class prettyface(object):
                 angles_co.sort()
                 I = [i for a, i in angles_co]
 
-                #~ fuv = f.uv
                 uv_layer = f.id_data.uv_layers.active.data
-                fuv = [uv_layer[i].uv for i in f.loops]  # XXX25
+                fuv = [uv_layer[i].uv for i in f.loop_indices]
 
                 if self.rot:
-                    fuv[I[2]] = p1
-                    fuv[I[1]] = p2
-                    fuv[I[0]] = p3
+                    fuv[I[2]][:] = p1
+                    fuv[I[1]][:] = p2
+                    fuv[I[0]][:] = p3
                 else:
-                    fuv[I[2]] = p1
-                    fuv[I[0]] = p2
-                    fuv[I[1]] = p3
+                    fuv[I[2]][:] = p1
+                    fuv[I[0]][:] = p2
+                    fuv[I[1]][:] = p3
 
             f, lens, lensord = uv[0]
 
@@ -179,10 +178,10 @@ class prettyface(object):
                 set_uv(f, (x2, y2), (x2, y1 + margin_h), (x1 + margin_w, y2))
 
         else:  # 1 QUAD
-            uv[1][0], uv[1][1] = x1, y1
-            uv[2][0], uv[2][1] = x1, y2
-            uv[3][0], uv[3][1] = x2, y2
-            uv[0][0], uv[0][1] = x2, y1
+            uv[1][:] = x1, y1
+            uv[2][:] = x1, y2
+            uv[3][:] = x2, y2
+            uv[0][:] = x2, y1
 
     def __hash__(self):
         # None unique hash