Commit: fad223212f267490441c3b8321501f1f1dd75c49 Author: Antonio Vazquez Date: Thu Jan 11 17:19:23 2018 +0100 Branches: greasepencil-object https://developer.blender.org/rBfad223212f267490441c3b8321501f1f1dd75c49
Separate help modes for filling Now the selector for help lines is separated. Before, some modes where not available because there was some UI options conflict. =================================================================== M release/scripts/startup/bl_ui/properties_grease_pencil_common.py M source/blender/editors/gpencil/gpencil_fill.c M source/blender/editors/include/ED_gpencil.h 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 09b37e833e2..62bada1a3ef 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -389,14 +389,15 @@ class GreasePencilBrushPanel: row.prop(brush, "fill_simplyfy_lvl", text="Simplify") row = layout.row(align=True) + row.prop(brush, "fill_show_boundary", text="Mode") + + row = layout.row(align=True) + row.enabled = brush.fill_show_boundary != "NONE" and brush.fill_show_boundary != "STROKE" row.prop(brush, "fill_hide", text="Hide Transparent Lines") row = layout.row(align=True) row.enabled = brush.fill_hide row.prop(brush, "fill_threshold", text="Threshold") - row = layout.row(align=True) - row.prop(brush, "fill_show_boundary", text="Show Boundary Lines") - row = layout.row(align=True) row.prop(brush, "fill_allow_stroke_only", text="Allow Colors without fill") diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 9efa37b606c..aba9f3293e7 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -192,10 +192,18 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4]) tgpw.onion = true; tgpw.custonion = true; - ED_gp_draw_fill(&tgpw); + /* normal strokes */ + if ((tgpf->fill_draw_mode == GP_FILL_DMODE_NONE) || + (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 */ - if (tgpf->flag & GP_BRUSH_FILL_SHOW_BOUNDARY) { + if ((tgpf->fill_draw_mode == GP_FILL_DMODE_CONTROL) || + (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) + { gp_draw_basic_stroke(gps, tgpw.diff_mat, gps->flag & GP_STROKE_CYCLIC, ink, tgpf->flag, tgpf->fill_threshold); } @@ -868,6 +876,7 @@ static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *op) tgpf->fill_leak = brush->fill_leak; tgpf->fill_threshold = brush->fill_threshold; tgpf->fill_simplylvl = brush->fill_simplylvl; + tgpf->fill_draw_mode = brush->fill_draw_mode; /* init undo */ gpencil_undo_init(tgpf->gpd); @@ -979,7 +988,7 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *event } /* Enable custom drawing handlers */ - if (tgpf->flag & GP_BRUSH_FILL_SHOW_BOUNDARY) { + if (tgpf->fill_draw_mode != GP_FILL_DMODE_NONE) { tgpf->draw_handle_3d = ED_region_draw_cb_activate(tgpf->ar->type, gpencil_fill_draw_3d, tgpf, REGION_DRAW_POST_VIEW); } @@ -1013,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->flag & GP_BRUSH_FILL_SHOW_BOUNDARY) == 0)) { + if ((tgpf->oldkey != -1) || ((tgpf->fill_draw_mode != GP_FILL_DMODE_NONE) == 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/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index f884b77ddba..7791b68a420 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -184,6 +184,7 @@ typedef struct tGPDfill { short fill_leak; /* number of pixel to consider the leak is too small (x 2) */ float fill_threshold; /* factor for transparency */ int fill_simplylvl; /* number of simplify steps */ + int fill_draw_mode; /* boundary limits drawing mode */ struct Image *ima; /* temp image */ struct BLI_Stack *stack; /* temp points data */ diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 3baab8411eb..26d73b202c9 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -127,7 +127,7 @@ typedef struct bGPDbrush { short fill_leak; /* number of pixel to consider the leak is too small (x 2) */ float fill_threshold; /* factor for transparency */ int fill_simplylvl; /* number of simplify steps */ - char pad[4]; + int fill_draw_mode; /* type of control lines drawing mode */ } bGPDbrush; /* bGPDbrush->flag */ @@ -150,10 +150,8 @@ typedef enum eGPDbrush_Flag { GP_BRUSH_FILL_ONLY = (1 << 7), /* fill hide transparent */ GP_BRUSH_FILL_HIDE = (1 << 8), - /* fill show boundary lines */ - GP_BRUSH_FILL_SHOW_BOUNDARY = (1 << 9), /* allow colors without fill factor defined */ - GP_BRUSH_FILL_ALLOW_STROKEONLY = (1 << 10), + GP_BRUSH_FILL_ALLOW_STROKEONLY = (1 << 9), } eGPDbrush_Flag; /* ***************************************** */ @@ -518,6 +516,13 @@ typedef enum eGP_OnionModes { GP_ONION_MODE_SELECTED = 2, } 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, +} eGP_FillDrawModes; /* xray modes (Depth Ordering) */ typedef enum eGP_DepthOrdering { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 5c44a82db73..c5bdf32eb17 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -444,6 +444,14 @@ EnumPropertyItem rna_enum_gpencil_drawing_brushes_items[] = { { 0, NULL, 0, NULL, NULL } }; +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" }, +{ 0, NULL, 0, NULL, NULL } +}; + #ifdef RNA_RUNTIME #include "DNA_anim_types.h" @@ -2370,10 +2378,11 @@ 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_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_SHOW_BOUNDARY); - RNA_def_property_boolean_default(prop, true); - RNA_def_property_ui_text(prop, "Show Boundary Lines", "Show help lines to visualize stroke boundaries"); + prop = RNA_def_property(srna, "fill_show_boundary", 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_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); prop = RNA_def_property(srna, "fill_hide", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_HIDE); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs