use a different setting for fill/cyclic - you may want to have unfilled cyclic curves.

This commit is contained in:
Campbell Barton 2012-07-14 20:53:52 +00:00
parent 5e7f8b83ed
commit 41fe8b9ea9
5 changed files with 20 additions and 6 deletions

@ -733,7 +733,9 @@ class CLIP_PT_active_mask_spline(Panel):
col = layout.column()
col.prop(spline, "weight_interpolation")
col.prop(spline, "use_cyclic")
rowsub = col.row()
rowsub.prop(spline, "use_cyclic")
rowsub.prop(spline, "use_fill")
class CLIP_PT_active_mask_point(Panel):

@ -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++;

@ -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 */

@ -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

@ -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)