diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-19 15:28:54 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-06-19 16:04:05 +0300 |
commit | 11c9702dd40f1461ee2d2c1136909a867d4f06f9 (patch) | |
tree | df2e3aa6f1e63539978df9961a0bb991df172879 /source/blender/blenkernel | |
parent | 54e6b262a14b23160fdecfec68f3e22dcf70bb3e (diff) |
Fix T65902: save all modified images should not try to save .psd files
We can't save these without data loss, so don't try to do this.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_image.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 00fd291d7cb..d6683509729 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -320,6 +320,8 @@ float *BKE_image_get_float_pixels_for_frame(struct Image *image, int frame); /* Image modifications */ bool BKE_image_is_dirty(struct Image *image); void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf); +bool BKE_image_buffer_format_writable(struct ImBuf *ibuf); +bool BKE_image_is_dirty_writable(struct Image *image, bool *is_format_writable); /* Guess offset for the first frame in the sequence */ int BKE_image_sequence_guess_offset(struct Image *image); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index f3ef48cafa8..b90cd9f15f8 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -5075,9 +5075,10 @@ bool BKE_image_is_animated(Image *image) } /* Image modifications */ -bool BKE_image_is_dirty(Image *image) +bool BKE_image_is_dirty_writable(Image *image, bool *r_is_writable) { bool is_dirty = false; + bool is_writable = false; BLI_spin_lock(&image_spin); if (image->cache != NULL) { @@ -5086,6 +5087,7 @@ bool BKE_image_is_dirty(Image *image) while (!IMB_moviecacheIter_done(iter)) { ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter); if (ibuf->userflags & IB_BITMAPDIRTY) { + is_writable = BKE_image_buffer_format_writable(ibuf); is_dirty = true; break; } @@ -5095,14 +5097,31 @@ bool BKE_image_is_dirty(Image *image) } BLI_spin_unlock(&image_spin); + if (r_is_writable) { + *r_is_writable = is_writable; + } + return is_dirty; } +bool BKE_image_is_dirty(Image *image) +{ + return BKE_image_is_dirty_writable(image, NULL); +} + void BKE_image_mark_dirty(Image *UNUSED(image), ImBuf *ibuf) { ibuf->userflags |= IB_BITMAPDIRTY; } +bool BKE_image_buffer_format_writable(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); +} + void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *options) { BLI_spin_lock(&image_spin); |