Fix #143780: Bounds overlay ignores edit mesh

For quite a while, for edit mode mesh object evaluation we haven't
put the evaluated edit mesh in the evaluated geometry set. I don't
think the reason for that applies anymore. The code is much simpler
if all the evaluated geometry is a consistent place, so just put it there,
the same way as non-edit-mode evaluation.

Pull Request: https://projects.blender.org/blender/blender/pulls/143896
This commit is contained in:
Hans Goudey
2025-08-04 16:04:04 +02:00
committed by Hans Goudey
parent 535842fb92
commit 5d1bea7ff5
2 changed files with 8 additions and 13 deletions

View File

@@ -44,15 +44,7 @@ GeometrySet object_get_evaluated_geometry_set(const Object &object, const bool a
if (!DEG_object_geometry_is_evaluated(object)) {
return {};
}
if (object.type == OB_MESH && object.mode == OB_MODE_EDIT) {
GeometrySet geometry_set;
if (object.runtime->geometry_set_eval != nullptr) {
/* `geometry_set_eval` only contains non-mesh components, see `editbmesh_build_data`. */
geometry_set = *object.runtime->geometry_set_eval;
}
add_final_mesh_as_geometry_component(object, geometry_set, apply_subdiv);
return geometry_set;
}
if (object.runtime->geometry_set_eval != nullptr) {
GeometrySet geometry_set = *object.runtime->geometry_set_eval;
/* Ensure that subdivision is performed on the CPU. */

View File

@@ -1038,14 +1038,19 @@ static void editbmesh_build_data(Depsgraph &depsgraph,
Mesh *mesh = static_cast<Mesh *>(obedit.data);
Mesh *me_cage;
Mesh *me_final;
GeometrySet *non_mesh_components;
GeometrySet *geometry_set_eval;
editbmesh_calc_modifiers(
depsgraph, scene, obedit, dataMask, &me_cage, &me_final, &non_mesh_components);
depsgraph, scene, obedit, dataMask, &me_cage, &me_final, &geometry_set_eval);
const bool is_mesh_eval_owned = (me_final != mesh->runtime->mesh_eval);
BKE_object_eval_assign_data(&obedit, &me_final->id, is_mesh_eval_owned);
/* Add the final mesh as a non-owning component to the geometry set. */
MeshComponent &mesh_component = geometry_set_eval->get_component_for_write<MeshComponent>();
mesh_component.replace(me_final, GeometryOwnershipType::Editable);
obedit.runtime->geometry_set_eval = geometry_set_eval;
/* Make sure that drivers can target shapekey properties.
* Note that this causes a potential inconsistency, as the shapekey may have a
* different topology than the evaluated mesh. */
@@ -1054,8 +1059,6 @@ static void editbmesh_build_data(Depsgraph &depsgraph,
obedit.runtime->editmesh_eval_cage = me_cage;
obedit.runtime->geometry_set_eval = non_mesh_components;
obedit.runtime->last_data_mask = dataMask;
}