Fix polling function for background image removal not checking linked ID.

Linked ID is (almost) never editable... Also rename that function to add
the `_poll` suffix.
This commit is contained in:
Bastien Montagne 2022-05-30 16:22:06 +02:00
parent e7544e3ce4
commit fb62fcf071
3 changed files with 4 additions and 4 deletions

View File

@ -596,7 +596,7 @@ bool ED_operator_posemode_context(struct bContext *C);
bool ED_operator_posemode(struct bContext *C);
bool ED_operator_posemode_local(struct bContext *C);
bool ED_operator_mask(struct bContext *C);
bool ED_operator_camera(struct bContext *C);
bool ED_operator_camera_poll(struct bContext *C);
/* screen_user_menu.c */

View File

@ -685,10 +685,10 @@ bool ED_operator_mask(bContext *C)
return false;
}
bool ED_operator_camera(bContext *C)
bool ED_operator_camera_poll(bContext *C)
{
struct Camera *cam = CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
return (cam != NULL);
return (cam != NULL && !ID_IS_LINKED(cam));
}
/** \} */

View File

@ -653,7 +653,7 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = background_image_remove_exec;
ot->poll = ED_operator_camera;
ot->poll = ED_operator_camera_poll;
/* flags */
ot->flag = 0;