diff options
author | Dave Pagurek <davepagurek> | 2022-09-16 11:53:07 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-09-17 13:30:13 +0300 |
commit | 468f2ccc0ecbcb368aab950c61c2cc0bc95b27e1 (patch) | |
tree | dc8b33cda00710764478f574967b88a74578316a /source/blender/makesrna | |
parent | a4027658eeaff868a68675594bf774a87454344e (diff) |
GPencil: Add more types of stroke extensions when filling
The motivation for this change: while working on an animation recently, I found that there are some gaps that won't close easily via stroke extension or leak size checking. In D14698, I attempted to address this by changing the algorithm of the raster-space flood fill. This patch attempts to address the same issue in vector space by adding two new cases where stroke extensions are added, as suggested by @frogstomp:
# **Points of high curvature:** when the curvature at a point is high enough that it's hard to visually distinguish between it and an endpoint, add a stroke extension out along the normal (pointing in the opposite direction of the stroke's acceleration.) This addresses cases where technically the endpoint points up, but there's a sharp corner right below it that should extend to connect.
# **Stroke endpoints within a radius**: when two endpoints are close together, regardless of the angle they make, connect them if they are within a radius. This addresses cases like where the two endpoints have effectively parallel tangents, so extensions won't close the gap.
Reviewed By: antoniov, mendio, frogstomp
Differential Revision: https://developer.blender.org/D14809
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index a6778ef67da..364805f0395 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -286,6 +286,25 @@ static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = { {GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Edit Lines", "Use edit lines as fill boundary limits"}, {0, NULL, 0, NULL, NULL}}; +static EnumPropertyItem rna_enum_gpencil_fill_extend_modes_items[] = { + {GP_FILL_EMODE_LINES, + "LINES", + 0, + "Line", + "Extend strokes in straight lines"}, + { + GP_FILL_EMODE_CIRCLES, + "CIRCLES", + 0, + "Circle", + "Connect endpoints that are close together"}, + {GP_FILL_EMODE_LINES_AND_CIRCLES, + "LINES_AND_CIRCLES", + 0, + "Line & Circle", + "Extend strokes and connect close endpoints"}, + {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem rna_enum_gpencil_fill_layers_modes_items[] = { {GP_FILL_GPLMODE_VISIBLE, "VISIBLE", 0, "Visible", "Visible layers"}, {GP_FILL_GPLMODE_ACTIVE, "ACTIVE", 0, "Active", "Only active layer"}, @@ -1645,7 +1664,16 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 10.0f); RNA_def_property_float_default(prop, 0.0f); RNA_def_property_ui_text( - prop, "Stroke Extension", "Strokes end extension for closing gaps, use zero to disable"); + prop, "Closure Size", "Strokes end extension for closing gaps, use zero to disable"); + RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); + + prop = RNA_def_property(srna, "fill_extend_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "fill_extend_mode"); + RNA_def_property_enum_items(prop, rna_enum_gpencil_fill_extend_modes_items); + RNA_def_property_ui_text( + prop, + "Gap Closure", + "Types of stroke extensions used for closing gaps"); RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); /* Number of pixels to dilate fill area. Negative values contract the filled area. */ |