[Bf-blender-cvs] [f6b7278a890] greasepencil-object: For fill brush use only fill colors

Antonio Vazquez noreply at git.blender.org
Thu Jan 11 12:05:32 CET 2018


Commit: f6b7278a890d2523f7542fe14ec2bc51c6fa07c0
Author: Antonio Vazquez
Date:   Thu Jan 11 12:05:24 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf6b7278a890d2523f7542fe14ec2bc51c6fa07c0

For fill brush use only fill colors

If the brush is for fill, the list of color must be limited to fill colors only, except the flag to override this, is enabled.

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

M	source/blender/editors/gpencil/gpencil_colorpick.c
M	source/blender/editors/include/ED_gpencil.h

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

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c b/source/blender/editors/gpencil/gpencil_colorpick.c
index 14d35776a2f..e53e82b57fa 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -279,9 +279,11 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, wmOperator *op)
 	/* set current scene and window info */
 	tgpk->win = CTX_wm_window(C);
 	tgpk->scene = CTX_data_scene(C);
+	tgpk->ts = CTX_data_tool_settings(C);
 	tgpk->ob = CTX_data_active_object(C);
 	tgpk->sa = CTX_wm_area(C);
 	tgpk->ar = CTX_wm_region(C);
+	tgpk->brush = BKE_gpencil_brush_getactive(ts);
 
 	ED_region_visible_rect(tgpk->ar, &tgpk->rect);
 
@@ -322,6 +324,15 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, wmOperator *op)
 	int col = 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))
+			{
+				continue;
+			}
+		}
+
 		tcolor->index = idx;
 		copy_v4_v4(tcolor->rgba, palcol->rgb);
 		if (palcol->fill[3] > 0.0f) {
@@ -349,6 +360,7 @@ static tGPDpick *gp_session_init_colorpick(bContext *C, wmOperator *op)
 			col++;
 		}
 	}
+	tgpk->totcolor = idx;
 
 	/* return context data for running operator */
 	return tgpk;
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 793fa0c2d05..f884b77ddba 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -202,10 +202,12 @@ typedef struct tGPDpickColor {
 typedef struct tGPDpick {
 	struct wmWindow *win;               /* window */
 	struct Scene *scene;				/* current scene from context */
+	struct ToolSettings *ts;			/* current toolsettings from context */
 	struct Object *ob;					/* current active gp object */
 	struct ScrArea *sa;					/* area where painting originated */
 	struct ARegion *ar;					/* region where painting originated */
 	struct Palette *palette;			/* current palette */
+	struct bGPDbrush *brush;            /* current brush */
 
 	rcti rect;                          /* visible area */
 	rcti panel;                         /* panel area */



More information about the Bf-blender-cvs mailing list