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
This commit is contained in:
parent
77a6b6fb1a
commit
4975aa410c
Notes:
blender-bot
2023-02-14 10:18:56 +01:00
Referenced by issue #81844, Change Bone Layers fails in Pose Mode
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue