diff options
author | mano-wii <germano.costa@ig.com.br> | 2019-06-12 00:12:14 +0300 |
---|---|---|
committer | mano-wii <germano.costa@ig.com.br> | 2019-06-12 00:12:54 +0300 |
commit | f92bb695c4082351b52a4b8ccb5d021cd6a88263 (patch) | |
tree | 802e3a6887e577b2ff145565ab3c469f017cd764 /source/blender/editors/space_view3d/view3d_snap.c | |
parent | 23df1a774b5b70e5108e2d1b1901d2a204ca1d9e (diff) |
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`.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_snap.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 11 |
1 files changed, 7 insertions, 4 deletions
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) { |