Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-01-29 16:03:38 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-01-29 16:03:38 +0400
commit1a750e00e72c06fc3acf883c436dc147d0626e52 (patch)
tree443143ad698b0ec02d7effaa8e50877fca9f7bb6 /source/blender
parentdc727f0256562cb8fc1074fda9b9b7f407496ab2 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_image/image_draw.c13
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c8
-rw-r--r--source/blender/editors/space_node/space_node.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c11
5 files changed, 14 insertions, 22 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index ba4f8287cd7..915036cf70e 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -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 */
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 1c384ef38d7..35ba83a8bc6 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -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;
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index cca1858f112..1ec77bf58ed 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -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);
}
}
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 513f6b43e9a..a5f6ca9ded0 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -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;
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 09969ddc7e5..435fcd5fd06 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -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", ""},