diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2020-09-07 21:26:00 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2020-09-07 21:29:12 +0300 |
commit | de21ab418d69ca82a07ec7c836b1deca09bbd57f (patch) | |
tree | a713cb1e6a98b12d309e57addc1965ebc0973984 /source/blender/modifiers/intern/MOD_boolean.c | |
parent | 19f56cfe6c59e3a54aaf7499fd9072a8790171b7 (diff) |
Add a Self option to the Exact boolean modifier. Fixes T52425.
With this option, self-intersections in either or both operands
will be handled properly (if both sides are piecewise winding
number constant, and maybe some other cases too).
In the Boolean tool, this flag was there already but the code
forced a unary operation in that case; this commit corrects it
to make a binary operation. This flag makes the code slower, which
is why it is an option and not an always-on thing.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_boolean.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 87489c90de3..bef7d5d8e4f 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -77,6 +77,7 @@ static void initData(ModifierData *md) bmd->double_threshold = 1e-6f; bmd->operation = eBooleanModifierOp_Difference; bmd->solver = eBooleanModifierSolver_Exact; + bmd->flag = 0; } static bool isDisabled(const struct Scene *UNUSED(scene), @@ -319,15 +320,18 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * #ifdef WITH_GMP const bool use_exact = bmd->solver == eBooleanModifierSolver_Exact; + const bool use_self = (bmd->flag & eBooleanModifierFlag_Self) != 0; #else if (bmd->solver == eBooleanModifierSolver_Exact) { BKE_modifier_set_error(md, "Compiled without GMP, using fast solver"); } const bool use_exact = false; + const bool use_self = false; #endif if (use_exact) { - BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair, NULL, false, bmd->operation); + BM_mesh_boolean( + bm, looptris, tottri, bm_face_isect_pair, NULL, use_self, bmd->operation); } else { BM_mesh_intersect(bm, @@ -393,7 +397,10 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE); uiItemR(layout, ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - if (!use_exact) { + if (use_exact) { + uiItemR(layout, ptr, "use_self", 0, NULL, ICON_NONE); + } + else { uiItemR(layout, ptr, "double_threshold", 0, NULL, ICON_NONE); } |