diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 510ef6d3c97..4d98de1eb69 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -5677,6 +5677,8 @@ bool BKE_constraint_apply_for_object(Depsgraph *depsgraph, const float ctime = BKE_scene_frame_get(scene); + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + /* We need the evaluated constraint (e.g. shrinkwrap needs to access evaluated constraint target * mesh). */ Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); @@ -5686,9 +5688,9 @@ bool BKE_constraint_apply_for_object(Depsgraph *depsgraph, ListBase single_con = {new_con, new_con}; bConstraintOb *cob = BKE_constraints_make_evalob( - depsgraph, scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); + depsgraph, scene_eval, ob_eval, NULL, CONSTRAINT_OBTYPE_OBJECT); /* Undo the effect of the current constraint stack evaluation. */ - mul_m4_m4m4(cob->matrix, ob->constinv, cob->matrix); + mul_m4_m4m4(cob->matrix, ob_eval->constinv, cob->matrix); /* Evaluate single constraint. */ BKE_constraints_solve(depsgraph, &single_con, cob, ctime); @@ -5701,7 +5703,7 @@ bool BKE_constraint_apply_for_object(Depsgraph *depsgraph, BLI_freelinkN(&single_con, new_con); /* Apply transform from matrix. */ - BKE_object_apply_mat4(ob, ob->obmat, true, true); + BKE_object_apply_mat4(ob, ob_eval->obmat, true, true); return true; }