[Bf-blender-cvs] [563fdaaa397] blender-v2.93-release: Fix channel packed images display in the Image/Node editor
Philipp Oeser
noreply at git.blender.org
Mon Jul 26 08:52:29 CEST 2021
Commit: 563fdaaa397bbe5e3fdc66cb72db15af16e0fb1a
Author: Philipp Oeser
Date: Fri Jul 9 16:51:46 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB563fdaaa397bbe5e3fdc66cb72db15af16e0fb1a
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
===================================================================
M source/blender/draw/engines/image/image_engine.c
===================================================================
diff --git a/source/blender/draw/engines/image/image_engine.c b/source/blender/draw/engines/image/image_engine.c
index d75f887ce2b..3313494adcc 100644
--- a/source/blender/draw/engines/image/image_engine.c
+++ b/source/blender/draw/engines/image/image_engine.c
@@ -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;
+ }
}
}
More information about the Bf-blender-cvs
mailing list