New freehand curve drawing tool

- Access with Shift-LMB or from the 'Create' toolbar tab.
- Uses curve fitting for bezier curves, with error and corner angle options.
- Optional tablet pressure to curve radius mapping.
- Depth can use the cursor or optionally draw onto the surface,
  for the entire stroke or using the stroke start.
- Stroke plane can optionally be perpendicular to, or aligned to the surface normal.
- Optional radius tapering and for start/end points.
- Supports operator redo and calling from Python.
This commit is contained in:
Campbell Barton
2016-04-15 18:10:05 +10:00
parent e56e7bd1ec
commit 8ac662c77a
11 changed files with 1385 additions and 8 deletions

View File

@@ -136,6 +136,7 @@ class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
@staticmethod
def draw_add_curve(layout, label=False):
if label:
layout.label(text="Bezier:")
layout.operator("curve.primitive_bezier_curve_add", text="Bezier", icon='CURVE_BEZCURVE')
@@ -149,6 +150,10 @@ class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE')
layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH')
layout.separator()
layout.operator("curve.draw", icon='LINE_DATA')
@staticmethod
def draw_add_surface(layout):
layout.operator("surface.primitive_nurbs_surface_curve_add", text="Nurbs Curve", icon='SURFACE_NCURVE')
@@ -546,8 +551,61 @@ class VIEW3D_PT_tools_add_curve_edit(View3DPanel, Panel):
VIEW3D_PT_tools_add_object.draw_add_curve(col, label=True)
# ********** default tools for editmode_surface ****************
class VIEW3D_PT_tools_curveedit_options_stroke(View3DPanel, Panel):
bl_category = "Options"
bl_context = "curve_edit"
bl_label = "Curve Stroke"
def draw(self, context):
layout = self.layout
tool_settings = context.tool_settings
cps = tool_settings.curve_paint_settings
col = layout.column()
col.prop(cps, "curve_type")
if cps.curve_type == 'BEZIER':
col.label("Bezier Options:")
col.prop(cps, "error_threshold")
col.prop(cps, "use_corners_detect")
col = layout.column()
col.active = cps.use_corners_detect
col.prop(cps, "corner_angle")
col.label("Pressure Radius:")
row = layout.row(align=True)
rowsub = row.row(align=True)
rowsub.prop(cps, "radius_min", text="Min")
rowsub.prop(cps, "radius_max", text="Max")
row.prop(cps, "use_pressure_radius", text="", icon_only=True)
col = layout.column()
col.label("Taper Radius:")
row = layout.row(align=True)
row.prop(cps, "radius_taper_start", text="Start")
row.prop(cps, "radius_taper_end", text="End")
col = layout.column()
col.label("Projection Depth:")
row = layout.row(align=True)
row.prop(cps, "depth_mode", expand=True)
col = layout.column()
if cps.depth_mode == 'SURFACE':
col.prop(cps, "use_stroke_endpoints")
if cps.use_stroke_endpoints:
colsub = layout.column(align=True)
colsub.prop(cps, "surface_plane", expand=True)
else:
col.prop(cps, "radius_offset")
# ********** default tools for editmode_surface ****************
class VIEW3D_PT_tools_transform_surface(View3DPanel, Panel):
bl_category = "Tools"