Commit: e07e541ca5f98483e2546d3b628f118a381f2097
Author: julianeisel
Date:   Fri Jan 9 00:06:31 2015 +0100
Branches: temp-menu_shadow_theme_color
https://developer.blender.org/rBe07e541ca5f98483e2546d3b628f118a381f2097

Use menu shadow alpha for node shadow as well

One value to rule them all!

===================================================================

M       source/blender/editors/interface/interface_draw.c
M       source/blender/editors/interface/interface_intern.h
M       source/blender/editors/space_node/drawnode.c
M       source/blender/editors/space_node/node_draw.c
M       source/blender/editors/space_node/node_intern.h

===================================================================

diff --git a/source/blender/editors/interface/interface_draw.c 
b/source/blender/editors/interface/interface_draw.c
index 33b05fb..db4d666 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1736,15 +1736,13 @@ void UI_draw_box_shadow(unsigned char alpha, float 
minx, float miny, float maxx,
 }
 
 
-void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float 
alpha, int UNUSED(select))
+void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, int 
UNUSED(select))
 {
-
-       unsigned char scolor[3];
+       bTheme *btheme = UI_GetTheme();
        int i;
        float rad;
        float a;
-       float dalpha = alpha * 2.0f / 255.0f, calpha;
-       
+       float dalpha = (btheme->tui.menu_shadow[3] * 4.0f) / 255.0f, calpha;
        glEnable(GL_BLEND);
        
        if (radius > (BLI_rctf_size_y(rct) - 10.0f) / 2.0f)
@@ -1763,12 +1761,9 @@ void ui_draw_dropshadow(const rctf *rct, float radius, 
float aspect, float alpha
                a = i * aspect;
        }
 
-       UI_GetThemeColor3ubv(TH_MENU_SHADOW, scolor);
        calpha = dalpha;
        for (; i--; a -= aspect) {
-               /* alpha ranges from 2 to 20 or so, use colors from menu shadow 
theme */
-               glColor4ub(scolor[0], scolor[1], scolor[2], (calpha * 255.0f));
-               //glColor4ub(255, 0, 0, (calpha * 255.0f));
+               glColor4ub(UNPACK3(btheme->tui.menu_shadow), calpha);
                calpha += dalpha;
                
                UI_draw_roundbox_gl_mode(GL_POLYGON, rct->xmin - a, rct->ymin - 
a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a);
diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index 7a217e5..db5a528 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -591,7 +591,7 @@ extern int ui_handler_panel_region(struct bContext *C, 
const struct wmEvent *eve
 extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, const 
rcti *rect, const bool show_pin);
 
 /* interface_draw.c */
-extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, 
float alpha, int select);
+extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, 
int select);
 
 void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, 
const float alpha);
 
diff --git a/source/blender/editors/space_node/drawnode.c 
b/source/blender/editors/space_node/drawnode.c
index d03f980..d96964e 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -418,7 +418,6 @@ static void node_draw_frame(const bContext *C, ARegion *ar, 
SpaceNode *snode,
        rctf *rct = &node->totr;
        int color_id = node_get_colorid(node);
        unsigned char color[4];
-       float alpha;
        
        /* skip if out of view */
        if (BLI_rctf_isect(&node->totr, &ar->v2d.cur, NULL) == false) {
@@ -428,14 +427,13 @@ static void node_draw_frame(const bContext *C, ARegion 
*ar, SpaceNode *snode,
        }
 
        UI_GetThemeColor4ubv(TH_NODE_FRAME, color);
-       alpha = (float)(color[3]) / 255.0f;
        
        /* shadow */
-       node_draw_shadow(snode, node, BASIS_RAD, alpha);
+       node_draw_shadow(snode, node, BASIS_RAD);
        
        /* body */
        if (node->flag & NODE_CUSTOM_COLOR)
-               glColor4f(node->color[0], node->color[1], node->color[2], 
alpha);
+               glColor4f(node->color[0], node->color[1], node->color[2], 
(float)(color[3]) / 255.0f);
        else
                UI_ThemeColor4(TH_NODE_FRAME);
        glEnable(GL_BLEND);
diff --git a/source/blender/editors/space_node/node_draw.c 
b/source/blender/editors/space_node/node_draw.c
index 127e2d3..67eedd3 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -72,7 +72,7 @@
 #endif
 
 /* XXX interface.h */
-extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, 
float alpha, int select);
+extern void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, 
int select);
 
 float ED_node_grid_size(void)
 {
@@ -743,13 +743,13 @@ static void node_toggle_button_cb(struct bContext *C, 
void *node_argv, void *op_
        WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, NULL);
 }
 
-void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
+void node_draw_shadow(SpaceNode *snode, bNode *node, float radius)
 {
        rctf *rct = &node->totr;
        
        UI_draw_roundbox_corner_set(UI_CNR_ALL);
        if (node->parent == NULL)
-               ui_draw_dropshadow(rct, radius, snode->aspect, alpha, 
node->flag & SELECT);
+               ui_draw_dropshadow(rct, radius, snode->aspect, node->flag & 
SELECT);
        else {
                const float margin = 3.0f;
                
@@ -785,7 +785,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, 
SpaceNode *snode, bN
        }
        
        /* shadow */
-       node_draw_shadow(snode, node, BASIS_RAD, 1.0f);
+       node_draw_shadow(snode, node, BASIS_RAD);
        
        /* header uses color from backdrop, but we make it opaqie */
        if (color_id == TH_NODE) {
@@ -960,7 +960,7 @@ static void node_draw_hidden(const bContext *C, ARegion 
*ar, SpaceNode *snode, b
        char showname[128]; /* 128 is used below */
        
        /* shadow */
-       node_draw_shadow(snode, node, hiddenrad, 1.0f);
+       node_draw_shadow(snode, node, hiddenrad);
 
        /* body */
        UI_ThemeColor(color_id);
diff --git a/source/blender/editors/space_node/node_intern.h 
b/source/blender/editors/space_node/node_intern.h
index 27c3ab8..29e9973 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -73,7 +73,7 @@ int node_get_colorid(struct bNode *node);
 void node_socket_circle_draw(const struct bContext *C, struct bNodeTree 
*ntree, struct bNode *node,
                              struct bNodeSocket *sock, float size, int 
highlight);
 int node_get_resize_cursor(int directions);
-void node_draw_shadow(struct SpaceNode *snode, struct bNode *node, float 
radius, float alpha);
+void node_draw_shadow(struct SpaceNode *snode, struct bNode *node, float 
radius);
 void node_draw_default(const struct bContext *C, struct ARegion *ar, struct 
SpaceNode *snode,
                        struct bNodeTree *ntree, struct bNode *node, 
bNodeInstanceKey key);
 void node_update_default(const struct bContext *C, struct bNodeTree *ntree, 
struct bNode *node);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to