Fix #116262: Modal knife tool can crash if used on hidden object #119383

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:116262_b into blender-v4.1-release 2024-03-12 17:02:46 +01:00
1 changed files with 3 additions and 1 deletions

View File

@ -3213,7 +3213,9 @@ static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd,
vc.mval[0] = int(kcd->curr.mval[0]);
vc.mval[1] = int(kcd->curr.mval[1]);
f = EDBM_face_find_nearest(&vc, &dist);
if (BKE_object_is_visible_in_viewport(vc.v3d, vc.obact)) {

It looks like the ViewContext and comment can be moved inside this block.

Ideally all objects in kcd->objects should be tested for "nearest".

And for further improvements, the back-buffer could not even be used if we used the BVH nearest function instead.

But these changes are more involved. For bug fixing, it looks fine.

It looks like the `ViewContext` and comment can be moved inside this block. Ideally all objects in `kcd->objects` should be tested for "nearest". And for further improvements, the back-buffer could not even be used if we used the BVH nearest function instead. But these changes are more involved. For bug fixing, it looks fine.
Review

Yep, yep and yep.

Will do separately.

Yep, yep and yep. Will do separately.
f = EDBM_face_find_nearest(&vc, &dist);
}
/* Cheat for now; just put in the origin instead
* of a true coordinate on the face.