Fix #146183: Assert in Mesh->Transform->Randomize

Enabling the normal parameter in the randomize operator triggered a
debug assert, since BKE_object_get_editmesh_eval_cage() was called on
the original object.

Resolved by retrieving the evaluated object from the depsgraph.

Ref !146608
This commit is contained in:
tariqsulley
2025-10-04 23:32:02 +00:00
committed by Campbell Barton
parent ad131310e3
commit 5282a2f033
2 changed files with 6 additions and 1 deletions

View File

@@ -18,6 +18,8 @@
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "DEG_depsgraph_query.hh"
#include "WM_api.hh"
#include "WM_types.hh"
@@ -86,6 +88,7 @@ static wmOperatorStatus object_rand_verts_exec(bContext *C, wmOperator *op)
const uint seed = RNA_int_get(op->ptr, "seed");
bool changed_multi = false;
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Vector<Object *> objects = BKE_view_layer_array_from_objects_in_mode_unique_data(
scene, view_layer, CTX_wm_view3d(C), eObjectMode(ob_mode));
for (const int ob_index : objects.index_range()) {
@@ -104,7 +107,8 @@ static wmOperatorStatus object_rand_verts_exec(bContext *C, wmOperator *op)
continue;
}
ED_transverts_create_from_obedit(&tvs, ob_iter, mode);
const Object *ob_iter_eval = DEG_get_evaluated(depsgraph, ob_iter);
ED_transverts_create_from_obedit(&tvs, ob_iter_eval, mode);
if (tvs.transverts_tot == 0) {
continue;
}

View File

@@ -218,6 +218,7 @@ bool ED_transverts_check_obedit(const Object *obedit)
void ED_transverts_create_from_obedit(TransVertStore *tvs, const Object *obedit, const int mode)
{
using namespace blender;
BLI_assert(DEG_is_evaluated(obedit));
Nurb *nu;
BezTriple *bezt;