diff options
author | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-09-21 02:32:43 +0300 |
---|---|---|
committer | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-09-21 02:33:15 +0300 |
commit | 1eb9bec2155b6d0b5757568018fb1dc567b1f16d (patch) | |
tree | bed406a896cde0cc4a1c95b64a677618d9d9faa3 | |
parent | 4e69d972bd4fea632b75ac60b302672f6b289c4e (diff) |
Curve Tools: Some bugs fix.
-rw-r--r-- | curve_tools/Operators.py | 92 | ||||
-rw-r--r-- | curve_tools/PathFinder.py | 6 | ||||
-rw-r--r-- | curve_tools/__init__.py | 6 |
3 files changed, 49 insertions, 55 deletions
diff --git a/curve_tools/Operators.py b/curve_tools/Operators.py index c0101840..89f08f72 100644 --- a/curve_tools/Operators.py +++ b/curve_tools/Operators.py @@ -714,44 +714,39 @@ class BezierPointsFillet(bpy.types.Operator): sn = 0 for spline in splines: ii = s[sn] - n = len(spline.bezier_points) + bezier_points = spline.bezier_points + n = len(bezier_points) if n > 2: jn = 0 for j in ii: - j += jn - selected_all = [p for p in spline.bezier_points] - bpy.ops.curve.select_all(action='DESELECT') if j != 0 and j != n - 1: - selected_all[j].select_control_point = True - selected_all[j + 1].select_control_point = True + bezier_points[j].select_control_point = True + bezier_points[j + 1].select_control_point = True bpy.ops.curve.subdivide() - selected_all = [p for p in spline.bezier_points] - selected4 = [selected_all[j - 1], selected_all[j], - selected_all[j + 1], selected_all[j + 2]] + selected4 = [bezier_points[j - 1], bezier_points[j], + bezier_points[j + 1], bezier_points[j + 2]] jn += 1 n += 1 elif j == 0: - selected_all[j].select_control_point = True - selected_all[j + 1].select_control_point = True + bezier_points[j].select_control_point = True + bezier_points[j + 1].select_control_point = True bpy.ops.curve.subdivide() - selected_all = [p for p in spline.bezier_points] - selected4 = [selected_all[n], selected_all[0], - selected_all[1], selected_all[2]] + selected4 = [bezier_points[n], bezier_points[0], + bezier_points[1], bezier_points[2]] jn += 1 n += 1 elif j == n - 1: - selected_all[j].select_control_point = True - selected_all[j - 1].select_control_point = True + bezier_points[j].select_control_point = True + bezier_points[j - 1].select_control_point = True bpy.ops.curve.subdivide() - selected_all = [p for p in spline.bezier_points] - selected4 = [selected_all[0], selected_all[n], - selected_all[n - 1], selected_all[n - 2]] + selected4 = [bezier_points[0], bezier_points[n], + bezier_points[n - 1], bezier_points[n - 2]] selected4[2].co = selected4[1].co s1 = Vector(selected4[0].co) - Vector(selected4[1].co) @@ -831,53 +826,50 @@ class BezierDivide(bpy.types.Operator): sn = 0 for spline in splines: ii = s[sn] - n = len(spline.bezier_points) + bezier_points = spline.bezier_points + n = len(bezier_points) if n > 2: jn = 0 for j in ii: - selected_all = [p for p in spline.bezier_points] - bpy.ops.curve.select_all(action='DESELECT') if (j in ii) and (j + 1 in ii): - selected_all[j + jn].select_control_point = True - selected_all[j + 1 + jn].select_control_point = True + bezier_points[j + jn].select_control_point = True + bezier_points[j + 1 + jn].select_control_point = True h = Math.subdivide_cubic_bezier( - selected_all[j + jn].co, selected_all[j + jn].handle_right, - selected_all[j + 1 + jn].handle_left, selected_all[j + 1 + jn].co, self.Bezier_t / 100 + bezier_points[j + jn].co, bezier_points[j + jn].handle_right, + bezier_points[j + 1 + jn].handle_left, bezier_points[j + 1 + jn].co, self.Bezier_t / 100 ) bpy.ops.curve.subdivide(1) - selected_all = [p for p in spline.bezier_points] - selected_all[j + jn].handle_right_type = 'FREE' - selected_all[j + jn].handle_right = h[0] - selected_all[j + 1 + jn].co = h[2] - selected_all[j + 1 + jn].handle_left_type = 'FREE' - selected_all[j + 1 + jn].handle_left = h[1] - selected_all[j + 1 + jn].handle_right_type = 'FREE' - selected_all[j + 1 + jn].handle_right = h[3] - selected_all[j + 2 + jn].handle_left_type = 'FREE' - selected_all[j + 2 + jn].handle_left = h[4] + bezier_points[j + jn].handle_right_type = 'FREE' + bezier_points[j + jn].handle_right = h[0] + bezier_points[j + 1 + jn].co = h[2] + bezier_points[j + 1 + jn].handle_left_type = 'FREE' + bezier_points[j + 1 + jn].handle_left = h[1] + bezier_points[j + 1 + jn].handle_right_type = 'FREE' + bezier_points[j + 1 + jn].handle_right = h[3] + bezier_points[j + 2 + jn].handle_left_type = 'FREE' + bezier_points[j + 2 + jn].handle_left = h[4] jn += 1 if j == n - 1 and (0 in ii) and spline.use_cyclic_u: - selected_all[j + jn].select_control_point = True - selected_all[0].select_control_point = True + bezier_points[j + jn].select_control_point = True + bezier_points[0].select_control_point = True h = Math.subdivide_cubic_bezier( - selected_all[j + jn].co, selected_all[j + jn].handle_right, - selected_all[0].handle_left, selected_all[0].co, self.Bezier_t / 100 + bezier_points[j + jn].co, bezier_points[j + jn].handle_right, + bezier_points[0].handle_left, bezier_points[0].co, self.Bezier_t / 100 ) bpy.ops.curve.subdivide(1) - selected_all = [p for p in spline.bezier_points] - selected_all[j + jn].handle_right_type = 'FREE' - selected_all[j + jn].handle_right = h[0] - selected_all[j + 1 + jn].co = h[2] - selected_all[j + 1 + jn].handle_left_type = 'FREE' - selected_all[j + 1 + jn].handle_left = h[1] - selected_all[j + 1 + jn].handle_right_type = 'FREE' - selected_all[j + 1 + jn].handle_right = h[3] - selected_all[0].handle_left_type = 'FREE' - selected_all[0].handle_left = h[4] + bezier_points[j + jn].handle_right_type = 'FREE' + bezier_points[j + jn].handle_right = h[0] + bezier_points[j + 1 + jn].co = h[2] + bezier_points[j + 1 + jn].handle_left_type = 'FREE' + bezier_points[j + 1 + jn].handle_left = h[1] + bezier_points[j + 1 + jn].handle_right_type = 'FREE' + bezier_points[j + 1 + jn].handle_right = h[3] + bezier_points[0].handle_left_type = 'FREE' + bezier_points[0].handle_left = h[4] sn += 1 diff --git a/curve_tools/PathFinder.py b/curve_tools/PathFinder.py index 4df49c41..ab11a4e7 100644 --- a/curve_tools/PathFinder.py +++ b/curve_tools/PathFinder.py @@ -271,14 +271,14 @@ class PathFinder(bpy.types.Operator): bpy.ops.curve.delete(type='VERT') return {'RUNNING_MODAL'} + elif event.alt and event.shift and event.type == 'LEFTMOUSE': + click(self, context, event) + elif event.alt and not event.shift and event.type == 'LEFTMOUSE': remove_handler(self.handlers) bpy.ops.curve.select_all(action='DESELECT') click(self, context, event) - elif event.alt and event.shift and event.type == 'LEFTMOUSE': - click(self, context, event) - elif event.alt and event.type == 'RIGHTMOUSE': remove_handler(self.handlers) bpy.ops.curve.select_all(action='DESELECT') diff --git a/curve_tools/__init__.py b/curve_tools/__init__.py index 6549d8c6..ceba9619 100644 --- a/curve_tools/__init__.py +++ b/curve_tools/__init__.py @@ -231,14 +231,14 @@ class curvetoolsSettings(PropertyGroup): ) font_thickness: IntProperty( name="Font thickness", - default=1, + default=2, min=1, max=1024, soft_min=2, description="Font thickness (px)" ) font_size: FloatProperty( name="Font size", - default=0.5, + default=0.1, precision=3, description="Font size" ) @@ -449,6 +449,8 @@ class VIEW3D_PT_CurvePanel(Panel): row = col.row(align=True) row.label(text="Alt + mouse click - select spline") row = col.row(align=True) + row.label(text="Alt + Shift + mouse click - add spline to select") + row = col.row(align=True) row.label(text="A - deselect all") |