Mask: option not to treat overlapping curves as holes

This commit is contained in:
Campbell Barton 2014-02-13 11:47:00 +11:00
parent 6ee9d1b69d
commit 108ad34429
Notes: blender-bot 2023-02-14 11:29:55 +01:00
Referenced by issue #37758, Mask Editor - Overlapping masks seem to be inconsistant
6 changed files with 19 additions and 3 deletions

View File

@ -107,6 +107,9 @@ class MASK_PT_layers:
layout.prop(active_layer, "blend")
layout.prop(active_layer, "falloff")
row = layout.row(align=True)
layout.prop(active_layer, "use_fill_holes")
class MASK_PT_spline():
# subclasses must define...

View File

@ -150,6 +150,7 @@ MaskLayer *BKE_mask_layer_new(Mask *mask, const char *name)
masklay->blend = MASK_BLEND_MERGE_ADD;
masklay->alpha = 1.0f;
masklay->flag = MASK_LAYERFLAG_FILL_DISCRETE;
return masklay;
}

View File

@ -916,6 +916,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
unsigned int sf_tri_tot;
rctf bounds;
unsigned int face_index;
int scanfill_flag = 0;
/* now we have all the splines */
face_coords = MEM_mallocN((sizeof(float) * 3) * sf_vert_tot, "maskrast_face_coords");
@ -941,7 +942,10 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
}
/* main scan-fill */
sf_tri_tot = (unsigned int)BLI_scanfill_calc_ex(&sf_ctx, BLI_SCANFILL_CALC_HOLES, zvec);
if ((masklay->flag & MASK_LAYERFLAG_FILL_DISCRETE) == 0)
scanfill_flag |= BLI_SCANFILL_CALC_HOLES;
sf_tri_tot = (unsigned int)BLI_scanfill_calc_ex(&sf_ctx, scanfill_flag, zvec);
face_array = MEM_mallocN(sizeof(*face_array) * ((size_t)sf_tri_tot + (size_t)tot_feather_quads), "maskrast_face_index");
face_index = 0;

View File

@ -1058,7 +1058,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const
* the edgefill itself has good auto-hole detection)
* WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */
if (poly > 1) {
if ((flag & BLI_SCANFILL_CALC_HOLES) && (poly > 1)) {
unsigned short *polycache, *pc;
/* so, sort first */

View File

@ -216,7 +216,10 @@ enum {
/* masklay->flag */
enum {
MASK_LAYERFLAG_LOCKED = (1 << 4),
MASK_LAYERFLAG_SELECT = (1 << 5)
MASK_LAYERFLAG_SELECT = (1 << 5),
/* no holes */
MASK_LAYERFLAG_FILL_DISCRETE = (1 << 6),
};
/* masklay_shape->flag */

View File

@ -884,6 +884,11 @@ static void rna_def_mask_layer(BlenderRNA *brna)
RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
/* filling options */
prop = RNA_def_property(srna, "use_fill_holes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_LAYERFLAG_FILL_DISCRETE);
RNA_def_property_ui_text(prop, "Calculate Holes", "Calculate holes when filling overlapping curves");
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
}
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)