Orange: Small tweaks in Node drawing;

- theme colors now are different... the specific colors are only drawn in
  the headers of nodes, making the backdrop color constant. Allows for much
  more outstanding colors this way, without distracting from previews.

- soft shadow now is drawn pixel-sized, so doesn't scale up or down.
This commit is contained in:
Ton Roosendaal
2005-12-30 16:50:06 +00:00
parent 1e864ed482
commit c5a41f6e22
4 changed files with 29 additions and 20 deletions

View File

@@ -331,7 +331,7 @@ static bNodeType sh_node_geom= {
/* type code */ SH_NODE_GEOMETRY,
/* name */ "Geometry",
/* width+range */ 60, 40, 100,
/* class+opts */ NODE_CLASS_GENERATOR, 0,
/* class+opts */ NODE_CLASS_INPUT, 0,
/* input sock */ NULL,
/* output sock */ sh_node_geom_out,
/* storage */ "",
@@ -404,7 +404,7 @@ static bNodeType sh_node_normal= {
/* type code */ SH_NODE_NORMAL,
/* name */ "Normal",
/* width+range */ 100, 60, 200,
/* class+opts */ NODE_CLASS_GENERATOR, NODE_OPTIONS,
/* class+opts */ NODE_CLASS_OPERATOR, NODE_OPTIONS,
/* input sock */ sh_node_normal_in,
/* output sock */ sh_node_normal_out,
/* storage */ "",

View File

@@ -444,7 +444,7 @@ static void draw_nodespace_grid(SpaceNode *snode)
}
static void nodeshadow(rctf *rct, float radius, int select)
static void nodeshadow(rctf *rct, float radius, float aspect, int select)
{
float rad;
float a;
@@ -457,8 +457,8 @@ static void nodeshadow(rctf *rct, float radius, int select)
else
rad= radius;
if(select) a= 10.0f; else a= 7.0f;
for(; a>0.0f; a-=1.0f) {
if(select) a= 10.0f*aspect; else a= 7.0f*aspect;
for(; a>0.0f; a-=aspect) {
/* alpha ranges from 2 to 20 or so */
glColor4ub(0, 0, 0, alpha);
alpha+= 2;
@@ -674,10 +674,14 @@ static void node_basis_draw(ScrArea *sa, SpaceNode *snode, bNode *node)
int ofs, color_id= node_get_colorid(node);
uiSetRoundBox(15-4);
nodeshadow(rct, BASIS_RAD, node->flag & SELECT);
nodeshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT);
/* header */
BIF_ThemeColorShade(color_id, 0);
if(color_id==TH_NODE)
BIF_ThemeColorShade(color_id, -20);
else
BIF_ThemeColor(color_id);
uiSetRoundBox(3);
uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
@@ -723,12 +727,12 @@ static void node_basis_draw(ScrArea *sa, SpaceNode *snode, bNode *node)
snode_drawstring(snode, node->name, (int)(iconofs - rct->xmin-18.0f));
/* body */
BIF_ThemeColorShade(color_id, 20);
BIF_ThemeColor(TH_NODE);
uiSetRoundBox(8);
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, BASIS_RAD);
/* scaling indicator */
node_scaling_widget(color_id, snode->aspect, rct->xmax-BASIS_RAD*snode->aspect, rct->ymin, rct->xmax, rct->ymin+BASIS_RAD*snode->aspect);
node_scaling_widget(TH_NODE, snode->aspect, rct->xmax-BASIS_RAD*snode->aspect, rct->ymin, rct->xmax, rct->ymin+BASIS_RAD*snode->aspect);
/* outline active emphasis */
if(node->flag & NODE_ACTIVE) {
@@ -817,10 +821,10 @@ void node_hidden_draw(SpaceNode *snode, bNode *node)
/* shadow */
uiSetRoundBox(15);
nodeshadow(rct, hiddenrad, node->flag & SELECT);
nodeshadow(rct, hiddenrad, snode->aspect, node->flag & SELECT);
/* body */
BIF_ThemeColorShade(color_id, 20);
BIF_ThemeColor(color_id);
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
/* outline active emphasis */
@@ -837,9 +841,14 @@ void node_hidden_draw(SpaceNode *snode, bNode *node)
else
BIF_ThemeColorBlendShade(TH_TEXT, color_id, 0.4, 10);
/* open entirely? */
/* open entirely icon */
ui_draw_tria_icon(rct->xmin+9.0f, centy-6.0f, snode->aspect, 'h');
if(node->flag & SELECT)
BIF_ThemeColor(TH_TEXT_HI);
else
BIF_ThemeColor(TH_TEXT);
if(node->miniwidth>0.0f) {
ui_rasterpos_safe(rct->xmin+21.0f, centy-4.0f, snode->aspect);
snode_drawstring(snode, node->name, (int)(rct->xmax - rct->xmin-18.0f -12.0f));

View File

@@ -480,9 +480,9 @@ void BIF_InitTheme(void)
/* space node, re-uses syntax color storage */
btheme->tnode= btheme->tv3d;
SETCOL(btheme->tnode.syntaxl, 120, 120, 120, 255); /* TH_NODE */
SETCOL(btheme->tnode.syntaxn, 110, 110, 120, 255); /* in-out */
SETCOL(btheme->tnode.syntaxb, 140, 140, 140, 255); /* operator */
SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
SETCOL(btheme->tnode.syntaxn, 95, 110, 145, 255); /* in/output */
SETCOL(btheme->tnode.syntaxb, 135, 125, 120, 255); /* operator */
SETCOL(btheme->tnode.syntaxv, 120, 120, 120, 255); /* generator */
SETCOL(btheme->tnode.syntaxc, 120, 120, 120, 255); /* free */
@@ -615,10 +615,10 @@ char *BIF_ThemeColorsPup(int spacetype)
}
else if(spacetype==SPACE_NODE) {
strcat(cp,"%l|");
sprintf(str, "Default Node %%x%d|", TH_NODE); strcat(cp, str);
sprintf(str, "Node backdrop %%x%d|", TH_NODE); strcat(cp, str);
sprintf(str, "In/Out Node %%x%d|", TH_NODE_IN_OUT); strcat(cp, str);
sprintf(str, "Operator Node %%x%d|", TH_NODE_OPERATOR); strcat(cp, str);
sprintf(str, "Generator Node %%x%d|", TH_NODE_GENERATOR); strcat(cp, str);
sprintf(str, "Operator Node %%x%d|", TH_NODE_OPERATOR); strcat(cp, str);
// sprintf(str, " %%x%d|", TH_NODE_FREE); strcat(cp, str);
}
}

View File

@@ -275,9 +275,9 @@ static void init_userdef_file(void)
if(btheme->tnode.syntaxn[3]==0) {
/* re-uses syntax color storage */
btheme->tnode= btheme->tv3d;
SETCOL(btheme->tnode.syntaxl, 120, 120, 120, 255); /* TH_NODE */
SETCOL(btheme->tnode.syntaxn, 110, 110, 120, 255); /* in-out */
SETCOL(btheme->tnode.syntaxb, 140, 140, 140, 255); /* operator */
SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
SETCOL(btheme->tnode.syntaxn, 95, 110, 145, 255); /* in/output */
SETCOL(btheme->tnode.syntaxb, 135, 125, 120, 255); /* operator */
SETCOL(btheme->tnode.syntaxv, 120, 120, 120, 255); /* generator */
SETCOL(btheme->tnode.syntaxc, 120, 120, 120, 255); /* free */
}