Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-02-13 04:47:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-13 04:48:46 +0400
commit108ad3442960ef6ead3015736b3de679146f7a8d (patch)
tree7bc45177392eaf5c97b43a463052e299ded7c500 /source
parent6ee9d1b69db0064abb03d74dbc365cf860a3c3d9 (diff)
Mask: option not to treat overlapping curves as holes
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/mask.c1
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c6
-rw-r--r--source/blender/blenlib/intern/scanfill.c2
-rw-r--r--source/blender/makesdna/DNA_mask_types.h5
-rw-r--r--source/blender/makesrna/intern/rna_mask.c5
5 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 23c0401c1fe..fab7ebf2060 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -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;
}
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index e1e310f3d3c..694f892f2c8 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -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;
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index ae0760eb30e..a1d48591cc8 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -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 */
diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h
index a72e287c16f..642bc733077 100644
--- a/source/blender/makesdna/DNA_mask_types.h
+++ b/source/blender/makesdna/DNA_mask_types.h
@@ -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 */
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 16cfbbd5ea6..0e4db5b50bf 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -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)