[Bf-blender-cvs] [453586be06a] master: Fix T67849: Offset after "Hook to Selected Object"

Philipp Oeser noreply at git.blender.org
Mon Jul 29 16:39:49 CEST 2019


Commit: 453586be06a129eec7498fe7ecac9f7c555e34e6
Author: Philipp Oeser
Date:   Tue Jul 30 00:35:49 2019 +1000
Branches: master
https://developer.blender.org/rB453586be06a129eec7498fe7ecac9f7c555e34e6

Fix T67849: Offset after "Hook to Selected Object"

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

M	source/blender/editors/object/object_hook.c

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

diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index c939cb0a61d..707489d588a 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -52,6 +52,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
@@ -527,6 +528,7 @@ static int add_hook_object(const bContext *C,
                            int mode,
                            ReportList *reports)
 {
+  Depsgraph *depsgraph = CTX_data_depsgraph(C);
   ModifierData *md = NULL;
   HookModifierData *hmd = NULL;
   float cent[3];
@@ -601,11 +603,13 @@ static int add_hook_object(const bContext *C,
   /* matrix calculus */
   /* vert x (obmat x hook->imat) x hook->obmat x ob->imat */
   /*        (parentinv         )                          */
-  BKE_object_where_is_calc(CTX_data_depsgraph(C), scene, ob);
+  Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+  BKE_object_transform_copy(ob_eval, ob);
+  BKE_object_where_is_calc(depsgraph, scene, ob_eval);
 
-  invert_m4_m4(ob->imat, ob->obmat);
+  invert_m4_m4(ob_eval->imat, ob_eval->obmat);
   /* apparently this call goes from right to left... */
-  mul_m4_series(hmd->parentinv, pose_mat, ob->imat, obedit->obmat);
+  mul_m4_series(hmd->parentinv, pose_mat, ob_eval->imat, obedit->obmat);
 
   DEG_relations_tag_update(bmain);



More information about the Bf-blender-cvs mailing list