Fix #94781: Getting stuck in an edit mode when object is disabled in viewport #118370

Closed
Christoph Lendenfeld wants to merge 4 commits from ChrisLend/blender:fix_stuck_in_pose_mode into blender-v4.1-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 14 additions and 2 deletions

View File

@ -1766,9 +1766,21 @@ static const EnumPropertyItem *object_mode_set_itemf(bContext *C,
static bool object_mode_set_poll(bContext *C)
{
/* Needed as #ED_operator_object_active_editable doesn't call use 'active_object'. */
/* Not using #ED_operator_object_active_editable as that hinders you from leaving an edit mode
* when the object is disabled in viewport. See #9478 */
Object *ob = CTX_data_active_object(C);
return ED_operator_object_active_editable_ex(C, ob);
if (ob == nullptr) {
CTX_wm_operator_poll_msg_set(C, "Context missing active object");
return false;
}
if (!BKE_id_is_editable(CTX_data_main(C), (ID *)ob)) {
CTX_wm_operator_poll_msg_set(C, "Cannot edit library linked or non-editable override object");
return false;
}
return true;
}
static int object_mode_set_exec(bContext *C, wmOperator *op)