How do I figure out what triggers a crash? Trying to now bevel the “cut” and it crashes.
In python I’m doing like this.
bvl_wght = bm.edges.layers.bevel_weight.verify()
#Get weighted edges
wght_ed = [e for e in bm.edges if e[bvl_wght] == 1.0]
#Bevel weighted edges
bmesh.ops.bevel(
bm,
geom=wght_ed,
offset=0.02,
offset_type='WIDTH',
segments=1,
profile=0.5,
clamp_overlap=False,
loop_slide=False
)
I have looked at the MOD_bevel.c
, bmesh_bevel.h
and the bmesh_bevel.c
and can’t tell if I’m missing something simple that’s causing the crash.
static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
TestModifierData *smd = (TestModifierData *)md;
Mesh *result = mesh;
Mesh *mesh_other;
BMVert *v;
MDeformVert *dvert = NULL;
CurveProfile *custom_profile = NULL;
float weight;
const int vgroup = -1;
const int res = 4;
const float profile = 0.5f;
const float bevel_angle = DEG2RADF(30.0f);
const int offset_type = BEVEL_AMT_WIDTH;
const int affect_type = BEVEL_AFFECT_EDGES;
const int profile_type = BEVEL_PROFILE_SUPERELLIPSE;
const float value = 0.02f;
const int mat = -1;
const bool use_weights = false;
const bool do_clamp = false;
const bool loop_slide = false;
const bool mark_seam = false;
const bool mark_sharp = false;
const bool harden_normals = false;
const bool invert_vgroup = false;
const int face_strength_mode = BEVEL_FACE_STRENGTH_NONE;
const int miter_outer = BEVEL_MITER_SHARP;
const int miter_inner = BEVEL_MITER_SHARP;
const float spread = 0.1f;
const float smoothresh = 0.1f;
const int vmesh_method = BEVEL_VMESH_ADJ;
At the end it’s like this.
BM_mesh_delete_hflag_context(bm, BM_FACE_TAG, DEL_FACES);
BM_mesh_bevel(bm,
smd->width,
offset_type,
profile_type,
smd->segments,
profile,
affect_type,
use_weights,
do_clamp,
dvert,
vgroup,
mat,
loop_slide,
mark_seam,
mark_sharp,
harden_normals,
face_strength_mode,
miter_outer,
miter_inner,
spread,
mesh->smoothresh,
custom_profile,
vmesh_method);
result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh);
BM_mesh_free(bm);
result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;