Alpha display changes:
Previous alpha-overing on black for RGB display wasn't so much useful for artists, changed in a way: - Made RGBA display default for node editor backdrop and image editor, so it'll be clear that image does have alpha channel - RGB display will ignore alpha channel completely Reshuffled buttons for RGBA/RGB so now the order is following: RGBA | RGB | Alpha | Z Still to come: startup.blend shall be altered to make RGBA default.
This commit is contained in:
@@ -514,16 +514,12 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
|
||||
unsigned char *display_buffer;
|
||||
void *cache_handle;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (sima->flag & SI_USE_ALPHA) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
fdrawcheckerboard(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
|
||||
}
|
||||
else {
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glRecti(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
|
||||
}
|
||||
|
||||
display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
|
||||
|
||||
@@ -536,7 +532,8 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
|
||||
|
||||
IMB_display_buffer_release(cache_handle);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
if (sima->flag & SI_USE_ALPHA)
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
/* reset zoom */
|
||||
|
@@ -152,7 +152,7 @@ static SpaceLink *image_new(const bContext *UNUSED(C))
|
||||
simage->spacetype = SPACE_IMAGE;
|
||||
simage->zoom = 1.0f;
|
||||
simage->lock = TRUE;
|
||||
simage->flag = SI_SHOW_GPENCIL;
|
||||
simage->flag = SI_SHOW_GPENCIL | SI_USE_ALPHA;
|
||||
|
||||
simage->iuser.ok = TRUE;
|
||||
simage->iuser.fie_ima = 2;
|
||||
|
@@ -3283,17 +3283,9 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
|
||||
else {
|
||||
glPixelZoom(snode->zoom, snode->zoom);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
glRecti(x, y, x + ibuf->x * snode->zoom, y + ibuf->y * snode->zoom);
|
||||
|
||||
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer);
|
||||
|
||||
glPixelZoom(1.0f, 1.0f);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -119,7 +119,7 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
|
||||
snode = MEM_callocN(sizeof(SpaceNode), "initnode");
|
||||
snode->spacetype = SPACE_NODE;
|
||||
|
||||
snode->flag = SNODE_SHOW_GPENCIL;
|
||||
snode->flag = SNODE_SHOW_GPENCIL | SNODE_USE_ALPHA;
|
||||
|
||||
/* backdrop */
|
||||
snode->zoom = 1.0f;
|
||||
|
@@ -80,9 +80,9 @@ EnumPropertyItem space_type_items[] = {
|
||||
};
|
||||
|
||||
static EnumPropertyItem draw_channels_items[] = {
|
||||
{0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
|
||||
{SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
|
||||
"Draw image with RGB colors and alpha transparency"},
|
||||
{0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
|
||||
{SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
|
||||
{SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer",
|
||||
"Draw Z-buffer associated with image (mapped from camera clip start to end)"},
|
||||
@@ -633,15 +633,18 @@ static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUS
|
||||
if (alpha && zbuf)
|
||||
return draw_channels_items;
|
||||
|
||||
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
|
||||
|
||||
if (alpha) {
|
||||
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_USE_ALPHA);
|
||||
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
|
||||
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ALPHA);
|
||||
}
|
||||
else if (zbuf) {
|
||||
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
|
||||
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF);
|
||||
}
|
||||
else {
|
||||
RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
|
||||
}
|
||||
|
||||
RNA_enum_item_end(&item, &totitem);
|
||||
*free = 1;
|
||||
@@ -3062,9 +3065,9 @@ static void rna_def_space_node(BlenderRNA *brna)
|
||||
};
|
||||
|
||||
static EnumPropertyItem backdrop_channels_items[] = {
|
||||
{0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
|
||||
{SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
|
||||
"Draw image with RGB colors and alpha transparency"},
|
||||
{0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
|
||||
{SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
|
||||
{SNODE_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
|
||||
{SNODE_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
|
||||
|
Reference in New Issue
Block a user