GP: New Cutter, Constraints and Segment selection

This commit groups a set of new tools that were tested in grease pencil object branch before moving to master. We decide to do all the development in a separated branch because it could break master during days or weeks before the new tools were ready to deploy.

The commit includes:

- New Cutter tool to trim strokes and help cleaning up drawings.

- New set of constraints and guides to draw different types of shapes. All the credits for this development goes to Charlie Jolly (@charlie), thanks for your help!

- Segment selection mode to select strokes between intersections.

- New operator to change strokes cap mode.

- New option to display only keyframed frames. This option is very important when fill strokes with color.

- Multiple small fixes and tweaks.

Thanks to @pepeland and @mendio for their ideas, tests, reviews and support.

Note: Still pending the final icons for Cutter in Toolbar and Segment Selection in Topbar. @billreynish could help us here?
This commit is contained in:
2019-01-11 19:15:23 +01:00
parent 6dbfd7f6d6
commit bb9c9d0eaa
32 changed files with 1871 additions and 158 deletions

View File

@@ -245,6 +245,18 @@ class VIEW3D_HT_header(Header):
text=lk_name,
icon=lk_icon,
)
if object_mode in {'PAINT_GPENCIL'}:
if context.workspace.tools.from_space_view3d_mode(object_mode).name == "Draw":
settings = tool_settings.gpencil_sculpt.guide
row = layout.row(align=True)
row.prop(settings, "use_guide", text="", icon='GRID')
sub = row.row(align=True)
sub.active = settings.use_guide
sub.popover(
panel="VIEW3D_PT_gpencil_guide",
text="Guides"
)
layout.separator_spacer()
@@ -3955,6 +3967,7 @@ class VIEW3D_MT_edit_gpencil(Menu):
layout.menu("VIEW3D_MT_edit_gpencil_delete")
layout.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE'
layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps...", property="type")
layout.separator()
@@ -5317,7 +5330,47 @@ class VIEW3D_PT_gpencil_lock(Panel):
col = row.column()
col.prop(context.tool_settings.gpencil_sculpt, "lock_axis", expand=True)
class VIEW3D_PT_gpencil_guide(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_label = "Guides"
@staticmethod
def draw(self, context):
from math import pi
settings = context.tool_settings.gpencil_sculpt.guide
layout = self.layout
layout.label(text="Guides")
col = layout.column()
col.active = settings.use_guide
col.prop(settings, "type", expand=True)
if settings.type in {'PARALLEL'}:
col.prop(settings, "angle")
row = col.row(align=True)
col.prop(settings, "use_snapping")
if settings.use_snapping:
if settings.type in {'RADIAL'}:
col.prop(settings, "angle_snap")
else:
col.prop(settings, "spacing")
col.label(text="Reference Point")
row = col.row(align=True)
row.prop(settings, "reference_point", expand=True)
if settings.reference_point in {'CUSTOM'}:
col.prop(settings, "location", text="Custom Location")
if settings.reference_point in {'OBJECT'}:
col.prop(settings, "reference_object", text="Object Location")
if not settings.reference_object:
col.label(text="No object selected, using cursor")
class VIEW3D_PT_overlay_gpencil_options(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
@@ -5560,6 +5613,7 @@ class VIEW3D_MT_gpencil_edit_specials(Menu):
layout.operator("gpencil.stroke_join", text="Join").type = 'JOIN'
layout.operator("gpencil.stroke_join", text="Join & Copy").type = 'JOINCOPY'
layout.operator("gpencil.stroke_flip", text="Flip Direction")
layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps...", property="type")
layout.separator()
layout.operator("gpencil.frame_duplicate", text="Duplicate Active Frame")
@@ -5787,6 +5841,7 @@ classes = (
VIEW3D_PT_snapping,
VIEW3D_PT_gpencil_origin,
VIEW3D_PT_gpencil_lock,
VIEW3D_PT_gpencil_guide,
VIEW3D_PT_transform_orientations,
VIEW3D_PT_overlay_gpencil_options,
VIEW3D_PT_context_properties,