From f92bb695c4082351b52a4b8ccb5d021cd6a88263 Mon Sep 17 00:00:00 2001 From: mano-wii Date: Tue, 11 Jun 2019 18:12:14 -0300 Subject: Fix T64478: Wrong location Snap Selection to Cursor after set camera Follow the path. In this case it is necessary to use the `object->parent` evaluated to obtain the correct `parentmat`. --- source/blender/editors/space_view3d/view3d_snap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index fb121aa716b..8b1d2028107 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -428,10 +428,13 @@ static int snap_selected_to_location(bContext *C, sub_v3_v3(cursor_parent, ob->obmat[3]); if (ob->parent) { - float originmat[3][3]; - BKE_object_where_is_calc_ex(depsgraph, scene, NULL, ob, originmat); - - invert_m3_m3(imat, originmat); + float parentmat[4][4]; + /* The evaluated object is used here because sometimes + * `runtime.curve_cache` is required. */ + Object *ob_parent_eval = DEG_get_evaluated_object(depsgraph, ob->parent); + BKE_object_get_parent_matrix(ob, ob_parent_eval, parentmat); + mul_m3_m4m4(imat, parentmat, ob->parentinv); + invert_m3(imat); mul_m3_v3(imat, cursor_parent); } if ((ob->protectflag & OB_LOCK_LOCX) == 0) { -- cgit v1.2.3