[Bf-blender-cvs] [8541b335cb0] newboolean: Hooked up new boolean to boolean modifier.
Howard Trickey
noreply at git.blender.org
Wed Jul 15 02:50:06 CEST 2020
Commit: 8541b335cb064c4aca63ad89f268db165a957835
Author: Howard Trickey
Date: Tue Jul 14 20:29:39 2020 -0400
Branches: newboolean
https://developer.blender.org/rB8541b335cb064c4aca63ad89f268db165a957835
Hooked up new boolean to boolean modifier.
===================================================================
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_boolean.c
===================================================================
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 50b4739e09f..dff3bc15307 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -857,11 +857,12 @@ typedef enum {
eBooleanModifierOp_Difference = 2,
} BooleanModifierOp;
-/* bm_flag (only used when G_DEBUG) */
+/* bm_flag (first three only used when G_DEBUG) */
enum {
eBooleanModifierBMeshFlag_BMesh_Separate = (1 << 0),
eBooleanModifierBMeshFlag_BMesh_NoDissolve = (1 << 1),
eBooleanModifierBMeshFlag_BMesh_NoConnectRegions = (1 << 2),
+ eBooleanModifierBMeshFlag_BMesh_Exact = (1 << 3),
};
typedef struct MDefInfluence {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 20648970bd1..c2aa40afd06 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2767,6 +2767,14 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
prop, "Overlap Threshold", "Threshold for checking overlapping geometry");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_boolean(srna,
+ "use_exact",
+ true,
+ "Exact",
+ "Use the Exact-arithmetic boolean (slower, handles more cases");
+ RNA_def_property_boolean_sdna(prop, NULL, "bm_flag", eBooleanModifierBMeshFlag_BMesh_Exact);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
/* BMesh debugging options, only used when G_DEBUG is set */
/* BMesh intersection options */
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 1d39aa786a5..50f90f4c57d 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -61,6 +61,7 @@
#include "bmesh.h"
#include "bmesh_tools.h"
+#include "tools/bmesh_boolean.h"
#include "tools/bmesh_intersect.h"
#ifdef DEBUG_TIME
@@ -74,6 +75,7 @@ static void initData(ModifierData *md)
bmd->double_threshold = 1e-6f;
bmd->operation = eBooleanModifierOp_Difference;
+ bmd->bm_flag = eBooleanModifierBMeshFlag_BMesh_Exact;
}
static bool isDisabled(const struct Scene *UNUSED(scene),
@@ -309,8 +311,15 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
use_island_connect = (bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_NoConnectRegions) ==
0;
}
+
+ bool use_exact = bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_Exact;
- BM_mesh_intersect(bm,
+ if (use_exact) {
+ BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair,
+ NULL, false, bmd->operation);
+ }
+ else {
+ BM_mesh_intersect(bm,
looptris,
tottri,
bm_face_isect_pair,
@@ -323,6 +332,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
false,
bmd->operation,
bmd->double_threshold);
+ }
MEM_freeN(looptris);
}
@@ -370,6 +380,7 @@ static void panel_draw(const bContext *C, Panel *panel)
uiItemR(layout, &ptr, "object", 0, NULL, ICON_NONE);
uiItemR(layout, &ptr, "double_threshold", 0, NULL, ICON_NONE);
+ uiItemR(layout, &ptr, "use_exact", 0, NULL, ICON_NONE);
if (G.debug) {
uiLayout *col = uiLayoutColumn(layout, true);
More information about the Bf-blender-cvs
mailing list