[Bf-blender-cvs] [c9e36e5434b] master: Cleanup: unused vars, correct bad (unused) logic

Campbell Barton noreply at git.blender.org
Thu Oct 25 03:25:44 CEST 2018


Commit: c9e36e5434b380ed07dc2efc736aae62a05bb581
Author: Campbell Barton
Date:   Thu Oct 25 12:24:38 2018 +1100
Branches: master
https://developer.blender.org/rBc9e36e5434b380ed07dc2efc736aae62a05bb581

Cleanup: unused vars, correct bad (unused) logic

===================================================================

M	release/scripts/startup/bl_operators/uvcalc_lightmap.py
M	release/scripts/startup/bl_operators/uvcalc_smart_project.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index d1774205aee..11eb7e1eb88 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -77,9 +77,9 @@ class prettyface:
             # f, (len_min, len_mid, len_max)
             self.uv = data
 
-            f1, lens1, lens1ord = data[0]
+            _f1, lens1, lens1ord = data[0]
             if data[1]:
-                f2, lens2, lens2ord = data[1]
+                _f2, lens2, lens2ord = data[1]
                 self.width = (lens1[lens1ord[0]] + lens2[lens2ord[0]]) / 2.0
                 self.height = (lens1[lens1ord[1]] + lens2[lens2ord[1]]) / 2.0
             else:  # 1 tri :/
@@ -205,12 +205,12 @@ class prettyface:
                     fuv[I[0]][:] = p2
                     fuv[I[1]][:] = p3
 
-            f, lens, lensord = uv[0]
+            f = uv[0][0]
 
             set_uv(f, (x1, y1), (x1, y2 - margin_h), (x2 - margin_w, y1))
 
             if uv[1]:
-                f, lens, lensord = uv[1]
+                f = uv[1][0]
                 set_uv(f, (x2, y2), (x2, y1 + margin_h), (x1 + margin_w, y2))
 
         else:  # 1 QUAD
diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
index 16a24736398..ec6a9fc92e3 100644
--- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py
+++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
@@ -143,9 +143,9 @@ def island2Edge(island):
     unique_points = {}
 
     for f in island:
-        f_uvkey = map(tuple, f.uv)
+        f_uvkey = list(map(tuple, f.uv))
 
-        for vIdx, edkey in enumerate(f.edge_keys):
+        for vIdx in range(len(f_uvkey)):
             unique_points[f_uvkey[vIdx]] = f.uv[vIdx]
 
             if f.v[vIdx].index > f.v[vIdx - 1].index:
@@ -158,18 +158,14 @@ def island2Edge(island):
             try:
                 edges[f_uvkey[i1], f_uvkey[i2]] *= 0  # sets any edge with more than 1 user to 0 are not returned.
             except:
-                edges[f_uvkey[i1], f_uvkey[i2]] = (f.uv[i1] - f.uv[i2]).length,
+                edges[f_uvkey[i1], f_uvkey[i2]] = (f.uv[i1] - f.uv[i2]).length
 
     # If 2 are the same then they will be together, but full [a,b] order is not correct.
 
     # Sort by length
-
     length_sorted_edges = [(Vector(key[0]), Vector(key[1]), value) for key, value in edges.items() if value != 0]
 
-    try:
-        length_sorted_edges.sort(key=lambda A: -A[2])  # largest first
-    except:
-        length_sorted_edges.sort(lambda A, B: cmp(B[2], A[2]))
+    length_sorted_edges.sort(key=lambda a: -a[2])  # largest first
 
     # Its okay to leave the length in there.
     # for e in length_sorted_edges:



More information about the Bf-blender-cvs mailing list