Fix T49815: Blender always reverts to RGBA when using Save As Image.

`BKE_imformat_defaults()` was doing some weird black magic based on
imbuf's channels, instead of merely copying imbuf's planes here...
This commit is contained in:
Bastien Montagne 2016-10-25 17:59:45 +02:00
parent cf9a6b416c
commit a39ab9cfde
Notes: blender-bot 2023-02-14 07:29:14 +01:00
Referenced by issue #49815, Blender always reverts to RGBA when using Save As Image
1 changed files with 1 additions and 18 deletions

View File

@ -1580,24 +1580,7 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
}
/* planes */
/* TODO(sergey): Channels doesn't correspond actual planes used for image buffer
* For example byte buffer will have 4 channels but it might easily
* be BW or RGB image.
*
* Need to use im_format->planes = imbuf->planes instead?
*/
switch (imbuf->channels) {
case 0:
case 4: im_format->planes = R_IMF_PLANES_RGBA;
break;
case 3: im_format->planes = R_IMF_PLANES_RGB;
break;
case 1: im_format->planes = R_IMF_PLANES_BW;
break;
default: im_format->planes = R_IMF_PLANES_RGB;
break;
}
im_format->planes = imbuf->planes;
}