Fix T68852: Link select crashes after knife project
Knife project switches out of vertex selection mode, but wouldnt do this for all participating meshes. Logic in edbm_select_linked_pick would switch the viewcontext multiple times and the meshes selectmode was not in sync then, leading e.g. finding a vertex in 'unified_findnearest' (because last of the meshes selectmode was SCE_SELECT_VERTEX), but then later in 'EDBM_elem_from_selectmode' other meshes selectmode was not matching SCE_SELECT_VERTEX, leading to crash... Reviewers: campbellbarton Maniphest Tasks: T68852 Differential Revision: https://developer.blender.org/D5536
This commit is contained in:
parent
1888990934
commit
6f4e595e9b
Notes:
blender-bot
2023-02-14 04:39:18 +01:00
Referenced by commit 6992fc0b3b
, Add 'EDBM_selectmode_disable_multi' and use in knifeproject
Referenced by issue #68852, Knife Project: executing Link select afterwards will result in crash
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
@ -142,10 +143,21 @@ static int knifeproject_exec(bContext *C, wmOperator *op)
|
|||
/* select only tagged faces */
|
||||
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
|
||||
|
||||
/* not essential, but switch out of vertex mode since the
|
||||
* selected regions wont be nicely isolated after flushing.
|
||||
* note: call after de-select to avoid selection flushing */
|
||||
EDBM_selectmode_disable(scene, em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);
|
||||
CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
|
||||
if (ob->type == OB_MESH) {
|
||||
Mesh *me = (Mesh *)ob->data;
|
||||
BMEditMesh *embm = me->edit_mesh;
|
||||
if (embm) {
|
||||
/* not essential, but switch out of vertex mode since the
|
||||
* selected regions wont be nicely isolated after flushing.
|
||||
* note: call after de-select to avoid selection flushing.
|
||||
* note: do this on all participating meshes so this is in sync
|
||||
* e.g. for later selection picking, see T68852.*/
|
||||
EDBM_selectmode_disable(scene, embm, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
CTX_DATA_END;
|
||||
|
||||
BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, false, BM_ELEM_TAG);
|
||||
|
||||
|
|
Loading…
Reference in New Issue