Fix #135520: Mesh edit mode "Frame Selected" crash in some cases

Caused by 839108f623.
Now, when there is no mapping available between the evaluated
mesh and the original, the evaluated mesh won't have the edit mesh
pointer set. Since this code really just cares about the original BMesh,
just retrieve it with the original object. This function expects an
evaluated object since `BKE_object_get_editmesh_eval_cage`
asserts for that laer on.
This commit is contained in:
Hans Goudey
2025-03-05 14:16:11 -05:00
parent de3b5e691e
commit 23a97dd965

View File

@@ -6,6 +6,7 @@
* \ingroup edutil
*/
#include "DNA_mesh_types.h"
#include "MEM_guardedalloc.h"
#include "DNA_armature_types.h"
@@ -24,9 +25,11 @@
#include "BKE_editmesh.hh"
#include "BKE_lattice.hh"
#include "BKE_mesh_iterators.hh"
#include "BKE_mesh_types.hh"
#include "BKE_object.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "ED_armature.hh"
#include "ED_curves.hh"
@@ -215,7 +218,9 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, const Object *obedit,
tvs->transverts_tot = 0;
if (obedit->type == OB_MESH) {
BMEditMesh *em = BKE_editmesh_from_object((Object *)obedit);
const Object *object_orig = DEG_get_original_object(const_cast<Object *>(obedit));
const Mesh &mesh = *static_cast<Mesh *>(object_orig->data);
BMEditMesh *em = mesh.runtime->edit_mesh.get();
BMesh *bm = em->bm;
BMIter iter;
void *userdata[2] = {em, nullptr};