From fe19de5fccac1a26bfe87bc41386791e5ee049f2 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Wed, 28 Sep 2022 14:32:56 +0200 Subject: GPencil: Fill Tool - Check if extensions collide with real strokes This commit is an improvement in the previous fill tool changes in order to improve how the extended strokes are managed. * Now, the algorithm checks if the extend cross a standard stroke, not only extend strokes. * Option to enable or disable the stroke cross checking because this can be slow in very complex scenes. * Added `D` key to toggle stroke cross option. * Option to use only collide strokes to be used as fill limit. If the option to use only collide strokes is enabled, the open extensions are in different color. * Status text now shows mode and the actual extend factor. This commits also contains a refactor of the loops to use arrays as much as possible. Reviewed By: mendio, pepeland Differential Revision: https://developer.blender.org/D16052 --- source/blender/makesrna/intern/rna_brush.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index a50264e64db..aa2d94f9082 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1930,6 +1930,20 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Extend Lines", "Show help lines for stroke extension"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + prop = RNA_def_property(srna, "use_collide_strokes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_STROKE_COLLIDE); + RNA_def_property_boolean_default(prop, false); + RNA_def_property_ui_text( + prop, "Strokes Collision", "Check if extend lines collide with strokes"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + prop = RNA_def_property(srna, "use_collide_only", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_COLLIDE_ONLY); + RNA_def_property_boolean_default(prop, false); + RNA_def_property_ui_text( + prop, "Only Collide Lines", "Use for closing gaps only if the extend strokes collide"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_FILL_HIDE); RNA_def_property_boolean_default(prop, true); -- cgit v1.2.3