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
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2020-08-31 19:49:22 +0300
committerHans Goudey <h.goudey@me.com>2020-08-31 19:49:22 +0300
commitfc8533a3c93ce689a712b67680c90b16f226f9b9 (patch)
treeaa8e54acbffb573a7fbed3cb6a89e595d2dd3023
parent7056f180d3a220c0c98999edd0ad3273b46a9ced (diff)
New Boolean: Always expose solver propery, add warning
After discussion with @howardt, it seems the solver property should always be exposed, even in lite builds. This commit removes the ifdefs for that property and adds a warning if the "Exact" solver is used when Blender is compiled without GMP. These changes apply to the boolean modifier as well.
-rw-r--r--source/blender/editors/mesh/editmesh_intersect.c35
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c12
2 files changed, 18 insertions, 29 deletions
diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c
index ae882ee59bb..1b5e374b2a7 100644
--- a/source/blender/editors/mesh/editmesh_intersect.c
+++ b/source/blender/editors/mesh/editmesh_intersect.c
@@ -154,6 +154,9 @@ static int edbm_intersect_exec(bContext *C, wmOperator *op)
#ifdef WITH_GMP
const bool exact = RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT;
#else
+ if (RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT) {
+ BKE_report(op->reports, RPT_WARNING, "Compiled without GMP, using fast solver");
+ }
const bool exact = false;
#endif
bool use_self;
@@ -248,11 +251,7 @@ static void edbm_intersect_ui(bContext *UNUSED(C), wmOperator *op)
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
-#ifdef WITH_GMP
bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT;
-#else
- bool use_exact = false;
-#endif
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -262,11 +261,11 @@ static void edbm_intersect_ui(bContext *UNUSED(C), wmOperator *op)
row = uiLayoutRow(layout, false);
uiItemR(row, &ptr, "separate_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemS(layout);
-#ifdef WITH_GMP
+
row = uiLayoutRow(layout, false);
uiItemR(row, &ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemS(layout);
-#endif
+
if (!use_exact) {
uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE);
}
@@ -295,13 +294,11 @@ void MESH_OT_intersect(struct wmOperatorType *ot)
{0, NULL, 0, NULL, NULL},
};
-#ifdef WITH_GMP
static const EnumPropertyItem isect_intersect_solver_items[] = {
{ISECT_SOLVER_FAST, "FAST", 0, "Fast", "Faster Solver, some limitations"},
{ISECT_SOLVER_EXACT, "EXACT", 0, "Exact", "Exact Solver, slower, handles more cases"},
{0, NULL, 0, NULL, NULL},
};
-#endif
/* identifiers */
ot->name = "Intersect (Knife)";
@@ -319,14 +316,12 @@ void MESH_OT_intersect(struct wmOperatorType *ot)
ot->srna, "separate_mode", isect_separate_items, ISECT_SEPARATE_CUT, "Separate Mode", "");
RNA_def_float_distance(
ot->srna, "threshold", 0.000001f, 0.0, 0.01, "Merge threshold", "", 0.0, 0.001);
-#ifdef WITH_GMP
RNA_def_enum(ot->srna,
"solver",
isect_intersect_solver_items,
ISECT_SOLVER_EXACT,
"Solver",
"Which Intersect solver to use");
-#endif
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -351,9 +346,12 @@ static int edbm_intersect_boolean_exec(bContext *C, wmOperator *op)
bool use_swap = RNA_boolean_get(op->ptr, "use_swap");
bool use_self = RNA_boolean_get(op->ptr, "use_self");
#ifdef WITH_GMP
- bool use_exact = RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT;
+ const bool use_exact = RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT;
#else
- bool use_exact = false;
+ if (RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT) {
+ BKE_report(op->reports, RPT_WARNING, "Compiled without GMP, using fast solver");
+ }
+ const bool use_exact = false;
#endif
const float eps = RNA_float_get(op->ptr, "threshold");
int (*test_fn)(BMFace *, void *);
@@ -415,11 +413,7 @@ static void edbm_intersect_boolean_ui(bContext *UNUSED(C), wmOperator *op)
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
-#ifdef WITH_GMP
bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT;
-#else
- bool use_exact = false;
-#endif
uiLayoutSetPropSep(layout, true);
uiLayoutSetPropDecorate(layout, false);
@@ -427,11 +421,11 @@ static void edbm_intersect_boolean_ui(bContext *UNUSED(C), wmOperator *op)
row = uiLayoutRow(layout, false);
uiItemR(row, &ptr, "operation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemS(layout);
-#ifdef WITH_GMP
+
row = uiLayoutRow(layout, false);
uiItemR(row, &ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemS(layout);
-#endif
+
uiItemR(layout, &ptr, "use_swap", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "use_self", 0, NULL, ICON_NONE);
if (!use_exact) {
@@ -447,13 +441,12 @@ void MESH_OT_intersect_boolean(struct wmOperatorType *ot)
{BMESH_ISECT_BOOLEAN_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
{0, NULL, 0, NULL, NULL},
};
-#ifdef WITH_GMP
+
static const EnumPropertyItem isect_boolean_solver_items[] = {
{ISECT_SOLVER_FAST, "FAST", 0, "Fast", "Faster Solver, some limitations"},
{ISECT_SOLVER_EXACT, "EXACT", 0, "Exact", "Exact Solver, slower, handles more cases"},
{0, NULL, 0, NULL, NULL},
};
-#endif
/* identifiers */
ot->name = "Intersect (Boolean)";
@@ -480,14 +473,12 @@ void MESH_OT_intersect_boolean(struct wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_self", false, "Self", "Do self-union or self-intersection");
RNA_def_float_distance(
ot->srna, "threshold", 0.000001f, 0.0, 0.01, "Merge threshold", "", 0.0, 0.001);
-#ifdef WITH_GMP
RNA_def_enum(ot->srna,
"solver",
isect_boolean_solver_items,
ISECT_SOLVER_EXACT,
"Solver",
"Which Boolean solver to use");
-#endif
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index dbdcaccf6f1..37c3f32f529 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -324,6 +324,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
#ifdef WITH_GMP
bool use_exact = bmd->solver == eBooleanModifierSolver_Exact;
#else
+ if (bmd->solver == eBooleanModifierSolver_Exact) {
+ BKE_modifier_set_error(md, "Compiled without GMP, using fast solver");
+ }
bool use_exact = false;
#endif
@@ -390,15 +393,10 @@ static void panel_draw(const bContext *C, Panel *panel)
uiLayoutSetPropSep(layout, true);
- uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
-
-#ifndef WITH_GMP
- bool use_exact = false;
-#else
- bool use_exact = RNA_enum_get(&ptr, "solver") == eBooleanModifierSolver_Exact;
+ const bool use_exact = RNA_enum_get(&ptr, "solver") == eBooleanModifierSolver_Exact;
+ uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
-#endif
if (!use_exact) {
uiItemR(layout, &ptr, "double_threshold", 0, NULL, ICON_NONE);