Page MenuHome

Added alpha mode selector to image user nodes.
ClosedPublic

Authored by Ethan Hall (Ethan1080) on Feb 19 2022, 2:13 AM.

Details

Summary

This patch enables image user nodes to display the alpha mode selector.

This patch does not change the Image Texture Geometry Node.

I removed the function image_has_alpha in favor of using BKE_image_has_alpha. I removed this function for two reasons. First, image_buttons.c does not seem like the proper place to define this kind of function. Second, image_has_alpha did not check if the image actually had an alpha channel. The function just checked if the image type was capable of supporting an alpha channel.

Diff Detail

Repository
rB Blender

Event Timeline

Ethan Hall (Ethan1080) requested review of this revision.Feb 19 2022, 2:13 AM
Ethan Hall (Ethan1080) created this revision.
Ethan Hall (Ethan1080) edited the summary of this revision. (Show Details)Feb 19 2022, 2:18 AM
Brecht Van Lommel (brecht) requested changes to this revision.Feb 25 2022, 1:11 PM
Brecht Van Lommel (brecht) added inline comments.
source/blender/editors/space_node/drawnode.cc
352

BKE_image_has_alpha requires loading the full image into memory, which is not something we want to when displaying shader nodes which might potentially contain many high res images.

So I think practically, the button would have to be shown always.

This revision now requires changes to proceed.Feb 25 2022, 1:11 PM
source/blender/editors/space_node/drawnode.cc
352

I think you are right, and beyond the performance reasons, always showing the Alpha Selector is consistent with always showing the Alpha Socket.

  • Removed the BKE_image_has_alpha check when the Alpha Selector is displayed on nodes.
Ethan Hall (Ethan1080) marked an inline comment as done.Feb 25 2022, 4:28 PM
Ethan Hall (Ethan1080) edited the summary of this revision. (Show Details)Feb 25 2022, 4:36 PM
This revision is now accepted and ready to land.Mar 7 2022, 5:41 PM