Fix #94781: Getting stuck in an edit mode when object is disabled in viewport #118370
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue