diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index e36d4bab566..f7fd7450734 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -73,7 +73,7 @@ int BKE_imtype_supports_zbuf(const char imtype); int BKE_imtype_supports_compress(const char imtype); int BKE_imtype_supports_quality(const char imtype); int BKE_imtype_requires_linear_float(const char imtype); -char BKE_imtype_valid_channels(const char imtype); +char BKE_imtype_valid_channels(const char imtype, bool write_file); char BKE_imtype_valid_depths(const char imtype); char BKE_imtype_from_arg(const char *arg); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 7d8ada0fa68..b74424a1d28 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1161,16 +1161,18 @@ int BKE_imtype_requires_linear_float(const char imtype) return 0; } -char BKE_imtype_valid_channels(const char imtype) +char BKE_imtype_valid_channels(const char imtype, bool write_file) { char chan_flag = IMA_CHAN_FLAG_RGB; /* assume all support rgb */ /* alpha */ switch (imtype) { + case R_IMF_IMTYPE_BMP: + if (write_file) break; + /* fall-through */ case R_IMF_IMTYPE_TARGA: case R_IMF_IMTYPE_IRIS: case R_IMF_IMTYPE_PNG: - /* case R_IMF_IMTYPE_BMP: */ /* read but not write */ case R_IMF_IMTYPE_RADHDR: case R_IMF_IMTYPE_TIFF: case R_IMF_IMTYPE_OPENEXR: diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 21f54a86df4..f88cdaf6713 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -753,7 +753,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char if (ibuf) { int imtype = BKE_ftype_to_imtype(ibuf->ftype); - char valid_channels = BKE_imtype_valid_channels(imtype); + char valid_channels = BKE_imtype_valid_channels(imtype, false); has_alpha = (valid_channels & IMA_CHAN_FLAG_ALPHA) != 0; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 90d14a7ba6f..0c70e332053 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -729,7 +729,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value) ID *id = ptr->id.data; const char is_render = (id && GS(id->name) == ID_SCE); /* see note below on why this is */ - const char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0); + const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0); imf->imtype = value; @@ -800,7 +800,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUS * where 'BW' will force grayscale even if the output format writes * as RGBA, this is age old blender convention and not sure how useful * it really is but keep it for now - campbell */ - char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0); + char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0); #ifdef WITH_FFMPEG /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support