Fix #115510: Poly Build does not update snapped geometry

Commit 91b27ab637 reveals the error.

The Poly Build code was using the wrong mesh to access the evaluated
coordinates.

It was accessing the original mesh, which wasn't affected by modifiers
or editing.

The most ideal meshes would be either the cage or even the deform, as
these better correspond to the geometry seen by the user.
This commit is contained in:
Germano Cavalcante 2023-12-26 10:37:57 -03:00
parent 57df35c8f9
commit 2824e45678
2 changed files with 6 additions and 3 deletions

@ -32,6 +32,7 @@
#include "BKE_layer.h"
#include "BKE_mesh.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "BKE_report.h"
#include "WM_api.hh"
@ -1082,8 +1083,8 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
const float(*coords)[3] = nullptr;
{
Mesh *me_eval = (Mesh *)DEG_get_evaluated_id(vc->depsgraph,
static_cast<ID *>(obedit->data));
Object *obedit_eval = DEG_get_evaluated_object(vc->depsgraph, obedit);
Mesh *me_eval = BKE_object_get_editmesh_eval_cage(obedit_eval);
if (BKE_mesh_wrapper_vert_len(me_eval) == bm->totvert) {
coords = BKE_mesh_wrapper_vert_coords(me_eval);
}

@ -23,6 +23,7 @@
#include "BKE_layer.h"
#include "BKE_mesh.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "BLI_math_matrix.h"
#include "BLI_math_vector.h"
@ -239,7 +240,8 @@ static int gizmo_preselect_elem_test_select(bContext *C, wmGizmo *gz, const int
{
Object *ob = gz_ele->bases[gz_ele->base_index]->object;
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Mesh *me_eval = (Mesh *)DEG_get_evaluated_id(depsgraph, static_cast<ID *>(ob->data));
Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
Mesh *me_eval = BKE_object_get_editmesh_eval_cage(ob_eval);
if (BKE_mesh_wrapper_vert_len(me_eval) == bm->totvert) {
coords = BKE_mesh_wrapper_vert_coords(me_eval);
}