diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2020-10-27 17:10:44 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2020-10-27 17:10:44 +0300 |
commit | 4975aa410cf0178fa19a29256659f91d7ea84ccb (patch) | |
tree | 146ca443190b97ab0dd17659176529e9844070ed /source/blender/editors/armature/pose_edit.c | |
parent | 77a6b6fb1ac0a1973398790a245a013a9e1a684b (diff) |
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
Diffstat (limited to 'source/blender/editors/armature/pose_edit.c')
-rw-r--r-- | source/blender/editors/armature/pose_edit.c | 14 |
1 files changed, 14 insertions, 0 deletions
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 */ |