Boolean Modifier: add debug options
Only show & use when running in debug mode.
This commit is contained in:
parent
7177e0ac3e
commit
215651af1b
Notes:
blender-bot
2023-02-14 06:17:15 +01:00
Referenced by issue #53683, 2.79a release
|
@ -146,9 +146,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
|||
layout.row().prop(md, "offset_type", expand=True)
|
||||
|
||||
def BOOLEAN(self, layout, ob, md):
|
||||
solver = md.solver
|
||||
if not bpy.app.build_options.mod_boolean:
|
||||
layout.label("Built without Boolean modifier")
|
||||
return
|
||||
if solver == 'CARVE':
|
||||
layout.label("Built without Carve solver")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
@ -164,9 +165,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
|||
split.column().label(text="Solver:")
|
||||
split.column().prop(md, "solver", text="")
|
||||
|
||||
if md.solver == 'BMESH':
|
||||
if solver == 'BMESH':
|
||||
layout.prop(md, "double_threshold")
|
||||
|
||||
if bpy.app.debug:
|
||||
layout.prop(md, "debug_options")
|
||||
|
||||
|
||||
def BUILD(self, layout, ob, md):
|
||||
split = layout.split()
|
||||
|
||||
|
|
|
@ -654,7 +654,8 @@ typedef struct BooleanModifierData {
|
|||
struct Object *object;
|
||||
char operation;
|
||||
char solver;
|
||||
char pad[2];
|
||||
char pad;
|
||||
char bm_flag;
|
||||
float double_threshold;
|
||||
} BooleanModifierData;
|
||||
|
||||
|
@ -669,6 +670,13 @@ typedef enum {
|
|||
eBooleanModifierSolver_BMesh = 1,
|
||||
} BooleanSolver;
|
||||
|
||||
/* bm_flag (only used when G_DEBUG) */
|
||||
enum {
|
||||
eBooleanModifierBMeshFlag_BMesh_Separate = (1 << 0),
|
||||
eBooleanModifierBMeshFlag_BMesh_NoDissolve = (1 << 1),
|
||||
eBooleanModifierBMeshFlag_BMesh_NoConnectRegions = (1 << 2),
|
||||
};
|
||||
|
||||
typedef struct MDefInfluence {
|
||||
int vertex;
|
||||
float weight;
|
||||
|
|
|
@ -1977,6 +1977,23 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
|
|||
RNA_def_property_ui_range(prop, 0, 1, 0.0001, 6);
|
||||
RNA_def_property_ui_text(prop, "Overlap Threshold", "Threshold for checking overlapping geometry");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
|
||||
/* BMesh debugging options, only used when G_DEBUG is set */
|
||||
|
||||
/* BMesh intersection options */
|
||||
static EnumPropertyItem debug_items[] = {
|
||||
{eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""},
|
||||
{eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "NoDissolve", ""},
|
||||
{eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "NoConnectRegions", ""},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
prop = RNA_def_property(srna, "debug_options", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, debug_items);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "bm_flag");
|
||||
RNA_def_property_flag(prop, PROP_ENUM_FLAG);
|
||||
RNA_def_property_ui_text(prop, "Debug", "Debugging options, only when started with '-d'");
|
||||
RNA_def_property_update(prop, 0, "rna_Modifier_update");
|
||||
}
|
||||
|
||||
static void rna_def_modifier_array(BlenderRNA *brna)
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "BLI_alloca.h"
|
||||
#include "BLI_math_geom.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_global.h" /* only to check G.debug */
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "bmesh.h"
|
||||
|
@ -322,11 +323,17 @@ static DerivedMesh *applyModifier_bmesh(
|
|||
* currently this is ok for 'BM_mesh_intersect' */
|
||||
// BM_mesh_normals_update(bm);
|
||||
|
||||
/* change for testing */
|
||||
bool use_separate = false;
|
||||
bool use_dissolve = true;
|
||||
bool use_island_connect = true;
|
||||
|
||||
/* change for testing */
|
||||
if (G.debug & G_DEBUG) {
|
||||
use_separate = (bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_Separate) != 0;
|
||||
use_dissolve = (bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_NoDissolve) == 0;
|
||||
use_island_connect = (bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_NoConnectRegions) == 0;
|
||||
}
|
||||
|
||||
BM_mesh_intersect(
|
||||
bm,
|
||||
looptris, tottri,
|
||||
|
|
Loading…
Reference in New Issue