[Bf-blender-cvs] [4975aa410cf] master: Fix T81844: Change Bone Layers fails in Pose Mode

Sebastian Parborg noreply at git.blender.org
Tue Oct 27 15:14:09 CET 2020


Commit: 4975aa410cf0178fa19a29256659f91d7ea84ccb
Author: Sebastian Parborg
Date:   Tue Oct 27 15:10:44 2020 +0100
Branches: master
https://developer.blender.org/rB4975aa410cf0178fa19a29256659f91d7ea84ccb

Fix T81844: Change Bone Layers fails in Pose Mode

When selecting multiple layers, the redo operator might not correctly
update the pose data. To make sure it is in a good state we have to
ensure that the pose data is good.

Reviewed By: Bastien

Differential Revision: http://developer.blender.org/D9354

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

M	source/blender/editors/armature/pose_edit.c

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

diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index e8c35958115..8a1c2a4afa8 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -898,6 +898,20 @@ static int pose_bone_layers_exec(bContext *C, wmOperator *op)
 
   Object *prev_ob = NULL;
 
+  /* Make sure that the pose bone data is up to date.
+   * (May not always be the case after undo/redo e.g.).
+   */
+  struct Main *bmain = CTX_data_main(C);
+  wmWindow *win = CTX_wm_window(C);
+  View3D *v3d = CTX_wm_view3d(C); /* This may be NULL in a lot of cases. */
+  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+
+  FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob_iter) {
+    bArmature *arm = ob_iter->data;
+    BKE_pose_ensure(bmain, ob_iter, arm, true);
+  }
+  FOREACH_OBJECT_IN_MODE_END;
+
   /* set layers of pchans based on the values set in the operator props */
   CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) {
     /* get pointer for pchan, and write flags this way */



More information about the Bf-blender-cvs mailing list