Skip to content
Snippets Groups Projects
Commit 1eb9bec2 authored by Spivak Vladimir (cwolf3d)'s avatar Spivak Vladimir (cwolf3d)
Browse files

Curve Tools: Some bugs fix.

parent 4e69d972
No related branches found
No related tags found
No related merge requests found
...@@ -714,44 +714,39 @@ class BezierPointsFillet(bpy.types.Operator): ...@@ -714,44 +714,39 @@ class BezierPointsFillet(bpy.types.Operator):
sn = 0 sn = 0
for spline in splines: for spline in splines:
ii = s[sn] ii = s[sn]
n = len(spline.bezier_points) bezier_points = spline.bezier_points
n = len(bezier_points)
if n > 2: if n > 2:
jn = 0 jn = 0
for j in ii: for j in ii:
j += jn j += jn
selected_all = [p for p in spline.bezier_points]
bpy.ops.curve.select_all(action='DESELECT') bpy.ops.curve.select_all(action='DESELECT')
if j != 0 and j != n - 1: if j != 0 and j != n - 1:
selected_all[j].select_control_point = True bezier_points[j].select_control_point = True
selected_all[j + 1].select_control_point = True bezier_points[j + 1].select_control_point = True
bpy.ops.curve.subdivide() bpy.ops.curve.subdivide()
selected_all = [p for p in spline.bezier_points] selected4 = [bezier_points[j - 1], bezier_points[j],
selected4 = [selected_all[j - 1], selected_all[j], bezier_points[j + 1], bezier_points[j + 2]]
selected_all[j + 1], selected_all[j + 2]]
jn += 1 jn += 1
n += 1 n += 1
elif j == 0: elif j == 0:
selected_all[j].select_control_point = True bezier_points[j].select_control_point = True
selected_all[j + 1].select_control_point = True bezier_points[j + 1].select_control_point = True
bpy.ops.curve.subdivide() bpy.ops.curve.subdivide()
selected_all = [p for p in spline.bezier_points] selected4 = [bezier_points[n], bezier_points[0],
selected4 = [selected_all[n], selected_all[0], bezier_points[1], bezier_points[2]]
selected_all[1], selected_all[2]]
jn += 1 jn += 1
n += 1 n += 1
elif j == n - 1: elif j == n - 1:
selected_all[j].select_control_point = True bezier_points[j].select_control_point = True
selected_all[j - 1].select_control_point = True bezier_points[j - 1].select_control_point = True
bpy.ops.curve.subdivide() bpy.ops.curve.subdivide()
selected_all = [p for p in spline.bezier_points] selected4 = [bezier_points[0], bezier_points[n],
selected4 = [selected_all[0], selected_all[n], bezier_points[n - 1], bezier_points[n - 2]]
selected_all[n - 1], selected_all[n - 2]]
selected4[2].co = selected4[1].co selected4[2].co = selected4[1].co
s1 = Vector(selected4[0].co) - Vector(selected4[1].co) s1 = Vector(selected4[0].co) - Vector(selected4[1].co)
...@@ -831,53 +826,50 @@ class BezierDivide(bpy.types.Operator): ...@@ -831,53 +826,50 @@ class BezierDivide(bpy.types.Operator):
sn = 0 sn = 0
for spline in splines: for spline in splines:
ii = s[sn] ii = s[sn]
n = len(spline.bezier_points) bezier_points = spline.bezier_points
n = len(bezier_points)
if n > 2: if n > 2:
jn = 0 jn = 0
for j in ii: for j in ii:
selected_all = [p for p in spline.bezier_points]
bpy.ops.curve.select_all(action='DESELECT') bpy.ops.curve.select_all(action='DESELECT')
if (j in ii) and (j + 1 in ii): if (j in ii) and (j + 1 in ii):
selected_all[j + jn].select_control_point = True bezier_points[j + jn].select_control_point = True
selected_all[j + 1 + jn].select_control_point = True bezier_points[j + 1 + jn].select_control_point = True
h = Math.subdivide_cubic_bezier( h = Math.subdivide_cubic_bezier(
selected_all[j + jn].co, selected_all[j + jn].handle_right, bezier_points[j + jn].co, bezier_points[j + jn].handle_right,
selected_all[j + 1 + jn].handle_left, selected_all[j + 1 + jn].co, self.Bezier_t / 100 bezier_points[j + 1 + jn].handle_left, bezier_points[j + 1 + jn].co, self.Bezier_t / 100
) )
bpy.ops.curve.subdivide(1) bpy.ops.curve.subdivide(1)
selected_all = [p for p in spline.bezier_points] bezier_points[j + jn].handle_right_type = 'FREE'
selected_all[j + jn].handle_right_type = 'FREE' bezier_points[j + jn].handle_right = h[0]
selected_all[j + jn].handle_right = h[0] bezier_points[j + 1 + jn].co = h[2]
selected_all[j + 1 + jn].co = h[2] bezier_points[j + 1 + jn].handle_left_type = 'FREE'
selected_all[j + 1 + jn].handle_left_type = 'FREE' bezier_points[j + 1 + jn].handle_left = h[1]
selected_all[j + 1 + jn].handle_left = h[1] bezier_points[j + 1 + jn].handle_right_type = 'FREE'
selected_all[j + 1 + jn].handle_right_type = 'FREE' bezier_points[j + 1 + jn].handle_right = h[3]
selected_all[j + 1 + jn].handle_right = h[3] bezier_points[j + 2 + jn].handle_left_type = 'FREE'
selected_all[j + 2 + jn].handle_left_type = 'FREE' bezier_points[j + 2 + jn].handle_left = h[4]
selected_all[j + 2 + jn].handle_left = h[4]
jn += 1 jn += 1
if j == n - 1 and (0 in ii) and spline.use_cyclic_u: if j == n - 1 and (0 in ii) and spline.use_cyclic_u:
selected_all[j + jn].select_control_point = True bezier_points[j + jn].select_control_point = True
selected_all[0].select_control_point = True bezier_points[0].select_control_point = True
h = Math.subdivide_cubic_bezier( h = Math.subdivide_cubic_bezier(
selected_all[j + jn].co, selected_all[j + jn].handle_right, bezier_points[j + jn].co, bezier_points[j + jn].handle_right,
selected_all[0].handle_left, selected_all[0].co, self.Bezier_t / 100 bezier_points[0].handle_left, bezier_points[0].co, self.Bezier_t / 100
) )
bpy.ops.curve.subdivide(1) bpy.ops.curve.subdivide(1)
selected_all = [p for p in spline.bezier_points] bezier_points[j + jn].handle_right_type = 'FREE'
selected_all[j + jn].handle_right_type = 'FREE' bezier_points[j + jn].handle_right = h[0]
selected_all[j + jn].handle_right = h[0] bezier_points[j + 1 + jn].co = h[2]
selected_all[j + 1 + jn].co = h[2] bezier_points[j + 1 + jn].handle_left_type = 'FREE'
selected_all[j + 1 + jn].handle_left_type = 'FREE' bezier_points[j + 1 + jn].handle_left = h[1]
selected_all[j + 1 + jn].handle_left = h[1] bezier_points[j + 1 + jn].handle_right_type = 'FREE'
selected_all[j + 1 + jn].handle_right_type = 'FREE' bezier_points[j + 1 + jn].handle_right = h[3]
selected_all[j + 1 + jn].handle_right = h[3] bezier_points[0].handle_left_type = 'FREE'
selected_all[0].handle_left_type = 'FREE' bezier_points[0].handle_left = h[4]
selected_all[0].handle_left = h[4]
sn += 1 sn += 1
......
...@@ -271,14 +271,14 @@ class PathFinder(bpy.types.Operator): ...@@ -271,14 +271,14 @@ class PathFinder(bpy.types.Operator):
bpy.ops.curve.delete(type='VERT') bpy.ops.curve.delete(type='VERT')
return {'RUNNING_MODAL'} 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': elif event.alt and not event.shift and event.type == 'LEFTMOUSE':
remove_handler(self.handlers) remove_handler(self.handlers)
bpy.ops.curve.select_all(action='DESELECT') bpy.ops.curve.select_all(action='DESELECT')
click(self, context, event) 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': elif event.alt and event.type == 'RIGHTMOUSE':
remove_handler(self.handlers) remove_handler(self.handlers)
bpy.ops.curve.select_all(action='DESELECT') bpy.ops.curve.select_all(action='DESELECT')
......
...@@ -231,14 +231,14 @@ class curvetoolsSettings(PropertyGroup): ...@@ -231,14 +231,14 @@ class curvetoolsSettings(PropertyGroup):
) )
font_thickness: IntProperty( font_thickness: IntProperty(
name="Font thickness", name="Font thickness",
default=1, default=2,
min=1, max=1024, min=1, max=1024,
soft_min=2, soft_min=2,
description="Font thickness (px)" description="Font thickness (px)"
) )
font_size: FloatProperty( font_size: FloatProperty(
name="Font size", name="Font size",
default=0.5, default=0.1,
precision=3, precision=3,
description="Font size" description="Font size"
) )
...@@ -449,6 +449,8 @@ class VIEW3D_PT_CurvePanel(Panel): ...@@ -449,6 +449,8 @@ class VIEW3D_PT_CurvePanel(Panel):
row = col.row(align=True) row = col.row(align=True)
row.label(text="Alt + mouse click - select spline") row.label(text="Alt + mouse click - select spline")
row = col.row(align=True) 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") row.label(text="A - deselect all")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment