From 41fe8b9ea94fa6877d35a51567cd83b255431306 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 14 Jul 2012 20:53:52 +0000 Subject: use a different setting for fill/cyclic - you may want to have unfilled cyclic curves. --- source/blender/blenkernel/intern/mask_rasterize.c | 7 +++---- source/blender/editors/mask/mask_draw.c | 3 +++ source/blender/makesdna/DNA_mask_types.h | 5 ++++- source/blender/makesrna/intern/rna_mask.c | 7 +++++++ 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index a08118e6fa2..815f3ab34e3 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -467,7 +467,7 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas BLI_scanfill_begin(&sf_ctx); for (spline = masklay->splines.first; spline; spline = spline->next) { - const unsigned int is_cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0; + const unsigned int is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0; float (*diff_points)[2]; int tot_diff_point; @@ -541,7 +541,7 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas } } - if (is_cyclic) { + if (is_fill) { copy_v2_v2(co, diff_points[0]); sf_vert_prev = BLI_scanfill_vert_add(&sf_ctx, co); sf_vert_prev->tmp.u = sf_vert_tot; @@ -597,7 +597,7 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas } } else { - /* unfilled spline (non cyclic) */ + /* unfilled spline */ if (diff_feather_points) { float co_diff[3]; @@ -605,7 +605,6 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas float co_feather[3]; co_feather[2] = 1.0f; - open_spline_ranges[open_spline_index ][0] = sf_vert_tot; open_spline_ranges[open_spline_index ][1] = tot_diff_point; open_spline_index++; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index f080b9f96e7..f378d5452a4 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -388,6 +388,9 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline, mask_draw_curve_type(spline, feather_points, tot_feather_point, TRUE, is_smooth, is_active, rgb_tmp, draw_type); + + /* TODO, draw mirror values when MASK_SPLINE_NOFILL is set */ + MEM_freeN(feather_points); /* draw main curve */ diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h index 52fedd72e86..4c2330965ee 100644 --- a/source/blender/makesdna/DNA_mask_types.h +++ b/source/blender/makesdna/DNA_mask_types.h @@ -137,7 +137,10 @@ typedef struct MaskLayer { /* MaskSpline->flag */ /* reserve (1 << 0) for SELECT */ -#define MASK_SPLINE_CYCLIC (1 << 1) +enum { + MASK_SPLINE_CYCLIC = (1 << 1), + MASK_SPLINE_NOFILL = (1 << 2) +}; /* MaskSpline->weight_interp */ #define MASK_SPLINE_INTERP_LINEAR 1 diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index b879d2b19f7..e6fd47985cb 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -566,6 +566,13 @@ static void rna_def_maskSpline(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_CYCLIC); RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop"); RNA_def_property_update(prop, 0, "rna_Mask_update_data"); + + /* fill */ + prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_SPLINE_NOFILL); + RNA_def_property_ui_text(prop, "Fill", "Make this spline filled"); + RNA_def_property_update(prop, 0, "rna_Mask_update_data"); } static void rna_def_mask_layer(BlenderRNA *brna) -- cgit v1.2.3