UI: Curve Edit Stroke Panel Layout

Also removes the 'Curve Stroke' panel that showed globally for curve
edit mode. This means the settings will not be available without the
draw tool selected.

Reviewed By: billreynish, campbellbarton

Differential Revision: https://developer.blender.org/D7652
This commit is contained in:
Hans Goudey 2020-05-11 10:16:52 -04:00
parent af8bd43e35
commit 870e081bcd
2 changed files with 47 additions and 66 deletions

View File

@ -891,23 +891,61 @@ class _defs_edit_curve:
@ToolDef.from_fn
def draw():
def draw_settings(context, layout, _tool):
def draw_settings(context, layout, tool, *, extra=False):
# Tool settings initialize operator options.
tool_settings = context.tool_settings
cps = tool_settings.curve_paint_settings
region_type = context.region.type
col = layout.column()
if region_type == 'TOOL_HEADER':
if not extra:
layout.prop(cps, "curve_type", text="")
layout.prop(cps, "depth_mode", expand=True)
layout.popover("TOPBAR_PT_tool_settings_extra", text="...")
return
col.prop(cps, "curve_type")
layout.use_property_split = True
layout.use_property_decorate = False
if region_type != 'TOOL_HEADER':
layout.prop(cps, "curve_type")
layout.separator()
if cps.curve_type == 'BEZIER':
col.prop(cps, "error_threshold")
col.prop(cps, "fit_method")
col.prop(cps, "use_corners_detect")
layout.prop(cps, "fit_method")
layout.prop(cps, "error_threshold")
if region_type != 'TOOL_HEADER':
row = layout.row(heading="Detect Corners", align=True)
else:
row = layout.row(heading="Corners", align=True)
row.prop(cps, "use_corners_detect", text="")
sub = row.row(align=True)
sub.active = cps.use_corners_detect
sub.prop(cps, "corner_angle", text="")
layout.separator()
col = layout.column(align=True)
col.prop(cps, "radius_taper_start", text="Taper Start", slider=True)
col.prop(cps, "radius_taper_end", text="End", slider=True)
col = layout.column(align=True)
col.prop(cps, "radius_min", text="Radius Min")
col.prop(cps, "radius_max", text="Max")
col.prop(cps, "use_pressure_radius")
layout.separator()
if region_type != 'TOOL_HEADER':
row = layout.row()
row.prop(cps, "depth_mode", expand=True)
if cps.depth_mode == 'SURFACE':
col = layout.column()
col.prop(cps, "surface_offset")
col.prop(cps, "use_offset_absolute")
col.prop(cps, "use_stroke_endpoints")
if cps.use_stroke_endpoints:
colsub = layout.column(align=True)
colsub.prop(cps, "surface_plane")
col = layout.row()
col.active = cps.use_corners_detect
col.prop(cps, "corner_angle")
return dict(
idname="builtin.draw",

View File

@ -243,62 +243,6 @@ class VIEW3D_PT_tools_meshedit_options_automerge(View3DPanel, Panel):
col.prop(tool_settings, "use_mesh_automerge_and_split", toggle=False)
col.prop(tool_settings, "double_threshold", text="Threshold")
# ********** default tools for editmode_curve ****************
class VIEW3D_PT_tools_curveedit_options_stroke(View3DPanel, Panel):
bl_category = "Tool"
bl_context = ".curve_edit" # dot on purpose (access from topbar)
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(text="Bezier Options:")
col.prop(cps, "error_threshold")
col.prop(cps, "fit_method")
col.prop(cps, "use_corners_detect")
col = layout.column()
col.active = cps.use_corners_detect
col.prop(cps, "corner_angle")
col.label(text="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(text="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(text="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, "surface_offset")
col.prop(cps, "use_offset_absolute")
col.prop(cps, "use_stroke_endpoints")
if cps.use_stroke_endpoints:
colsub = layout.column(align=True)
colsub.prop(cps, "surface_plane", expand=True)
# ********** default tools for editmode_armature ****************
@ -2198,7 +2142,6 @@ classes = (
VIEW3D_PT_tools_object_options_transform,
VIEW3D_PT_tools_meshedit_options,
VIEW3D_PT_tools_meshedit_options_automerge,
VIEW3D_PT_tools_curveedit_options_stroke,
VIEW3D_PT_tools_armatureedit_options,
VIEW3D_PT_tools_posemode_options,