Fix #89289: crash transforming after altering loops/faces count in script
Transform operators for mesh do partial updates and don't reallocate the looptris arrays that may be incorrectly sized. Therefore, we must check the array size before performing updates.
This commit is contained in:
@@ -1714,6 +1714,15 @@ static void createTransEditVerts(bContext * /*C*/, TransInfo *t)
|
||||
if (dists_index) {
|
||||
MEM_freeN(dists_index);
|
||||
}
|
||||
|
||||
/* WORKAROUND: The transform operators rely on looptris being up-to-date.
|
||||
* However, this is not always the case, especially when called from scripts.
|
||||
* If this happens, to prevent update issues, make sure the size of #BMEditMesh::looptris
|
||||
* arrays aligns with the number lootris to update. */
|
||||
const bool looptri_is_dirty = em->tottri != poly_to_tri_count(bm->totface, bm->totloop);
|
||||
if (looptri_is_dirty) {
|
||||
BKE_editmesh_looptris_calc(em);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user