[Bf-blender-cvs] [26d4a2a5169] master: Fix T55494: Apply transforms on parents and children Fix T63790: Crash when applying Scale of Object with vertex parent

Sergey Sharybin noreply at git.blender.org
Fri May 31 10:36:07 CEST 2019


Commit: 26d4a2a5169472369829905a960786390bc09c0e
Author: Sergey Sharybin
Date:   Wed May 29 15:33:45 2019 +0200
Branches: master
https://developer.blender.org/rB26d4a2a5169472369829905a960786390bc09c0e

Fix T55494: Apply transforms on parents and children
Fix T63790: Crash when applying Scale of Object with vertex parent

Made apply transform to fully live in the evaluated domain.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D4976

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

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

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

diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 00f5dffb3cc..263cd5bbda0 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -47,6 +47,7 @@
 #include "BKE_mball.h"
 #include "BKE_mesh.h"
 #include "BKE_object.h"
+#include "BKE_scene.h"
 #include "BKE_report.h"
 #include "BKE_editmesh.h"
 #include "BKE_multires.h"
@@ -56,6 +57,7 @@
 #include "BKE_gpencil.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
@@ -467,9 +469,12 @@ static void ignore_parent_tx(const bContext *C, Main *bmain, Scene *scene, Objec
   /* a change was made, adjust the children to compensate */
   for (ob_child = bmain->objects.first; ob_child; ob_child = ob_child->id.next) {
     if (ob_child->parent == ob) {
-      BKE_object_apply_mat4(ob_child, ob_child->obmat, true, false);
-      BKE_object_workob_calc_parent(depsgraph, scene, ob_child, &workob);
+      Object *ob_child_eval = DEG_get_evaluated_object(depsgraph, ob_child);
+      BKE_object_apply_mat4(ob_child_eval, ob_child_eval->obmat, true, false);
+      BKE_object_workob_calc_parent(depsgraph, scene, ob_child_eval, &workob);
       invert_m4_m4(ob_child->parentinv, workob.obmat);
+      /* Copy result of BKE_object_apply_mat4(). */
+      BKE_object_transform_copy(ob_child, ob_child_eval);
     }
   }
 }
@@ -779,9 +784,13 @@ static int apply_objects_internal(bContext *C,
       unit_axis_angle(ob->rotAxis, &ob->rotAngle);
     }
 
-    BKE_object_where_is_calc(depsgraph, 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);
     if (ob->type == OB_ARMATURE) {
-      BKE_pose_where_is(depsgraph, scene, ob); /* needed for bone parents */
+      /* needed for bone parents */
+      BKE_pose_where_is(depsgraph, scene, ob_eval);
     }
 
     ignore_parent_tx(C, bmain, scene, ob);



More information about the Bf-blender-cvs mailing list