diff options
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index db0fc2d34b6..3c5aff4d698 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -176,6 +176,14 @@ static int image_not_packed_poll(bContext *C) return false; } +static bool imbuf_format_writeable(const ImBuf *ibuf) +{ + ImageFormatData im_format; + ImbFormatOptions options_dummy; + BKE_imbuf_to_image_format(&im_format, ibuf); + return (BKE_image_imtype_to_ftype(im_format.imtype, &options_dummy) == ibuf->ftype); +} + static int space_image_file_exists_poll(bContext *C) { if (space_image_buffer_exists_poll(C)) { @@ -197,6 +205,9 @@ static int space_image_file_exists_poll(bContext *C) else if (!BLI_file_is_writable(name)) { CTX_wm_operator_poll_msg_set(C, "image path can't be written to"); } + else if (!imbuf_format_writeable(ibuf)) { + CTX_wm_operator_poll_msg_set(C, "image format is read-only"); + } else { ret = true; } |