[Bf-blender-cvs] [70b7dc9] master: Fix T45823: PSD files save as JPG without warning
Campbell Barton
noreply at git.blender.org
Mon Aug 24 13:40:35 CEST 2015
Commit: 70b7dc993e6ef92396c7a871a8f5feb2b2373326
Author: Campbell Barton
Date: Mon Aug 24 21:31:41 2015 +1000
Branches: master
https://developer.blender.org/rB70b7dc993e6ef92396c7a871a8f5feb2b2373326
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.
===================================================================
M source/blender/editors/space_image/image_ops.c
===================================================================
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index db0fc2d..3c5aff4 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;
}
More information about the Bf-blender-cvs
mailing list