[Bf-blender-cvs] [f45127c6cb3] blender-v2.81-release: Fix T70740: Clicking on proxy bone makes original one jump to initial location

Sergey Sharybin noreply at git.blender.org
Thu Oct 17 12:01:31 CEST 2019


Commit: f45127c6cb34f1f44c7b34862127d8986bf72fe8
Author: Sergey Sharybin
Date:   Fri Oct 11 16:31:56 2019 +0200
Branches: blender-v2.81-release
https://developer.blender.org/rBf45127c6cb34f1f44c7b34862127d8986bf72fe8

Fix T70740: Clicking on proxy bone makes original one jump to initial location

Caused by what appears to be a missing flush from evaluated bone back to
original, which then makes it so copy-on-write operation happening after
click (to synchronize selection flags) pushes original bone to its initial
position.

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

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

M	source/blender/blenkernel/intern/armature_update.c

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

diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index b6a2efb37b8..7c68c8319a5 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -728,6 +728,21 @@ void BKE_pose_constraints_evaluate(struct Depsgraph *depsgraph,
   }
 }
 
+static void pose_channel_flush_to_orig_if_needed(struct Depsgraph *depsgraph,
+                                                 struct Object *object,
+                                                 bPoseChannel *pchan)
+{
+  if (!DEG_is_active(depsgraph)) {
+    return;
+  }
+  const bArmature *armature = (bArmature *)object->data;
+  if (armature->edbo != NULL) {
+    return;
+  }
+  bPoseChannel *pchan_orig = pchan->orig_pchan;
+  BKE_pose_copy_pchan_result(pchan_orig, pchan);
+}
+
 void BKE_pose_bone_done(struct Depsgraph *depsgraph, struct Object *object, int pchan_index)
 {
   const bArmature *armature = (bArmature *)object->data;
@@ -745,13 +760,9 @@ void BKE_pose_bone_done(struct Depsgraph *depsgraph, struct Object *object, int
       mat4_to_dquat(&pchan->runtime.deform_dual_quat, pchan->bone->arm_mat, pchan->chan_mat);
     }
   }
-  if (DEG_is_active(depsgraph) && armature->edbo == NULL) {
+  pose_channel_flush_to_orig_if_needed(depsgraph, object, pchan);
+  if (DEG_is_active(depsgraph)) {
     bPoseChannel *pchan_orig = pchan->orig_pchan;
-    copy_m4_m4(pchan_orig->pose_mat, pchan->pose_mat);
-    copy_m4_m4(pchan_orig->chan_mat, pchan->chan_mat);
-    copy_v3_v3(pchan_orig->pose_head, pchan->pose_mat[3]);
-    copy_m4_m4(pchan_orig->constinv, pchan->constinv);
-    BKE_pose_where_is_bone_tail(pchan_orig);
     if (pchan->bone == NULL || pchan->bone->segments <= 1) {
       BKE_pose_channel_free_bbone_cache(&pchan_orig->runtime);
     }
@@ -912,4 +923,6 @@ void BKE_pose_eval_proxy_copy_bone(struct Depsgraph *depsgraph, Object *object,
   BKE_pose_copy_pchan_result(pchan, pchan_from);
   copy_dq_dq(&pchan->runtime.deform_dual_quat, &pchan_from->runtime.deform_dual_quat);
   BKE_pchan_bbone_segments_cache_copy(pchan, pchan_from);
+
+  pose_channel_flush_to_orig_if_needed(depsgraph, object, pchan);
 }



More information about the Bf-blender-cvs mailing list