Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2022-04-28 14:51:14 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2022-05-03 10:46:18 +0300
commitcc0c4c17f011f7f687f7719aab1568c9a5a38217 (patch)
treeb3d49c86a0a32c4b4780eb2c15780a71e62083e6 /source/blender/editors/mesh
parent1a6d0ec71cf3b0c2c22bc1b125135b1e9679c390 (diff)
Fix T95752: crash 'Select Linked' after loopcut in multiobject editmode
This was reported explicitly for originally being in face selectmode, but could also crash when in vertex selectmode (when doing multiple cuts). The reason here is that `MESH_OT_loopcut` switches to edge select mode (needed for `TRANSFORM_OT_edge_slide`, done in `ringsel_finish`), but was only doing this on the active object's editmesh, all other participating meshes would keep their selectmode which would now be out of sync with both the active object's editmesh and scene settings for these. This causes problems later in 'Select Linked'. Here, a mixture of objects are used. First the viewcontext is set up with the active object, then all participating objects are iterated (changing the viewcontext to another object), then `unified_findnearest` would use that changed viewcontext which would now contain the last object iterated. To repeat: this could now have a different selectmode than the active object which is later **again** used to get the nearest `BMElem` from in `EDBM_elem_from_selectmode`. So in the failing case, we could get an edge (but no face because of edge selectmode) from `unified_findnearest`, `EDBM_elem_from_selectmode` would return NULL though (edge provided, but in face selectmode), leading to the crash. To solve this I assume it is best to change selectmode on all participating meshes in multi-object editmode loopcut if necessary so these are always in sync for following operations. Alternatively, `Select Linked` (and probably lots more operators) would have to be tweaked to pay closer attention which object is really used to get selectmode from. Note the selectmode is actually set back from edge selectmode in certain cases (see `USE_LOOPSLIDE_HACK`), this patch changes that as well to act on all participating meshes. Maniphest Tasks: T95752 Differential Revision: https://developer.blender.org/D14791
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index c9fc48c3568..5a4b12c2209 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -208,12 +208,15 @@ static void ringsel_finish(bContext *C, wmOperator *op)
EDBM_selectmode_flush_ex(lcd->em, SCE_SELECT_VERTEX);
}
- /* we can't slide multiple edges in vertex select mode */
+ /* We can't slide multiple edges in vertex select mode, force edge select mode. Do this for
+ * all meshes in multi-object editmode so their selectmode is in sync for following
+ * operators. */
else if (is_macro && (cuts > 1) && (em->selectmode & SCE_SELECT_VERTEX)) {
- EDBM_selectmode_disable(lcd->vc.scene, em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);
+ EDBM_selectmode_disable_multi(C, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);
}
- /* Force edge slide to edge select mode in face select mode. */
- else if (EDBM_selectmode_disable(lcd->vc.scene, em, SCE_SELECT_FACE, SCE_SELECT_EDGE)) {
+ /* Force edge slide to edge select mode in face select mode. Do this for all meshes in
+ * multi-object editmode so their selectmode is in sync for following operators. */
+ else if (EDBM_selectmode_disable_multi(C, SCE_SELECT_FACE, SCE_SELECT_EDGE)) {
/* pass, the change will flush selection */
}
else {