diff options
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 187908573dd..cd2ed32cd4f 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -84,7 +84,6 @@ #include "BKE_packedFile.h" #include "BKE_report.h" #include "BKE_scene.h" -#include "BKE_sequencer.h" /* seq_foreground_frame_get() */ #include "BKE_workspace.h" #include "BLF_api.h" @@ -93,6 +92,8 @@ #include "RE_pipeline.h" +#include "SEQ_sequencer.h" /* seq_foreground_frame_get() */ + #include "GPU_texture.h" #include "BLI_sys_types.h" /* for intptr_t support */ @@ -324,6 +325,8 @@ IDTypeInfo IDType_ID_IM = { .blend_read_data = image_blend_read_data, .blend_read_lib = image_blend_read_lib, .blend_read_expand = NULL, + + .blend_read_undo_preserve = NULL, }; /* prototypes */ @@ -665,7 +668,7 @@ ImageTile *BKE_image_get_tile(Image *ima, int tile_number) /* Tile number 0 is a special case and refers to the first tile, typically * coming from non-UDIM-aware code. */ - if (tile_number == 0 || tile_number == 1001) { + if (ELEM(tile_number, 0, 1001)) { return ima->tiles.first; } @@ -802,7 +805,7 @@ Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exist /* first search an identical filepath */ for (ima = bmain->images.first; ima; ima = ima->id.next) { - if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) { + if (!ELEM(ima->source, IMA_SRC_VIEWER, IMA_SRC_GENERATED)) { STRNCPY(strtest, ima->filepath); BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &ima->id)); @@ -1313,7 +1316,7 @@ int BKE_image_imtype_to_ftype(const char imtype, ImbFormatOptions *r_options) return IMB_FTYPE_TIF; } #endif - if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) { + if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) { return IMB_FTYPE_OPENEXR; } #ifdef WITH_CINEON @@ -1338,7 +1341,7 @@ int BKE_image_imtype_to_ftype(const char imtype, ImbFormatOptions *r_options) char BKE_image_ftype_to_imtype(const int ftype, const ImbFormatOptions *options) { - if (ftype == 0) { + if (ftype == IMB_FTYPE_NONE) { return R_IMF_IMTYPE_TARGA; } if (ftype == IMB_FTYPE_IMAGIC) { @@ -1663,7 +1666,7 @@ static bool do_add_image_extension(char *string, } #endif #ifdef WITH_OPENEXR - else if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) { + else if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) { if (!BLI_path_extension_check(string, extension_test = ".exr")) { extension = extension_test; } @@ -2950,13 +2953,11 @@ void BKE_imbuf_write_prepare(ImBuf *ibuf, const ImageFormatData *imf) int BKE_imbuf_write(ImBuf *ibuf, const char *name, const ImageFormatData *imf) { - int ok; - BKE_imbuf_write_prepare(ibuf, imf); BLI_make_existing_file(name); - ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat); + const bool ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat); if (ok == 0) { perror(name); } |