Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-08-24 14:31:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-08-24 14:34:49 +0300
commit70b7dc993e6ef92396c7a871a8f5feb2b2373326 (patch)
tree6001303cb5c2addbb1e1367b1626f9e1dee45440 /source/blender/editors/space_image/image_ops.c
parentaac6ee6b870eb968d37c16039e6cdc579df17288 (diff)
Fix T45823: PSD files save as JPG without warning
Don't allow image save (which overwrites without asking), unless the input format can be written to.
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r--source/blender/editors/space_image/image_ops.c11
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;
}