[Bf-blender-cvs] [f92bb695c40] master: Fix T64478: Wrong location Snap Selection to Cursor after set camera Follow the path.

mano-wii noreply at git.blender.org
Tue Jun 11 23:13:25 CEST 2019


Commit: f92bb695c4082351b52a4b8ccb5d021cd6a88263
Author: mano-wii
Date:   Tue Jun 11 18:12:14 2019 -0300
Branches: master
https://developer.blender.org/rBf92bb695c4082351b52a4b8ccb5d021cd6a88263

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`.

===================================================================

M	source/blender/editors/space_view3d/view3d_snap.c

===================================================================

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) {



More information about the Bf-blender-cvs mailing list