[Bf-extensions-cvs] [2e14c2aa] blender2.8: LoopTools: Update for 2.8

florianfelix noreply at git.blender.org
Wed Oct 24 12:07:29 CEST 2018


Commit: 2e14c2aa69726b472f8758f62ad839eddaf63bfe
Author: florianfelix
Date:   Wed Oct 24 12:05:57 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBA2e14c2aa69726b472f8758f62ad839eddaf63bfe

LoopTools: Update for 2.8

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

M	mesh_looptools.py

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

diff --git a/mesh_looptools.py b/mesh_looptools.py
index 9c2943f6..6e7d2b14 100644
--- a/mesh_looptools.py
+++ b/mesh_looptools.py
@@ -20,7 +20,7 @@ bl_info = {
     "name": "LoopTools",
     "author": "Bart Crouch",
     "version": (4, 6, 7),
-    "blender": (2, 72, 2),
+    "blender": (2, 80, 0),
     "location": "View3D > Toolbar and View3D > Specials (W-key)",
     "warning": "",
     "description": "Mesh modelling toolkit. Several tools to aid modelling",
@@ -110,10 +110,11 @@ loops, derived, mapping):
         del looptools_cache[tool]
     # prepare values to be saved to cache
     input = [v.index for v in bm.verts if v.select and not v.hide]
-    modifiers = [mod.name for mod in object.modifiers if mod.show_viewport and
-                 mod.type == 'MIRROR']
+    modifiers = [mod.name for mod in object.modifiers if mod.show_viewport
+    and mod.type == 'MIRROR']
     # update cache
-    looptools_cache[tool] = {"input": input, "object": object.name,
+    looptools_cache[tool] = {
+        "input": input, "object": object.name,
         "input_method": input_method, "boundaries": boundaries,
         "single_loops": single_loops, "loops": loops,
         "derived": derived, "mapping": mapping, "modifiers": modifiers}
@@ -276,7 +277,7 @@ def calculate_plane(bm_mod, loop, method="best_fit", object=False):
             vec2 = mathutils.Vector((1.0, 1.0, 1.0))
             for i in range(itermax):
                 vec = vec2
-                vec2 = mat * vec
+                vec2 = mat @ vec
                 if vec2.length != 0:
                     vec2 /= vec2.length
                 if vec2 == vec:
@@ -1043,11 +1044,11 @@ def bridge_calculate_lines(bm, loops, mode, twist, reverse):
             itermax = 500
             iter = 0
             vec = mathutils.Vector((1.0, 1.0, 1.0))
-            vec2 = (mat * vec) / (mat * vec).length
+            vec2 = (mat @ vec) / (mat @ vec).length
             while vec != vec2 and iter < itermax:
                 iter += 1
                 vec = vec2
-                vec2 = mat * vec
+                vec2 = mat @ vec
                 if vec2.length != 0:
                     vec2 /= vec2.length
             if vec2.length == 0:
@@ -1079,7 +1080,7 @@ def bridge_calculate_lines(bm, loops, mode, twist, reverse):
 
         # match start vertex of loop1 with loop2
         target_vector = bm.verts[loop2[0]].co - center2
-        dif_angles = [[(rotation_matrix * (bm.verts[vertex].co - center1)
+        dif_angles = [[(rotation_matrix @ (bm.verts[vertex].co - center1)
                        ).angle(target_vector, 0), False, i] for
                        i, vertex in enumerate(loop1)]
         dif_angles.sort()
@@ -1161,7 +1162,7 @@ def bridge_calculate_lines(bm, loops, mode, twist, reverse):
                     shifting = False
                     break
                 to_last, to_first = [
-                    (rotation_matrix * (bm.verts[loop1[-1]].co - center1)).angle(
+                    (rotation_matrix @ (bm.verts[loop1[-1]].co - center1)).angle(
                     (bm.verts[loop2[i]].co - center2), 0) for i in [-1, 0]
                     ]
                 if to_first < to_last:
@@ -1802,7 +1803,7 @@ def circle_calculate_best_fit(locs_2d):
             jmat2.invert()
         except:
             pass
-        dx0, dy0, dr = jmat2 * k2
+        dx0, dy0, dr = jmat2 @ k2
         x0 += dx0
         y0 += dy0
         r += dr
@@ -2610,7 +2611,7 @@ def gstretch_align_pairs(ls_pairs, object, bm_mod, method):
             else:
                 relative_distance = relative_lengths[i]
 
-            loc1 = object.matrix_world * bm_mod.verts[v_index].co
+            loc1 = object.matrix_world @ bm_mod.verts[v_index].co
             loc2, stroke_lengths_cache = gstretch_eval_stroke(stroke,
                 relative_distance, stroke_lengths_cache)
             total_distance += (loc2 - loc1).length
@@ -2683,7 +2684,7 @@ def gstretch_calculate_verts(loop, stroke, object, bm_mod, method):
                 relative_distance = relative_lengths[i]
             loc, stroke_lengths_cache = gstretch_eval_stroke(stroke,
                 relative_distance, stroke_lengths_cache)
-            loc = matrix_inverse * loc
+            loc = matrix_inverse @ loc
             move.append([v_index, loc])
 
     return(move)
@@ -2828,8 +2829,8 @@ def gstretch_eval_stroke(stroke, distance, stroke_lengths_cache=False):
 def gstretch_get_fake_strokes(object, bm_mod, loops):
     strokes = []
     for loop in loops:
-        p1 = object.matrix_world * bm_mod.verts[loop[0][0]].co
-        p2 = object.matrix_world * bm_mod.verts[loop[0][-1]].co
+        p1 = object.matrix_world @ bm_mod.verts[loop[0][0]].co
+        p2 = object.matrix_world @ bm_mod.verts[loop[0][-1]].co
         strokes.append(gstretch_fake_stroke([p1, p2]))
 
     return(strokes)
@@ -2866,7 +2867,7 @@ def gstretch_match_loops_strokes(loops, strokes, object, bm_mod):
         for v_index in loop[0]:
             center += bm_mod.verts[v_index].co
         center /= len(loop[0])
-        center = object.matrix_world * center
+        center = object.matrix_world @ center
         loop_centers.append([center, loop])
 
     # calculate stroke centers
@@ -3189,14 +3190,14 @@ class Bridge(Operator):
     bl_description = "Bridge two, or loft several, loops of vertices"
     bl_options = {'REGISTER', 'UNDO'}
 
-    cubic_strength = FloatProperty(
+    cubic_strength: FloatProperty(
         name="Strength",
         description="Higher strength results in more fluid curves",
         default=1.0,
         soft_min=-3.0,
         soft_max=3.0
         )
-    interpolation = EnumProperty(
+    interpolation: EnumProperty(
         name="Interpolation mode",
         items=(('cubic', "Cubic", "Gives curved results"),
             ('linear', "Linear", "Basic, fast, straight interpolation")),
@@ -3204,18 +3205,18 @@ class Bridge(Operator):
                     "segments",
         default='cubic'
         )
-    loft = BoolProperty(
+    loft: BoolProperty(
         name="Loft",
         description="Loft multiple loops, instead of considering them as "
                     "a multi-input for bridging",
         default=False
         )
-    loft_loop = BoolProperty(
+    loft_loop: BoolProperty(
         name="Loop",
         description="Connect the first and the last loop with each other",
         default=False
         )
-    min_width = IntProperty(
+    min_width: IntProperty(
         name="Minimum width",
         description="Segments with an edge smaller than this are merged "
                     "(compared to base edge)",
@@ -3224,32 +3225,32 @@ class Bridge(Operator):
         max=100,
         subtype='PERCENTAGE'
         )
-    mode = EnumProperty(
+    mode: EnumProperty(
         name="Mode",
         items=(('basic', "Basic", "Fast algorithm"),
                ('shortest', "Shortest edge", "Slower algorithm with better vertex matching")),
         description="Algorithm used for bridging",
         default='shortest'
         )
-    remove_faces = BoolProperty(
+    remove_faces: BoolProperty(
         name="Remove faces",
         description="Remove faces that are internal after bridging",
         default=True
         )
-    reverse = BoolProperty(
+    reverse: BoolProperty(
         name="Reverse",
         description="Manually override the direction in which the loops "
                     "are bridged. Only use if the tool gives the wrong result",
         default=False
         )
-    segments = IntProperty(
+    segments: IntProperty(
         name="Segments",
         description="Number of segments used to bridge the gap (0=automatic)",
         default=1,
         min=0,
         soft_max=20
         )
-    twist = IntProperty(
+    twist: IntProperty(
         name="Twist",
         description="Twist what vertices are connected to each other",
         default=0
@@ -3384,24 +3385,24 @@ class Circle(Operator):
     bl_description = "Move selected vertices into a circle shape"
     bl_options = {'REGISTER', 'UNDO'}
 
-    custom_radius = BoolProperty(
+    custom_radius: BoolProperty(
         name="Radius",
         description="Force a custom radius",
         default=False
         )
-    fit = EnumProperty(
+    fit: EnumProperty(
         name="Method",
         items=(("best", "Best fit", "Non-linear least squares"),
                ("inside", "Fit inside", "Only move vertices towards the center")),
         description="Method used for fitting a circle to the vertices",
         default='best'
         )
-    flatten = BoolProperty(
+    flatten: BoolProperty(
         name="Flatten",
         description="Flatten the circle, instead of projecting it on the mesh",
         default=True
         )
-    influence = FloatProperty(
+    influence: FloatProperty(
         name="Influence",
         description="Force of the tool",
         default=100.0,
@@ -3410,28 +3411,28 @@ class Circle(Operator):
         precision=1,
         subtype='PERCENTAGE'
         )
-    lock_x = BoolProperty(
+    lock_x: BoolProperty(
         name="Lock X",
         description="Lock editing of the x-coordinate",
         default=False
         )
-    lock_y = BoolProperty(
+    lock_y: BoolProperty(
         name="Lock Y",
         description="Lock editing of the y-coordinate",
         default=False
         )
-    lock_z = BoolProperty(name="Lock Z",
+    lock_z: BoolProperty(name="Lock Z",
         description="Lock editing of the z-coordinate",
         default=False
         )
-    radius = FloatProperty(
+    radius: FloatProperty(
         name="Radius",
         description="Custom radius for circle",
         default=1.0,
         min=0.0,
         soft_max=1000.0
         )
-    regular = BoolProperty(
+    regular: BoolProperty(
         name="Regular",
         description="Distribute vertices at constant distances along the circle",
         default=True
@@ -3557,12 +3558,12 @@ class Curve(Operator):
     bl_description = "Turn a loop into a smooth curve"
     bl_options = {'REGISTER', 'UNDO'}
 
-    boundaries = BoolProperty(
+    boundaries: BoolProperty(
         name="Boundaries",
         description="Limit the tool to wor

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list