[Bf-blender-cvs] [ec06532cefa] blender2.8: GP: New option to disable lasso while drawing

Antonioya noreply at git.blender.org
Sun Sep 30 16:22:16 CEST 2018


Commit: ec06532cefa6e3813992fe226dddfe2235edd33c
Author: Antonioya
Date:   Sun Sep 30 16:21:28 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBec06532cefa6e3813992fe226dddfe2235edd33c

GP: New option to disable lasso while drawing

Now it's possible to disable the lasso effect of the fill color while drawing with a fill color.

This sometimes is required to see the lines and it's the first step to implement a new lasso brush.

===================================================================

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesrna/intern/rna_brush.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 7f6a47221c3..31038396efb 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -341,6 +341,9 @@ class GreasePencilAppearancePanel:
 
             layout.prop(gp_settings, "use_cursor", text="Show Brush")
 
+            if gp_settings.gpencil_brush_type == 'DRAW':
+                layout.prop(gp_settings, "disable_lasso", text="Hide fill color while drawing")
+
             if gp_settings.gpencil_brush_type == 'FILL':
                 layout.prop(brush, "cursor_color_add", text="Color")
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index d42a0055be6..345b0f0c577 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -969,8 +969,10 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
 				        e_data->batch_buffer_stroke,
 				        stl->storage->unit_matrix);
 
-				if ((gpd->runtime.sbuffer_size >= 3) && (gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
-				    ((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0))
+				if ((gpd->runtime.sbuffer_size >= 3) &&
+					(gpd->runtime.sfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) &&
+				    ((gpd->runtime.sbuffer_sflag & GP_STROKE_NOFILL) == 0) &&
+					((brush->gpencil_settings->flag & GP_BRUSH_DISSABLE_LASSO) == 0))
 				{
 					/* if not solid, fill is simulated with solid color */
 					if (gpd->runtime.bfill_style > 0) {
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 6c382dcbcab..4801aee3c60 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -121,7 +121,9 @@ typedef enum eGPDbrush_Flag {
 	/* Random settings group */
 	GP_BRUSH_GROUP_RANDOM = (1 << 12),
 	/* Keep material assigned to brush */
-	GP_BRUSH_MATERIAL_PINNED = (1 << 13)
+	GP_BRUSH_MATERIAL_PINNED = (1 << 13),
+	/* Do not show fill color while drawing (no lasso mode) */
+	GP_BRUSH_DISSABLE_LASSO = (1 << 14),
 } eGPDbrush_Flag;
 
 /* BrushGpencilSettings->gp_fill_draw_mode */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 7eacf6845ea..5d66742e8a3 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1286,6 +1286,11 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
 	RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
 	RNA_def_property_ui_text(prop, "Pin Material", "Keep material assigned to brush");
 	RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+
+	prop = RNA_def_property(srna, "disable_lasso", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_DISSABLE_LASSO);
+	RNA_def_property_ui_text(prop, "Disable Lasso", "Do not draw fill color while drawing the stroke");
+	RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 }
 
 static void rna_def_brush(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list