forked from bartvdbraak/blender
Fix bug in image texture UI: "Use Alpha" checkbox doesn't appear if file format is BMP.
This commit is contained in:
parent
2fc7d04804
commit
6316306cc0
@ -73,7 +73,7 @@ int BKE_imtype_supports_zbuf(const char imtype);
|
|||||||
int BKE_imtype_supports_compress(const char imtype);
|
int BKE_imtype_supports_compress(const char imtype);
|
||||||
int BKE_imtype_supports_quality(const char imtype);
|
int BKE_imtype_supports_quality(const char imtype);
|
||||||
int BKE_imtype_requires_linear_float(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_valid_depths(const char imtype);
|
||||||
|
|
||||||
char BKE_imtype_from_arg(const char *arg);
|
char BKE_imtype_from_arg(const char *arg);
|
||||||
|
@ -1161,16 +1161,18 @@ int BKE_imtype_requires_linear_float(const char imtype)
|
|||||||
return 0;
|
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 */
|
char chan_flag = IMA_CHAN_FLAG_RGB; /* assume all support rgb */
|
||||||
|
|
||||||
/* alpha */
|
/* alpha */
|
||||||
switch (imtype) {
|
switch (imtype) {
|
||||||
|
case R_IMF_IMTYPE_BMP:
|
||||||
|
if (write_file) break;
|
||||||
|
/* fall-through */
|
||||||
case R_IMF_IMTYPE_TARGA:
|
case R_IMF_IMTYPE_TARGA:
|
||||||
case R_IMF_IMTYPE_IRIS:
|
case R_IMF_IMTYPE_IRIS:
|
||||||
case R_IMF_IMTYPE_PNG:
|
case R_IMF_IMTYPE_PNG:
|
||||||
/* case R_IMF_IMTYPE_BMP: */ /* read but not write */
|
|
||||||
case R_IMF_IMTYPE_RADHDR:
|
case R_IMF_IMTYPE_RADHDR:
|
||||||
case R_IMF_IMTYPE_TIFF:
|
case R_IMF_IMTYPE_TIFF:
|
||||||
case R_IMF_IMTYPE_OPENEXR:
|
case R_IMF_IMTYPE_OPENEXR:
|
||||||
|
@ -753,7 +753,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
|
|||||||
|
|
||||||
if (ibuf) {
|
if (ibuf) {
|
||||||
int imtype = BKE_ftype_to_imtype(ibuf->ftype);
|
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;
|
has_alpha = (valid_channels & IMA_CHAN_FLAG_ALPHA) != 0;
|
||||||
|
|
||||||
|
@ -729,7 +729,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
|
|||||||
ID *id = ptr->id.data;
|
ID *id = ptr->id.data;
|
||||||
const char is_render = (id && GS(id->name) == ID_SCE);
|
const char is_render = (id && GS(id->name) == ID_SCE);
|
||||||
/* see note below on why this is */
|
/* 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;
|
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
|
* where 'BW' will force grayscale even if the output format writes
|
||||||
* as RGBA, this is age old blender convention and not sure how useful
|
* as RGBA, this is age old blender convention and not sure how useful
|
||||||
* it really is but keep it for now - campbell */
|
* 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
|
#ifdef WITH_FFMPEG
|
||||||
/* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
|
/* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
|
||||||
|
Loading…
Reference in New Issue
Block a user