From a334b5a4b6bee306ba014aa5f9df608de0259735 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 6 Aug 2012 15:20:14 +0000 Subject: Made feather self-intersection check an option. Useful in cases when masking stuff like self-intersecting ropes. This could probably be smarter option, but can't currently think about robust approach here. --- release/scripts/startup/bl_ui/properties_mask_common.py | 2 ++ source/blender/blenkernel/intern/mask.c | 3 ++- source/blender/makesdna/DNA_mask_types.h | 3 ++- source/blender/makesrna/intern/rna_mask.c | 7 +++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py index e40b46fda70..7cd2ae0b509 100644 --- a/release/scripts/startup/bl_ui/properties_mask_common.py +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -127,6 +127,8 @@ class MASK_PT_spline(): row.prop(spline, "use_cyclic") row.prop(spline, "use_fill") + col.prop(spline, "use_self_intersection_check") + class MASK_PT_point(): # subclasses must define... diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 3208862cef6..4b4dcff229d 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -779,7 +779,8 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpl *tot_feather_point = tot; - spline_feather_collapse_inner_loops(spline, feather, tot); + if (spline->flag & MASK_SPLINE_NOINTERSECT) + spline_feather_collapse_inner_loops(spline, feather, tot); return feather; } diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h index e7322263a6b..b34a6c9b12f 100644 --- a/source/blender/makesdna/DNA_mask_types.h +++ b/source/blender/makesdna/DNA_mask_types.h @@ -141,7 +141,8 @@ typedef struct MaskLayer { /* reserve (1 << 0) for SELECT */ enum { MASK_SPLINE_CYCLIC = (1 << 1), - MASK_SPLINE_NOFILL = (1 << 2) + MASK_SPLINE_NOFILL = (1 << 2), + MASK_SPLINE_NOINTERSECT = (1 << 3) }; /* MaskSpline->weight_interp */ diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index 9ee2bb99b4e..f197bf8391d 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -568,6 +568,13 @@ static void rna_def_maskSpline(BlenderRNA *brna) 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, NC_MASK | NA_EDITED, "rna_Mask_update_data"); + + /* self-intersection check */ + prop = RNA_def_property(srna, "use_self_intersection_check", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_NOINTERSECT); + RNA_def_property_ui_text(prop, "Self Intersection Check", "Prevent feather from self-intersections"); + RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data"); } static void rna_def_mask_layer(BlenderRNA *brna) -- cgit v1.2.3