[Bf-blender-cvs] [b0595c30daf] greasepencil-object: Reformat draw mode and help lines for fill
Antonio Vazquez
noreply at git.blender.org
Fri Jan 12 20:02:09 CET 2018
Commit: b0595c30dafcc26e6e40a1967fae7b70936308e0
Author: Antonio Vazquez
Date: Fri Jan 12 20:01:56 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBb0595c30dafcc26e6e40a1967fae7b70936308e0
Reformat draw mode and help lines for fill
Now the show help lines is a separated option and the draw mode can be used internally without intermediate step.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
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 62bada1a3ef..498af9ec589 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -389,10 +389,11 @@ class GreasePencilBrushPanel:
row.prop(brush, "fill_simplyfy_lvl", text="Simplify")
row = layout.row(align=True)
- row.prop(brush, "fill_show_boundary", text="Mode")
+ row.prop(brush, "fill_draw_mode", text="Mode")
+ row.prop(brush, "fill_show_boundary", text="", icon='GRID')
row = layout.row(align=True)
- row.enabled = brush.fill_show_boundary != "NONE" and brush.fill_show_boundary != "STROKE"
+ row.enabled = brush.fill_draw_mode != "STROKE"
row.prop(brush, "fill_hide", text="Hide Transparent Lines")
row = layout.row(align=True)
row.enabled = brush.fill_hide
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index aba9f3293e7..bb076177cf3 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -152,7 +152,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4])
tgpw.dflag = 0;
tgpw.disable_fill = 1;
tgpw.dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS);
-
+
glEnable(GL_BLEND);
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
@@ -193,11 +193,11 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4])
tgpw.custonion = true;
/* normal strokes */
- if ((tgpf->fill_draw_mode == GP_FILL_DMODE_NONE) ||
- (tgpf->fill_draw_mode == GP_FILL_DMODE_STROKE) ||
+ if ((tgpf->fill_draw_mode == GP_FILL_DMODE_STROKE) ||
(tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH))
{
ED_gp_draw_fill(&tgpw);
+
}
/* 3D Lines with basic shapes and invisible lines */
@@ -209,7 +209,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4])
}
}
}
-
+
glDisable(GL_BLEND);
}
@@ -987,8 +987,8 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *event
return OPERATOR_CANCELLED;
}
- /* Enable custom drawing handlers */
- if (tgpf->fill_draw_mode != GP_FILL_DMODE_NONE) {
+ /* 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);
}
@@ -1022,7 +1022,7 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event)
case LEFTMOUSE:
tgpf->on_back = RNA_boolean_get(op->ptr, "on_back");
/* first time the event is not enabled to show help lines */
- if ((tgpf->oldkey != -1) || ((tgpf->fill_draw_mode != GP_FILL_DMODE_NONE) == 0)) {
+ if ((tgpf->oldkey != -1) || ((tgpf->flag & GP_BRUSH_FILL_SHOW_HELPLINES) == 0)) {
ARegion *ar = BKE_area_find_region_xy(CTX_wm_area(C), RGN_TYPE_ANY, event->x, event->y);
if (ar) {
rcti region_rect;
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 26d73b202c9..5e53f9b7c05 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -152,6 +152,8 @@ typedef enum eGPDbrush_Flag {
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),
} eGPDbrush_Flag;
/* ***************************************** */
@@ -518,10 +520,9 @@ typedef enum eGP_OnionModes {
/* gpd->fill draw modes */
typedef enum eGP_FillDrawModes {
- GP_FILL_DMODE_NONE = 0,
- GP_FILL_DMODE_STROKE = 1,
- GP_FILL_DMODE_CONTROL = 2,
- GP_FILL_DMODE_BOTH = 3,
+ GP_FILL_DMODE_STROKE = 0,
+ GP_FILL_DMODE_CONTROL = 1,
+ GP_FILL_DMODE_BOTH = 2,
} eGP_FillDrawModes;
/* xray modes (Depth Ordering) */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index c5bdf32eb17..e0a38f45758 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -445,10 +445,9 @@ EnumPropertyItem rna_enum_gpencil_drawing_brushes_items[] = {
};
static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = {
-{ GP_FILL_DMODE_NONE, "NONE", 0, "None", "Use strokes as fill boundary limits but do not display help lines" },
-{ GP_FILL_DMODE_STROKE, "STROKE", 0, "Strokes", "Use visible strokes as fill boundary limits and display help lines" },
-{ GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Control", "Use internal control lines as fill boundary limits and display help lines" },
-{ GP_FILL_DMODE_BOTH, "BOTH", 0, "Both", "Use visible strokes and control lines as fill boundary limits and display help lines" },
+{ GP_FILL_DMODE_STROKE, "STROKE", 0, "Strokes", "Use visible strokes as fill boundary limits" },
+{ GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Control", "Use internal control lines as fill boundary limits" },
+{ GP_FILL_DMODE_BOTH, "BOTH", 0, "Both", "Use visible strokes and control lines as fill boundary limits" },
{ 0, NULL, 0, NULL, NULL }
};
@@ -2378,12 +2377,17 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(prop, "Fill Only", "The brush is only for filling strokes");
- prop = RNA_def_property(srna, "fill_show_boundary", PROP_ENUM, PROP_NONE);
+ prop = RNA_def_property(srna, "fill_draw_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "fill_draw_mode");
RNA_def_property_enum_items(prop, rna_enum_gpencil_fill_draw_modes_items);
- RNA_def_property_ui_text(prop, "Mode", "Mode to draw boundary limits and display help lines");
+ RNA_def_property_ui_text(prop, "Mode", "Mode to draw boundary limits");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ prop = RNA_def_property(srna, "fill_show_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_SHOW_HELPLINES);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Show Lines", "Show help lines for filling to see boundaries");
+
prop = RNA_def_property(srna, "fill_hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_HIDE);
RNA_def_property_boolean_default(prop, true);
More information about the Bf-blender-cvs
mailing list