From 18f06186778ea67583a362a611b1efa8c9da5fbd Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 1 Dec 2018 19:43:10 +0300 Subject: Fix T58412: in weight paint + pose mode certain armature operations crash. The cause is that FOREACH_OBJECT_IN_MODE_BEGIN assumed that the active object is in the correct mode, which is wrong in this case. It also only considered objects of the same type as active, which had to be replaced with an explicit type parameter. --- source/blender/editors/armature/pose_transform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/armature/pose_transform.c') diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 7945c85e6d7..0f21f154f48 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -235,7 +235,7 @@ static int pose_visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) View3D *v3d = CTX_wm_view3d(C); Depsgraph *depsgraph = CTX_data_depsgraph(C); - FOREACH_OBJECT_IN_MODE_BEGIN(view_layer, v3d, OB_MODE_POSE, ob) + FOREACH_OBJECT_IN_MODE_BEGIN(view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob) { /* loop over all selected pchans * @@ -781,7 +781,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op, /* only clear relevant transforms for selected bones */ ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); - FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_MODE_POSE, ob_iter) + FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob_iter) { Object *ob_eval = DEG_get_evaluated_object(CTX_data_depsgraph(C), ob_iter); // XXX: UGLY HACK (for autokey + clear transforms) ListBase dsources = {NULL, NULL}; @@ -942,7 +942,7 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op) float cframe = (float)CFRA; const bool only_select = RNA_boolean_get(op->ptr, "only_selected"); - FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_MODE_POSE, ob) + FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, OB_ARMATURE, OB_MODE_POSE, ob) { if ((ob->adt) && (ob->adt->action)) { /* XXX: this is just like this to avoid contaminating anything else; -- cgit v1.2.3