[Bf-blender-cvs] [c0cef0a3932] greasepencil-object: Remove limitation of fill only colors
Antonio Vazquez
noreply at git.blender.org
Tue Feb 6 17:18:03 CET 2018
Commit: c0cef0a39326690464de9a18c18a8a29724b8eae
Author: Antonio Vazquez
Date: Tue Feb 6 17:17:09 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc0cef0a39326690464de9a18c18a8a29724b8eae
Remove limitation of fill only colors
Now, when a fill brush is selected, the color picker shows all colors, not only fill colors. This makes the palette more consistent.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M source/blender/editors/gpencil/gpencil_colorpick.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_scene.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 2dbf2bce444..5f5158b851c 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -413,9 +413,6 @@ class GreasePencilBrushPanel:
row.enabled = brush.fill_hide
row.prop(brush, "fill_threshold", text="Threshold")
- row = layout.row(align=True)
- row.prop(brush, "fill_allow_stroke_only", text="Allow Colors without fill")
-
row = layout.row(align=False)
row.prop(context.tool_settings, "use_gpencil_draw_onback", text="Draw on Back")
diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c b/source/blender/editors/gpencil/gpencil_colorpick.c
index f5b2220481b..3e7cdb3bebf 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -241,25 +241,6 @@ static int gpencil_colorpick_poll(bContext *C)
return 0;
}
-/* get total number of available colors for brush */
-static int get_tot_colors(tGPDpick *tgpk)
-{
- int tot = 0;
- for (PaletteColor *palcol = tgpk->palette->colors.first; palcol; palcol = palcol->next) {
-
- /* Must use a color with fill with fill brushes */
- if (tgpk->brush->flag & GP_BRUSH_FILL_ONLY) {
- if ((palcol->fill[3] < GPENCIL_ALPHA_OPACITY_THRESH) &&
- ((tgpk->brush->flag & GP_BRUSH_FILL_ALLOW_STROKEONLY) == 0))
- {
- continue;
- }
- }
- tot++;
- }
- return tot;
-}
-
/* Allocate memory and initialize values */
static tGPDpick *gpencil_colorpick_init(bContext *C, wmOperator *op, const wmEvent *event)
{
@@ -295,7 +276,7 @@ static tGPDpick *gpencil_colorpick_init(bContext *C, wmOperator *op, const wmEve
tgpk->palette = palslot->palette;
/* allocate color table */
- tgpk->totcolor = get_tot_colors(tgpk);
+ tgpk->totcolor = BLI_listbase_count(&tgpk->palette->colors);
tgpk->curindex = tgpk->palette->active_color;
if (tgpk->totcolor > 0) {
tgpk->colors = MEM_callocN(sizeof(tGPDpickColor) * tgpk->totcolor, "gp_colorpicker");
@@ -360,16 +341,6 @@ static tGPDpick *gpencil_colorpick_init(bContext *C, wmOperator *op, const wmEve
int col = 0;
int t = 0;
for (PaletteColor *palcol = palette->colors.first; palcol; palcol = palcol->next) {
- /* Must use a color with fill with fill brushes */
- if (tgpk->brush->flag & GP_BRUSH_FILL_ONLY) {
- if ((palcol->fill[3] < GPENCIL_ALPHA_OPACITY_THRESH) &&
- ((tgpk->brush->flag & GP_BRUSH_FILL_ALLOW_STROKEONLY) == 0))
- {
- /* Still increment the index, so that setting active_color works */
- idx++;
- continue;
- }
- }
tcolor->index = idx;
BLI_strncpy(tcolor->name, palcol->info, sizeof(tcolor->name));
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index bce843ec786..06b18c64f4a 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1044,15 +1044,6 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *event
tgpf = op->customdata;
}
- /* Must use a color with fill */
- if ((tgpf->palcolor->fill[3] < GPENCIL_ALPHA_OPACITY_THRESH) &&
- ((tgpf->flag & GP_BRUSH_FILL_ALLOW_STROKEONLY) == 0))
- {
- BKE_report(op->reports, RPT_ERROR, "The current color must have fill enabled");
- gpencil_fill_exit(C, op);
- return OPERATOR_CANCELLED;
- }
-
/* Enable custom drawing handlers to show help lines */
if (tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) {
tgpf->draw_handle_3d = ED_region_draw_cb_activate(tgpf->ar->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW);
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 228db28855d..4e6005a4c37 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -155,8 +155,6 @@ typedef enum eGPDbrush_Flag {
GP_BRUSH_FILL_ONLY = (1 << 7),
/* fill hide transparent */
GP_BRUSH_FILL_HIDE = (1 << 8),
- /* allow colors without fill factor defined */
- GP_BRUSH_FILL_ALLOW_STROKEONLY = (1 << 9),
/* show fill help lines */
GP_BRUSH_FILL_SHOW_HELPLINES = (1 << 10),
/* lazy mouse */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index d48186ff662..90565c9eb89 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2452,12 +2452,6 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_HIDE);
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop, "Hide", "Hide transparent lines to use as boundary for filling");
-
- prop = RNA_def_property(srna, "fill_allow_stroke_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_ALLOW_STROKEONLY);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Allow Stroke Only", "Allow to use colors without fill (this can be used to create clean strokes)");
-
}
/* Grease Pencil Drawing Brushes API */
More information about the Bf-blender-cvs
mailing list