Theme color for frame nodes. The alpha value from this theme color is also used when drawing frames with a custom color (which is just RGB).
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -141,6 +141,7 @@ enum {
|
||||
TH_NODE_OPERATOR,
|
||||
TH_NODE_CONVERTOR,
|
||||
TH_NODE_GROUP,
|
||||
TH_NODE_FRAME,
|
||||
|
||||
TH_CONSOLE_OUTPUT,
|
||||
TH_CONSOLE_INPUT,
|
||||
|
@@ -1663,12 +1663,12 @@ void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, fl
|
||||
}
|
||||
|
||||
|
||||
void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
|
||||
void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
|
||||
{
|
||||
int i;
|
||||
float rad;
|
||||
float a;
|
||||
char alpha = 2;
|
||||
float dalpha = alpha * 2.0f/255.0f, calpha;
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
@@ -1688,10 +1688,11 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
|
||||
a = i * aspect;
|
||||
}
|
||||
|
||||
calpha = dalpha;
|
||||
for (; i--; a -= aspect) {
|
||||
/* alpha ranges from 2 to 20 or so */
|
||||
glColor4ub(0, 0, 0, alpha);
|
||||
alpha += 2;
|
||||
glColor4f(0.0f, 0.0f, 0.0f, calpha);
|
||||
calpha += dalpha;
|
||||
|
||||
uiDrawBox(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a);
|
||||
}
|
||||
|
@@ -445,7 +445,7 @@ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event);
|
||||
extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect);
|
||||
|
||||
/* interface_draw.c */
|
||||
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
|
||||
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
|
||||
|
||||
void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha);
|
||||
|
||||
|
@@ -363,6 +363,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
|
||||
cp = ts->syntaxv; break;
|
||||
case TH_NODE_GROUP:
|
||||
cp = ts->syntaxc; break;
|
||||
case TH_NODE_FRAME:
|
||||
cp = ts->movie; break;
|
||||
case TH_NODE_CURVING:
|
||||
cp = &ts->noodle_curving; break;
|
||||
|
||||
|
@@ -82,7 +82,7 @@
|
||||
#include "node_intern.h"
|
||||
|
||||
// XXX interface.h
|
||||
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
|
||||
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
|
||||
|
||||
/* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
|
||||
|
||||
@@ -970,6 +970,11 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
{
|
||||
rctf *rct = &node->totr;
|
||||
int color_id = node_get_colorid(node);
|
||||
unsigned char color[4];
|
||||
float alpha;
|
||||
|
||||
UI_GetThemeColor4ubv(TH_NODE_FRAME, color);
|
||||
alpha = (float)(color[3])/255.0f;
|
||||
|
||||
/* skip if out of view */
|
||||
if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax ||
|
||||
@@ -981,13 +986,13 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
}
|
||||
|
||||
/* shadow */
|
||||
node_draw_shadow(snode, node, BASIS_RAD);
|
||||
node_draw_shadow(snode, node, BASIS_RAD, alpha);
|
||||
|
||||
/* body */
|
||||
if (node->flag & NODE_CUSTOM_COLOR)
|
||||
glColor3fv(node->color);
|
||||
glColor4f(node->color[0], node->color[1], node->color[2], alpha);
|
||||
else
|
||||
UI_ThemeColor4(TH_NODE);
|
||||
UI_ThemeColor4(TH_NODE_FRAME);
|
||||
glEnable(GL_BLEND);
|
||||
uiSetRoundBox(UI_CNR_ALL);
|
||||
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
|
||||
|
@@ -83,7 +83,7 @@
|
||||
/* width of socket columns in group display */
|
||||
#define NODE_GROUP_FRAME 120
|
||||
// XXX interface.h
|
||||
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
|
||||
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
|
||||
|
||||
/* XXX update functions for node editor are a mess, needs a clear concept */
|
||||
void ED_node_tree_update(SpaceNode *snode, Scene *scene)
|
||||
@@ -669,13 +669,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)
|
||||
void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
|
||||
{
|
||||
rctf *rct = &node->totr;
|
||||
|
||||
uiSetRoundBox(UI_CNR_ALL);
|
||||
if (node->parent==NULL)
|
||||
ui_dropshadow(rct, radius, snode->aspect, node->flag & SELECT);
|
||||
ui_dropshadow(rct, radius, snode->aspect, alpha, node->flag & SELECT);
|
||||
else {
|
||||
const float margin = 3.0f;
|
||||
|
||||
@@ -712,7 +712,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
}
|
||||
|
||||
/* shadow */
|
||||
node_draw_shadow(snode, node, BASIS_RAD);
|
||||
node_draw_shadow(snode, node, BASIS_RAD, 1.0f);
|
||||
|
||||
/* header */
|
||||
if (color_id==TH_NODE)
|
||||
@@ -872,7 +872,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);
|
||||
node_draw_shadow(snode, node, hiddenrad, 1.0f);
|
||||
|
||||
/* body */
|
||||
UI_ThemeColor(color_id);
|
||||
|
@@ -72,7 +72,7 @@ void node_menus_register(void);
|
||||
int node_get_colorid(struct bNode *node);
|
||||
void node_socket_circle_draw(struct bNodeTree *ntree, 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);
|
||||
void node_draw_shadow(struct SpaceNode *snode, struct bNode *node, float radius, float alpha);
|
||||
void node_draw_default(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *node);
|
||||
void node_update_default(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node);
|
||||
int node_select_area_default(struct bNode *node, int x, int y);
|
||||
|
@@ -1591,6 +1591,12 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Group Node", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "frame_node", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, NULL, "movie");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Frame Node", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
|
||||
RNA_def_property_int_default(prop, 5);
|
||||
|
Reference in New Issue
Block a user