Fix channel packed images display in the Image/Node editor
Channel packed images should not have their RGB affected by alpha. rendering in Cycles and Eevee was fine already, but displaying these was not right in the Image and Node editors. Not 100% sure what to do for the "Color and Alpha" mode, but I guess this should stay like it was before (applying the alpha). "Color", "R", "G", and "B" modes were changed to not have color be affected by alpha though. ref. T89034 Maniphest Tasks: T89034 Differential Revision: https://developer.blender.org/D11871
This commit is contained in:
parent
7b94e7cca4
commit
563fdaaa39
Notes:
blender-bot
2023-02-14 03:52:45 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93 Referenced by issue #89034, TGA Images with any alpha value smaller than one behaves unexpected
|
@ -31,6 +31,7 @@
|
|||
#include "DNA_camera_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
#include "ED_image.h"
|
||||
|
@ -222,19 +223,30 @@ static void image_cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser
|
|||
copy_v4_fl4(shuffle, 1.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else if ((sima_flag & SI_SHOW_R) != 0) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
draw_flags |= IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
copy_v4_fl4(shuffle, 1.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else if ((sima_flag & SI_SHOW_G) != 0) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
draw_flags |= IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
copy_v4_fl4(shuffle, 0.0f, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else if ((sima_flag & SI_SHOW_B) != 0) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
draw_flags |= IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
copy_v4_fl4(shuffle, 0.0f, 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
else /* RGB */ {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (space_type == SPACE_NODE) {
|
||||
|
@ -248,19 +260,30 @@ static void image_cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser
|
|||
copy_v4_fl4(shuffle, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else if ((snode->flag & SNODE_SHOW_R) != 0) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
draw_flags |= IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
copy_v4_fl4(shuffle, 1.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else if ((snode->flag & SNODE_SHOW_G) != 0) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
draw_flags |= IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
copy_v4_fl4(shuffle, 0.0f, 1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
else if ((snode->flag & SNODE_SHOW_B) != 0) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
draw_flags |= IMAGE_DRAW_FLAG_SHUFFLING;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
copy_v4_fl4(shuffle, 0.0f, 0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
else /* RGB */ {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
if (IMB_alpha_affects_rgb(ibuf)) {
|
||||
draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue