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:
authorCampbell Barton <ideasman42@gmail.com>2012-07-09 23:58:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-09 23:58:36 +0400
commit62df28a3255ce274a620640e1b6b5e232e32f340 (patch)
tree429a078d9042566968b428db41499ba0fe0695bf /source/blender/editors
parente66a02e7e21adf6932403890166e7e2c8e266649 (diff)
style cleanup: node drawing
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_node/drawnode.c106
-rw-r--r--source/blender/editors/space_node/node_draw.c391
2 files changed, 251 insertions, 246 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index c81dc93cb0b..cc0298a7ebb 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -994,7 +994,7 @@ static void node_draw_frame(const bContext *C, ARegion *ar, SpaceNode *snode, bN
float alpha;
UI_GetThemeColor4ubv(TH_NODE_FRAME, color);
- alpha = (float)(color[3])/255.0f;
+ 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 ||
@@ -1074,7 +1074,7 @@ static void node_buts_frame_details(uiLayout *layout, bContext *UNUSED(C), Point
}
-#define NODE_REROUTE_SIZE 8.0f
+#define NODE_REROUTE_SIZE 8.0f
static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree), bNode *node)
{
@@ -1086,36 +1086,36 @@ static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntr
nodeToView(node, 0.0f, 0.0f, &locx, &locy);
/* reroute node has exactly one input and one output, both in the same place */
- nsock= node->outputs.first;
- nsock->locx= locx;
- nsock->locy= locy;
+ nsock = node->outputs.first;
+ nsock->locx = locx;
+ nsock->locy = locy;
- nsock= node->inputs.first;
- nsock->locx= locx;
- nsock->locy= locy;
-
- node->width = size*2;
- node->totr.xmin= locx - size;
- node->totr.xmax= locx + size;
- node->totr.ymax= locy + size;
- node->totr.ymin= locy - size;
+ nsock = node->inputs.first;
+ nsock->locx = locx;
+ nsock->locy = locy;
+
+ node->width = size * 2.0f;
+ node->totr.xmin = locx - size;
+ node->totr.xmax = locx + size;
+ node->totr.ymax = locy + size;
+ node->totr.ymin = locy - size;
}
static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(snode), bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
- #if 0 /* UNUSED */
- rctf *rct= &node->totr;
+ #if 0 /* UNUSED */
+ rctf *rct = &node->totr;
float size = NODE_REROUTE_SIZE;
#endif
- float socket_size= NODE_SOCKSIZE;
+ float socket_size = NODE_SOCKSIZE;
/* skip if out of view */
if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax ||
- node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) {
-
+ node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax)
+ {
uiEndBlock(C, node->block);
- node->block= NULL;
+ node->block = NULL;
return;
}
@@ -1134,12 +1134,12 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
if (node->flag & (NODE_ACTIVE | SELECT)) {
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
- /* using different shades of TH_TEXT_HI for the empasis, like triangle */
- if (node->flag & NODE_ACTIVE)
- UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
- else
- UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
- uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size);
+ /* using different shades of TH_TEXT_HI for the empasis, like triangle */
+ if (node->flag & NODE_ACTIVE)
+ UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
+ else
+ UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
+ uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
@@ -1149,13 +1149,13 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
/* only draw input socket. as they all are placed on the same position.
* highlight also if node itself is selected, since we don't display the node body separately!
*/
- for (sock= node->inputs.first; sock; sock= sock->next) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
node_socket_circle_draw(ntree, sock, socket_size, (sock->flag & SELECT) || (node->flag & SELECT));
}
uiEndBlock(C, node->block);
uiDrawBlock(C, node->block);
- node->block= NULL;
+ node->block = NULL;
}
/* Special tweak area for reroute node.
@@ -1164,12 +1164,12 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
static int node_tweak_area_reroute(bNode *node, int x, int y)
{
/* square of tweak radius */
- static const float tweak_radius_sq = 576; /* 24*24 */
+ static const float tweak_radius_sq = 576; /* 24*24 */
bNodeSocket *sock = node->inputs.first;
float dx = sock->locx - x;
float dy = sock->locy - y;
- return (dx*dx + dy*dy <= tweak_radius_sq);
+ return (dx * dx + dy * dy <= tweak_radius_sq);
}
static void node_common_set_butfunc(bNodeType *ntype)
@@ -1197,9 +1197,9 @@ static void node_common_set_butfunc(bNodeType *ntype)
ntype->resize_area_func = node_resize_area_frame;
break;
case NODE_REROUTE:
- ntype->drawfunc= node_draw_reroute;
- ntype->drawupdatefunc= node_update_reroute;
- ntype->tweak_area_func= node_tweak_area_reroute;
+ ntype->drawfunc = node_draw_reroute;
+ ntype->drawupdatefunc = node_update_reroute;
+ ntype->tweak_area_func = node_tweak_area_reroute;
break;
}
}
@@ -2468,7 +2468,7 @@ static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *p
static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
- bNode *node= ptr->data;
+ bNode *node = ptr->data;
uiTemplateID(layout, C, ptr, "clip", NULL, NULL, NULL);
@@ -2691,7 +2691,7 @@ static void node_composit_set_butfunc(bNodeType *ntype)
ntype->uibackdropfunc = node_composit_backdrop_viewer;
break;
case CMP_NODE_MASK:
- ntype->uifunc= node_composit_buts_mask;
+ ntype->uifunc = node_composit_buts_mask;
break;
case CMP_NODE_KEYINGSCREEN:
ntype->uifunc = node_composit_buts_keyingscreen;
@@ -3123,27 +3123,31 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
deltay = vec[3][1] - vec[0][1];
/* check direction later, for top sockets */
if (fromreroute) {
- if (ABS(deltax)>ABS(deltay)) {
- vec[1][1]= vec[0][1];
- vec[1][0]= vec[0][0]+(deltax>0?dist:-dist);
- } else {
- vec[1][0]= vec[0][0];
- vec[1][1]= vec[0][1]+(deltay>0?dist:-dist);
+ if (ABS(deltax) > ABS(deltay)) {
+ vec[1][1] = vec[0][1];
+ vec[1][0] = vec[0][0] + (deltax > 0 ? dist : -dist);
+ }
+ else {
+ vec[1][0] = vec[0][0];
+ vec[1][1] = vec[0][1] + (deltay > 0 ? dist : -dist);
}
- } else {
+ }
+ else {
vec[1][0] = vec[0][0] + dist;
vec[1][1] = vec[0][1];
}
if (toreroute) {
- if (ABS(deltax)>ABS(deltay)) {
- vec[2][1]= vec[3][1];
- vec[2][0]= vec[3][0]+ (deltax>0?-dist:dist);
- } else {
- vec[2][0]= vec[3][0];
- vec[2][1]= vec[3][1]+(deltay>0?-dist:dist);
+ if (ABS(deltax) > ABS(deltay)) {
+ vec[2][1] = vec[3][1];
+ vec[2][0] = vec[3][0] + (deltax > 0 ? -dist : dist);
+ }
+ else {
+ vec[2][0] = vec[3][0];
+ vec[2][1] = vec[3][1] + (deltay > 0 ? -dist : dist);
}
- } else {
+ }
+ else {
vec[2][0] = vec[3][0] - dist;
vec[2][1] = vec[3][1];
}
@@ -3161,8 +3165,8 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
}
#define LINK_RESOL 24
-#define LINK_ARROW 12 /* position of arrow on the link, LINK_RESOL/2 */
-#define ARROW_SIZE 7
+#define LINK_ARROW 12 /* position of arrow on the link, LINK_RESOL/2 */
+#define ARROW_SIZE 7
void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3)
{
float coord_array[LINK_RESOL + 1][2];
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 7f3b7cd2dab..2b700876c62 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -82,7 +82,7 @@
#include "node_intern.h"
/* width of socket columns in group display */
-#define NODE_GROUP_FRAME 120
+#define NODE_GROUP_FRAME 120
// XXX interface.h
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
@@ -91,8 +91,8 @@ void ED_node_tree_update(SpaceNode *snode, Scene *scene)
{
snode_set_context(snode, scene);
- if (snode->nodetree && snode->nodetree->id.us==0)
- snode->nodetree->id.us= 1;
+ if (snode->nodetree && snode->nodetree->id.us == 0)
+ snode->nodetree->id.us = 1;
}
void ED_node_changed_update(ID *id, bNode *node)
@@ -102,30 +102,30 @@ void ED_node_changed_update(ID *id, bNode *node)
node_tree_from_ID(id, &nodetree, &edittree, &treetype);
- if (treetype==NTREE_SHADER) {
+ if (treetype == NTREE_SHADER) {
DAG_id_tag_update(id, 0);
if (GS(id->name) == ID_MA)
- WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, id);
else if (GS(id->name) == ID_LA)
- WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, id);
+ WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id);
else if (GS(id->name) == ID_WO)
- WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, id);
+ WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, id);
}
- else if (treetype==NTREE_COMPOSIT) {
+ else if (treetype == NTREE_COMPOSIT) {
if (node)
nodeUpdate(edittree, node);
/* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */
- node= node_tree_get_editgroup(nodetree);
+ node = node_tree_get_editgroup(nodetree);
if (node)
nodeUpdateID(nodetree, node->id);
- WM_main_add_notifier(NC_SCENE|ND_NODES, id);
+ WM_main_add_notifier(NC_SCENE | ND_NODES, id);
}
- else if (treetype==NTREE_TEXTURE) {
+ else if (treetype == NTREE_TEXTURE) {
DAG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_TEXTURE|ND_NODES, id);
+ WM_main_add_notifier(NC_TEXTURE | ND_NODES, id);
}
}
@@ -136,9 +136,9 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
if (ntree == lookup)
return 1;
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
if (node->type == NODE_GROUP && node->id)
- if (has_nodetree((bNodeTree*)node->id, lookup))
+ if (has_nodetree((bNodeTree *)node->id, lookup))
return 1;
return 0;
@@ -150,14 +150,14 @@ typedef struct NodeUpdateCalldata {
} NodeUpdateCalldata;
static void node_generic_update_cb(void *calldata, ID *owner_id, bNodeTree *ntree)
{
- NodeUpdateCalldata *cd= (NodeUpdateCalldata*)calldata;
+ NodeUpdateCalldata *cd = (NodeUpdateCalldata *)calldata;
/* check if nodetree uses the group stored in calldata */
if (has_nodetree(ntree, cd->ntree))
ED_node_changed_update(owner_id, cd->node);
}
void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node)
{
- bNodeTreeType *tti= ntreeGetType(ntree->type);
+ bNodeTreeType *tti = ntreeGetType(ntree->type);
NodeUpdateCalldata cd;
cd.ntree = ntree;
cd.node = node;
@@ -174,14 +174,14 @@ static int compare_nodes(bNode *a, bNode *b)
/* These tell if either the node or any of the parent nodes is selected.
* A selected parent means an unselected node is also in foreground!
*/
- int a_select=(a->flag & NODE_SELECT), b_select=(b->flag & NODE_SELECT);
- int a_active=(a->flag & NODE_ACTIVE), b_active=(b->flag & NODE_ACTIVE);
+ int a_select = (a->flag & NODE_SELECT), b_select = (b->flag & NODE_SELECT);
+ int a_active = (a->flag & NODE_ACTIVE), b_active = (b->flag & NODE_ACTIVE);
/* if one is an ancestor of the other */
/* XXX there might be a better sorting algorithm for stable topological sort, this is O(n^2) worst case */
- for (parent = a->parent; parent; parent=parent->parent) {
+ for (parent = a->parent; parent; parent = parent->parent) {
/* if b is an ancestor, it is always behind a */
- if (parent==b)
+ if (parent == b)
return 1;
/* any selected ancestor moves the node forward */
if (parent->flag & NODE_ACTIVE)
@@ -189,9 +189,9 @@ static int compare_nodes(bNode *a, bNode *b)
if (parent->flag & NODE_SELECT)
a_select = 1;
}
- for (parent = b->parent; parent; parent=parent->parent) {
+ for (parent = b->parent; parent; parent = parent->parent) {
/* if a is an ancestor, it is always behind b */
- if (parent==a)
+ if (parent == a)
return 0;
/* any selected ancestor moves the node forward */
if (parent->flag & NODE_ACTIVE)
@@ -222,7 +222,7 @@ void ED_node_sort(bNodeTree *ntree)
{
/* merge sort is the algorithm of choice here */
bNode *first_a, *first_b, *node_a, *node_b, *tmp;
- int totnodes= BLI_countlist(&ntree->nodes);
+ int totnodes = BLI_countlist(&ntree->nodes);
int k, a, b;
k = 1;
@@ -231,11 +231,11 @@ void ED_node_sort(bNodeTree *ntree)
do {
/* setup first_b pointer */
- for (b=0; b < k && first_b; ++b) {
+ for (b = 0; b < k && first_b; ++b) {
first_b = first_b->next;
}
/* all batches merged? */
- if (first_b==NULL)
+ if (first_b == NULL)
break;
/* merge batches */
@@ -243,7 +243,7 @@ void ED_node_sort(bNodeTree *ntree)
node_b = first_b;
a = b = 0;
while (a < k && b < k && node_b) {
- if (compare_nodes(node_a, node_b)==0) {
+ if (compare_nodes(node_a, node_b) == 0) {
node_a = node_a->next;
++a;
}
@@ -260,7 +260,7 @@ void ED_node_sort(bNodeTree *ntree)
first_b = node_b;
for (; b < k; ++b) {
/* all nodes sorted? */
- if (first_b==NULL)
+ if (first_b == NULL)
break;
first_b = first_b->next;
}
@@ -274,8 +274,8 @@ void ED_node_sort(bNodeTree *ntree)
static void do_node_internal_buttons(bContext *C, void *node_v, int event)
{
- if (event==B_NODE_EXEC) {
- SpaceNode *snode= CTX_wm_space_node(C);
+ if (event == B_NODE_EXEC) {
+ SpaceNode *snode = CTX_wm_space_node(C);
if (snode && snode->id)
ED_node_changed_update(snode->id, node_v);
}
@@ -288,10 +288,10 @@ static void node_uiblocks_init(const bContext *C, bNodeTree *ntree)
/* add node uiBlocks in drawing order - prevents events going to overlapping nodes */
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
/* ui block */
BLI_snprintf(uiblockstr, sizeof(uiblockstr), "node buttons %p", (void *)node);
- node->block= uiBeginBlock(C, CTX_wm_region(C), uiblockstr, UI_EMBOSS);
+ node->block = uiBeginBlock(C, CTX_wm_region(C), uiblockstr, UI_EMBOSS);
uiBlockSetHandleFunc(node->block, do_node_internal_buttons, node);
/* this cancels events for background nodes */
@@ -311,26 +311,26 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
/* get "global" coords */
nodeToView(node, 0.0f, 0.0f, &locx, &locy);
- dy= locy;
+ dy = locy;
/* header */
- dy-= NODE_DY;
+ dy -= NODE_DY;
/* little bit space in top */
if (node->outputs.first)
- dy-= NODE_DYS/2;
+ dy -= NODE_DYS / 2;
/* output sockets */
- for (nsock= node->outputs.first; nsock; nsock= nsock->next) {
+ for (nsock = node->outputs.first; nsock; nsock = nsock->next) {
if (!nodeSocketIsHidden(nsock)) {
- nsock->locx= locx + node->width;
- nsock->locy= dy - NODE_DYS;
- dy-= NODE_DY;
+ nsock->locx = locx + node->width;
+ nsock->locy = dy - NODE_DYS;
+ dy -= NODE_DY;
}
}
node->prvr.xmin = locx + NODE_DYS;
- node->prvr.xmax = locx + node->width- NODE_DYS;
+ node->prvr.xmax = locx + node->width - NODE_DYS;
/* preview rect? */
if (node->flag & NODE_PREVIEW) {
@@ -338,39 +338,39 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
BLI_lock_thread(LOCK_PREVIEW);
if (node->preview && node->preview->rect) {
- float aspect= 1.0f;
+ float aspect = 1.0f;
if (node->preview && node->preview->xsize && node->preview->ysize)
- aspect= (float)node->preview->ysize/(float)node->preview->xsize;
+ aspect = (float)node->preview->ysize / (float)node->preview->xsize;
- dy-= NODE_DYS/2;
+ dy -= NODE_DYS / 2;
node->prvr.ymax = dy;
if (aspect <= 1.0f)
- node->prvr.ymin = dy - aspect*(node->width-NODE_DY);
+ node->prvr.ymin = dy - aspect * (node->width - NODE_DY);
else {
- float dx= (node->width - NODE_DYS) - (node->width- NODE_DYS)/aspect; /* width correction of image */
+ float dx = (node->width - NODE_DYS) - (node->width - NODE_DYS) / aspect; /* width correction of image */
- node->prvr.ymin = dy - (node->width-NODE_DY);
+ node->prvr.ymin = dy - (node->width - NODE_DY);
- node->prvr.xmin+= 0.5f*dx;
- node->prvr.xmax-= 0.5f*dx;
+ node->prvr.xmin += 0.5f * dx;
+ node->prvr.xmax -= 0.5f * dx;
}
- dy= node->prvr.ymin - NODE_DYS/2;
+ dy = node->prvr.ymin - NODE_DYS / 2;
/* make sure that maximums are bigger or equal to minimums */
if (node->prvr.xmax < node->prvr.xmin) SWAP(float, node->prvr.xmax, node->prvr.xmin);
if (node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
}
else {
- float oldh= node->prvr.ymax - node->prvr.ymin;
- if (oldh==0.0f)
- oldh= 0.6f*node->width-NODE_DY;
- dy-= NODE_DYS/2;
+ float oldh = node->prvr.ymax - node->prvr.ymin;
+ if (oldh == 0.0f)
+ oldh = 0.6f * node->width - NODE_DY;
+ dy -= NODE_DYS / 2;
node->prvr.ymax = dy;
node->prvr.ymin = dy - oldh;
- dy= node->prvr.ymin - NODE_DYS/2;
+ dy = node->prvr.ymin - NODE_DYS / 2;
}
BLI_unlock_thread(LOCK_PREVIEW);
@@ -378,18 +378,18 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
/* buttons rect? */
if ((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
- dy-= NODE_DYS/2;
+ dy -= NODE_DYS / 2;
/* set this for uifunc() that don't use layout engine yet */
node->butr.xmin = 0;
- node->butr.xmax = node->width - 2*NODE_DYS;
+ node->butr.xmax = node->width - 2 * NODE_DYS;
node->butr.ymin = 0;
node->butr.ymax = 0;
RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
- layout= uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
- locx+NODE_DYS, dy, node->butr.xmax, NODE_DY, UI_GetStyle());
+ layout = uiBlockLayout(node->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
+ locx + NODE_DYS, dy, node->butr.xmax, NODE_DY, UI_GetStyle());
uiLayoutSetContextPointer(layout, "node", &ptr);
node->typeinfo->uifunc(layout, (bContext *)C, &ptr);
@@ -397,35 +397,35 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
uiBlockEndAlign(node->block);
uiBlockLayoutResolve(node->block, NULL, &buty);
- dy= buty - NODE_DYS/2;
+ dy = buty - NODE_DYS / 2;
}
/* input sockets */
- for (nsock= node->inputs.first; nsock; nsock= nsock->next) {
+ for (nsock = node->inputs.first; nsock; nsock = nsock->next) {
if (!nodeSocketIsHidden(nsock)) {
- nsock->locx= locx;
- nsock->locy= dy - NODE_DYS;
- dy-= NODE_DY;
+ nsock->locx = locx;
+ nsock->locy = dy - NODE_DYS;
+ dy -= NODE_DY;
}
}
/* little bit space in end */
- if (node->inputs.first || (node->flag & (NODE_OPTIONS|NODE_PREVIEW))==0 )
- dy-= NODE_DYS/2;
+ if (node->inputs.first || (node->flag & (NODE_OPTIONS | NODE_PREVIEW)) == 0)
+ dy -= NODE_DYS / 2;
node->totr.xmin = locx;
node->totr.xmax = locx + node->width;
node->totr.ymax = locy;
- node->totr.ymin = MIN2(dy, locy-2*NODE_DY);
+ node->totr.ymin = MIN2(dy, locy - 2 * NODE_DY);
/* Set the block bounds to clip mouse events from underlying nodes.
* Add a margin for sockets on each side.
*/
uiExplicitBoundsBlock(node->block,
- node->totr.xmin - NODE_SOCKSIZE,
- node->totr.ymin,
- node->totr.xmax + NODE_SOCKSIZE,
- node->totr.ymax);
+ node->totr.xmin - NODE_SOCKSIZE,
+ node->totr.ymin,
+ node->totr.xmax + NODE_SOCKSIZE,
+ node->totr.ymax);
}
/* based on settings in node, sets drawing rect info. each redraw! */
@@ -433,49 +433,49 @@ static void node_update_hidden(bNode *node)
{
bNodeSocket *nsock;
float locx, locy;
- float rad, drad, hiddenrad= HIDDEN_RAD;
- int totin=0, totout=0, tot;
+ float rad, drad, hiddenrad = HIDDEN_RAD;
+ int totin = 0, totout = 0, tot;
/* get "global" coords */
nodeToView(node, 0.0f, 0.0f, &locx, &locy);
/* calculate minimal radius */
- for (nsock= node->inputs.first; nsock; nsock= nsock->next)
+ for (nsock = node->inputs.first; nsock; nsock = nsock->next)
if (!nodeSocketIsHidden(nsock))
totin++;
- for (nsock= node->outputs.first; nsock; nsock= nsock->next)
+ for (nsock = node->outputs.first; nsock; nsock = nsock->next)
if (!nodeSocketIsHidden(nsock))
totout++;
- tot= MAX2(totin, totout);
- if (tot>4) {
- hiddenrad += 5.0f*(float)(tot-4);
+ tot = MAX2(totin, totout);
+ if (tot > 4) {
+ hiddenrad += 5.0f * (float)(tot - 4);
}
node->totr.xmin = locx;
- node->totr.xmax = locx + 3*hiddenrad + node->miniwidth;
- node->totr.ymax = locy + (hiddenrad - 0.5f*NODE_DY);
- node->totr.ymin = node->totr.ymax - 2*hiddenrad;
+ node->totr.xmax = locx + 3 * hiddenrad + node->miniwidth;
+ node->totr.ymax = locy + (hiddenrad - 0.5f * NODE_DY);
+ node->totr.ymin = node->totr.ymax - 2 * hiddenrad;
/* output sockets */
- rad=drad= (float)M_PI/(1.0f + (float)totout);
+ rad = drad = (float)M_PI / (1.0f + (float)totout);
- for (nsock= node->outputs.first; nsock; nsock= nsock->next) {
+ for (nsock = node->outputs.first; nsock; nsock = nsock->next) {
if (!nodeSocketIsHidden(nsock)) {
- nsock->locx= node->totr.xmax - hiddenrad + (float)sin(rad)*hiddenrad;
- nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
- rad+= drad;
+ nsock->locx = node->totr.xmax - hiddenrad + (float)sin(rad) * hiddenrad;
+ nsock->locy = node->totr.ymin + hiddenrad + (float)cos(rad) * hiddenrad;
+ rad += drad;
}
}
/* input sockets */
- rad=drad= - (float)M_PI/(1.0f + (float)totin);
+ rad = drad = -(float)M_PI / (1.0f + (float)totin);
- for (nsock= node->inputs.first; nsock; nsock= nsock->next) {
+ for (nsock = node->inputs.first; nsock; nsock = nsock->next) {
if (!nodeSocketIsHidden(nsock)) {
- nsock->locx= node->totr.xmin + hiddenrad + (float)sin(rad)*hiddenrad;
- nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
- rad+= drad;
+ nsock->locx = node->totr.xmin + hiddenrad + (float)sin(rad) * hiddenrad;
+ nsock->locy = node->totr.ymin + hiddenrad + (float)cos(rad) * hiddenrad;
+ rad += drad;
}
}
@@ -483,10 +483,10 @@ static void node_update_hidden(bNode *node)
* Add a margin for sockets on each side.
*/
uiExplicitBoundsBlock(node->block,
- node->totr.xmin - NODE_SOCKSIZE,
- node->totr.ymin,
- node->totr.xmax + NODE_SOCKSIZE,
- node->totr.ymax);
+ node->totr.xmin - NODE_SOCKSIZE,
+ node->totr.ymin,
+ node->totr.xmax + NODE_SOCKSIZE,
+ node->totr.ymax);
}
void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)
@@ -509,19 +509,19 @@ int node_tweak_area_default(bNode *node, int x, int y)
int node_get_colorid(bNode *node)
{
- if (node->typeinfo->nclass==NODE_CLASS_INPUT)
+ if (node->typeinfo->nclass == NODE_CLASS_INPUT)
return TH_NODE_IN_OUT;
- if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ if (node->typeinfo->nclass == NODE_CLASS_OUTPUT) {
if (node->flag & NODE_DO_OUTPUT)
return TH_NODE_IN_OUT;
else
return TH_NODE;
}
- if (node->typeinfo->nclass==NODE_CLASS_CONVERTOR)
+ if (node->typeinfo->nclass == NODE_CLASS_CONVERTOR)
return TH_NODE_CONVERTOR;
if (ELEM3(node->typeinfo->nclass, NODE_CLASS_OP_COLOR, NODE_CLASS_OP_VECTOR, NODE_CLASS_OP_FILTER))
return TH_NODE_OPERATOR;
- if (node->typeinfo->nclass==NODE_CLASS_GROUP)
+ if (node->typeinfo->nclass == NODE_CLASS_GROUP)
return TH_NODE_GROUP;
return TH_NODE;
}
@@ -563,7 +563,7 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
-0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
};
/* 16 values of cos function */
- static float co[16] ={
+ static float co[16] = {
1.00000000f, 0.91895781f, 0.68896691f, 0.34730525f,
-0.05064916f, -0.44039415f, -0.75875812f, -0.95413925f,
-0.99486932f, -0.87434661f, -0.61210598f, -0.25065253f,
@@ -574,8 +574,8 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
glColor3ub(col[0], col[1], col[2]);
glBegin(GL_POLYGON);
- for (a=0; a<16; a++)
- glVertex2f(x+size*si[a], y+size*co[a]);
+ for (a = 0; a < 16; a++)
+ glVertex2f(x + size * si[a], y + size * co[a]);
glEnd();
if (highlight) {
@@ -588,8 +588,8 @@ static void node_circle_draw(float x, float y, float size, char *col, int highli
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINE_LOOP);
- for (a=0; a<16; a++)
- glVertex2f(x+size*si[a], y+size*co[a]);
+ for (a = 0; a < 16; a++)
+ glVertex2f(x + size * si[a], y + size * co[a]);
glEnd();
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
@@ -607,9 +607,9 @@ void node_socket_circle_draw(bNodeTree *UNUSED(ntree), bNodeSocket *sock, float
/* not a callback */
static void node_draw_preview(bNodePreview *preview, rctf *prv)
{
- float xscale= (prv->xmax-prv->xmin)/((float)preview->xsize);
- float yscale= (prv->ymax-prv->ymin)/((float)preview->ysize);
- float tile= (prv->xmax - prv->xmin) / 10.0f;
+ float xscale = (prv->xmax - prv->xmin) / ((float)preview->xsize);
+ float yscale = (prv->ymax - prv->ymin) / ((float)preview->ysize);
+ float tile = (prv->xmax - prv->xmin) / 10.0f;
float x, y;
/* draw checkerboard backdrop to show alpha */
@@ -617,26 +617,26 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
glRectf(prv->xmin, prv->ymin, prv->xmax, prv->ymax);
glColor3ub(160, 160, 160);
- for (y=prv->ymin; y<prv->ymax; y+=tile*2) {
- for (x=prv->xmin; x<prv->xmax; x+=tile*2) {
- float tilex= tile, tiley= tile;
+ for (y = prv->ymin; y < prv->ymax; y += tile * 2) {
+ for (x = prv->xmin; x < prv->xmax; x += tile * 2) {
+ float tilex = tile, tiley = tile;
- if (x+tile > prv->xmax)
- tilex= prv->xmax-x;
- if (y+tile > prv->ymax)
- tiley= prv->ymax-y;
+ if (x + tile > prv->xmax)
+ tilex = prv->xmax - x;
+ if (y + tile > prv->ymax)
+ tiley = prv->ymax - y;
glRectf(x, y, x + tilex, y + tiley);
}
}
- for (y=prv->ymin+tile; y<prv->ymax; y+=tile*2) {
- for (x=prv->xmin+tile; x<prv->xmax; x+=tile*2) {
- float tilex= tile, tiley= tile;
+ for (y = prv->ymin + tile; y < prv->ymax; y += tile * 2) {
+ for (x = prv->xmin + tile; x < prv->xmax; x += tile * 2) {
+ float tilex = tile, tiley = tile;
- if (x+tile > prv->xmax)
- tilex= prv->xmax-x;
- if (y+tile > prv->ymax)
- tiley= prv->ymax-y;
+ if (x + tile > prv->xmax)
+ tilex = prv->xmax - x;
+ if (y + tile > prv->ymax)
+ tiley = prv->ymax - y;
glRectf(x, y, x + tilex, y + tiley);
}
@@ -661,7 +661,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
/* common handle function for operator buttons that need to select the node first */
static void node_toggle_button_cb(struct bContext *C, void *node_argv, void *op_argv)
{
- bNode *node = (bNode*)node_argv;
+ bNode *node = (bNode *)node_argv;
const char *opname = (const char *)op_argv;
/* select & activate only the button's node */
@@ -675,15 +675,15 @@ void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
rctf *rct = &node->totr;
uiSetRoundBox(UI_CNR_ALL);
- if (node->parent==NULL)
+ if (node->parent == NULL)
ui_dropshadow(rct, radius, snode->aspect, alpha, node->flag & SELECT);
else {
const float margin = 3.0f;
glColor4f(0.0f, 0.0f, 0.0f, 0.33f);
glEnable(GL_BLEND);
- uiRoundBox(rct->xmin-margin, rct->ymin-margin,
- rct->xmax+margin, rct->ymax+margin, radius+margin);
+ uiRoundBox(rct->xmin - margin, rct->ymin - margin,
+ rct->xmax + margin, rct->ymax + margin, radius + margin);
glDisable(GL_BLEND);
}
}
@@ -691,24 +691,24 @@ void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
- rctf *rct= &node->totr;
+ rctf *rct = &node->totr;
float iconofs;
/* float socket_size= NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */
- float iconbutw= 0.8f*UI_UNIT_X;
- int color_id= node_get_colorid(node);
+ float iconbutw = 0.8f * UI_UNIT_X;
+ int color_id = node_get_colorid(node);
char showname[128]; /* 128 used below */
View2D *v2d = &ar->v2d;
/* hurmf... another candidate for callback, have to see how this works first */
- if (node->id && node->block && snode->treetype==NTREE_SHADER)
+ if (node->id && node->block && snode->treetype == NTREE_SHADER)
nodeShaderSynchronizeID(node, 0);
/* skip if out of view */
if (node->totr.xmax < ar->v2d.cur.xmin || node->totr.xmin > ar->v2d.cur.xmax ||
- node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax) {
-
+ node->totr.ymax < ar->v2d.cur.ymin || node->totr.ymin > ar->v2d.cur.ymax)
+ {
uiEndBlock(C, node->block);
- node->block= NULL;
+ node->block = NULL;
return;
}
@@ -716,7 +716,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node_draw_shadow(snode, node, BASIS_RAD, 1.0f);
/* header */
- if (color_id==TH_NODE)
+ if (color_id == TH_NODE)
UI_ThemeColorShade(color_id, -20);
else
UI_ThemeColor(color_id);
@@ -724,26 +724,26 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
- if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) {
+ if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
if (node->highlight) {
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
node->highlight = 0;
}
}
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
- uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
+ uiRoundBox(rct->xmin, rct->ymax - NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
/* show/hide icons */
- iconofs= rct->xmax - 7.0f;
+ iconofs = rct->xmax - 7.0f;
/* preview */
if (node->typeinfo->flag & NODE_PREVIEW) {
uiBut *but;
- iconofs-=iconbutw;
+ iconofs -= iconbutw;
uiBlockSetEmboss(node->block, UI_EMBOSSN);
but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_MATERIAL,
- iconofs, rct->ymax-NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_preview_toggle");
+ iconofs, rct->ymax - NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_preview_toggle");
/* XXX this does not work when node is activated and the operator called right afterwards,
* since active ID is not updated yet (needs to process the notifier).
* This can only work as visual indicator!
@@ -755,11 +755,11 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* group edit */
if (node->type == NODE_GROUP) {
uiBut *but;
- iconofs-=iconbutw;
+ iconofs -= iconbutw;
uiBlockSetEmboss(node->block, UI_EMBOSSN);
but = uiDefIconBut(node->block, TOGBUT, B_REDR, ICON_NODETREE,
- iconofs, rct->ymax-NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_group_edit");
+ iconofs, rct->ymax - NODE_DY, iconbutw, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_group_edit");
uiBlockSetEmboss(node->block, UI_EMBOSS);
}
@@ -772,16 +772,16 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* open/close entirely? */
{
uiBut *but;
- int but_size = UI_UNIT_X *0.6f;
+ int but_size = UI_UNIT_X * 0.6f;
/* XXX button uses a custom triangle draw below, so make it invisible without icon */
uiBlockSetEmboss(node->block, UI_EMBOSSN);
but = uiDefBut(node->block, TOGBUT, B_REDR, "",
- rct->xmin+10.0f-but_size/2, rct->ymax-NODE_DY/2.0f-but_size/2, but_size, but_size, NULL, 0, 0, 0, 0, "");
- uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_hide_toggle");
+ rct->xmin + 10.0f - but_size / 2, rct->ymax - NODE_DY / 2.0f - but_size / 2, but_size, but_size, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle");
uiBlockSetEmboss(node->block, UI_EMBOSS);
/* custom draw function for this button */
- UI_DrawTriIcon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v');
+ UI_DrawTriIcon(rct->xmin + 10.0f, rct->ymax - NODE_DY / 2.0f, 'v');
}
/* this isn't doing anything for the label, so commenting out */
@@ -809,11 +809,11 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColor4(TH_NODE);
glEnable(GL_BLEND);
uiSetRoundBox(UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT);
- uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax-NODE_DY, BASIS_RAD);
+ uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax - NODE_DY, BASIS_RAD);
glDisable(GL_BLEND);
/* outline active and selected emphasis */
- if ( node->flag & (NODE_ACTIVE|SELECT)) {
+ if (node->flag & (NODE_ACTIVE | SELECT)) {
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -834,25 +834,25 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
/* socket inputs, buttons */
- for (sock= node->inputs.first; sock; sock= sock->next) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
if (nodeSocketIsHidden(sock))
continue;
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
node->typeinfo->drawinputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
- sock->locx + (NODE_DYS / snode->aspect_sqrt), sock->locy-NODE_DYS, node->width-NODE_DY);
+ sock->locx + (NODE_DYS / snode->aspect_sqrt), sock->locy - NODE_DYS, node->width - NODE_DY);
}
/* socket outputs */
- for (sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock = node->outputs.first; sock; sock = sock->next) {
if (nodeSocketIsHidden(sock))
continue;
node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE, sock->flag & SELECT);
node->typeinfo->drawoutputfunc(C, node->block, ntree, node, sock, IFACE_(sock->name),
- sock->locx - node->width + (NODE_DYS / snode->aspect_sqrt), sock->locy-NODE_DYS, node->width-NODE_DY);
+ sock->locx - node->width + (NODE_DYS / snode->aspect_sqrt), sock->locy - NODE_DYS, node->width - NODE_DY);
}
/* preview */
@@ -867,18 +867,18 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiEndBlock(C, node->block);
uiDrawBlock(C, node->block);
- node->block= NULL;
+ node->block = NULL;
}
static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
- rctf *rct= &node->totr;
- float dx, centy= 0.5f*(rct->ymax+rct->ymin);
- float hiddenrad= 0.5f*(rct->ymax-rct->ymin);
- float socket_size= NODE_SOCKSIZE*U.dpi/72;
- int color_id= node_get_colorid(node);
- char showname[128]; /* 128 is used below */
+ rctf *rct = &node->totr;
+ float dx, centy = 0.5f * (rct->ymax + rct->ymin);
+ float hiddenrad = 0.5f * (rct->ymax - rct->ymin);
+ float socket_size = NODE_SOCKSIZE * U.dpi / 72;
+ int color_id = node_get_colorid(node);
+ char showname[128]; /* 128 is used below */
/* shadow */
node_draw_shadow(snode, node, hiddenrad, 1.0f);
@@ -888,7 +888,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
- if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) {
+ if (ntree->type == NTREE_COMPOSIT && (snode->flag & SNODE_SHOW_HIGHLIGHT)) {
if (node->highlight) {
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
node->highlight = 0;
@@ -898,7 +898,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
/* outline active and selected emphasis */
- if ( node->flag & (NODE_ACTIVE|SELECT)) {
+ if (node->flag & (NODE_ACTIVE | SELECT)) {
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -921,16 +921,16 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* open entirely icon */
{
uiBut *but;
- int but_size = UI_UNIT_X *0.6f;
+ int but_size = UI_UNIT_X * 0.6f;
/* XXX button uses a custom triangle draw below, so make it invisible without icon */
uiBlockSetEmboss(node->block, UI_EMBOSSN);
but = uiDefBut(node->block, TOGBUT, B_REDR, "",
- rct->xmin+10.0f-but_size/2, centy-but_size/2, but_size, but_size, NULL, 0, 0, 0, 0, "");
- uiButSetFunc(but, node_toggle_button_cb, node, (void*)"NODE_OT_hide_toggle");
+ rct->xmin + 10.0f - but_size / 2, centy - but_size / 2, but_size, but_size, NULL, 0, 0, 0, 0, "");
+ uiButSetFunc(but, node_toggle_button_cb, node, (void *)"NODE_OT_hide_toggle");
uiBlockSetEmboss(node->block, UI_EMBOSS);
/* custom draw function for this button */
- UI_DrawTriIcon(rct->xmin+10.0f, centy, 'h');
+ UI_DrawTriIcon(rct->xmin + 10.0f, centy, 'h');
}
/* disable lines */
@@ -942,7 +942,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
else
UI_ThemeColor(TH_TEXT);
- if (node->miniwidth>0.0f) {
+ if (node->miniwidth > 0.0f) {
BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
//if (node->flag & NODE_MUTED)
@@ -950,44 +950,44 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
uiDefBut(node->block, LABEL, 0, showname,
(int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10),
- (short)(rct->xmax - rct->xmin-18.0f -12.0f), (short)NODE_DY,
+ (short)(rct->xmax - rct->xmin - 18.0f - 12.0f), (short)NODE_DY,
NULL, 0, 0, 0, 0, "");
}
/* scale widget thing */
- UI_ThemeColorShade(color_id, -10);
- dx= 10.0f;
- fdrawline(rct->xmax-dx, centy-4.0f, rct->xmax-dx, centy+4.0f);
- fdrawline(rct->xmax-dx-3.0f*snode->aspect, centy-4.0f, rct->xmax-dx-3.0f*snode->aspect, centy+4.0f);
+ UI_ThemeColorShade(color_id, -10);
+ dx = 10.0f;
+ fdrawline(rct->xmax - dx, centy - 4.0f, rct->xmax - dx, centy + 4.0f);
+ fdrawline(rct->xmax - dx - 3.0f * snode->aspect, centy - 4.0f, rct->xmax - dx - 3.0f * snode->aspect, centy + 4.0f);
UI_ThemeColorShade(color_id, +30);
- dx-= snode->aspect;
- fdrawline(rct->xmax-dx, centy-4.0f, rct->xmax-dx, centy+4.0f);
- fdrawline(rct->xmax-dx-3.0f*snode->aspect, centy-4.0f, rct->xmax-dx-3.0f*snode->aspect, centy+4.0f);
+ dx -= snode->aspect;
+ fdrawline(rct->xmax - dx, centy - 4.0f, rct->xmax - dx, centy + 4.0f);
+ fdrawline(rct->xmax - dx - 3.0f * snode->aspect, centy - 4.0f, rct->xmax - dx - 3.0f * snode->aspect, centy + 4.0f);
/* sockets */
- for (sock= node->inputs.first; sock; sock= sock->next) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock))
node_socket_circle_draw(snode->nodetree, sock, socket_size, sock->flag & SELECT);
}
- for (sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock = node->outputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock))
node_socket_circle_draw(snode->nodetree, sock, socket_size, sock->flag & SELECT);
}
uiEndBlock(C, node->block);
uiDrawBlock(C, node->block);
- node->block= NULL;
+ node->block = NULL;
}
int node_get_resize_cursor(int directions)
{
- if (directions==0)
+ if (directions == 0)
return CURSOR_STD;
- else if ((directions & ~(NODE_RESIZE_TOP|NODE_RESIZE_BOTTOM))==0)
+ else if ((directions & ~(NODE_RESIZE_TOP | NODE_RESIZE_BOTTOM)) == 0)
return CURSOR_Y_MOVE;
- else if ((directions & ~(NODE_RESIZE_RIGHT|NODE_RESIZE_LEFT))==0)
+ else if ((directions & ~(NODE_RESIZE_RIGHT | NODE_RESIZE_LEFT)) == 0)
return CURSOR_X_MOVE;
else
return CURSOR_EDIT;
@@ -1001,14 +1001,14 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode)
int cursor = CURSOR_STD;
if (ntree) {
- if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN|SOCK_OUT)) {
+ if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN | SOCK_OUT)) {
/* pass */
}
else {
/* check nodes front to back */
- for (node=ntree->nodes.last; node; node=node->prev) {
+ for (node = ntree->nodes.last; node; node = node->prev) {
if (BLI_in_rctf(&node->totr, snode->mx, snode->my))
- break; /* first hit on node stops */
+ break; /* first hit on node stops */
}
if (node) {
int dir = node->typeinfo->resize_area_func(node, snode->mx, snode->my);
@@ -1039,7 +1039,7 @@ void node_update_nodetree(const bContext *C, bNodeTree *ntree, float offsetx, fl
bNode *node;
/* update nodes front to back, so children sizes get updated before parents */
- for (node= ntree->nodes.last; node; node= node->prev) {
+ for (node = ntree->nodes.last; node; node = node->prev) {
/* XXX little hack */
node->locx += offsetx;
node->locy += offsety;
@@ -1063,29 +1063,29 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
bNodeLink *link;
int a;
- if (ntree==NULL) return; /* groups... */
+ if (ntree == NULL) return; /* groups... */
/* draw background nodes, last nodes in front */
- for (a=0, node= ntree->nodes.first; node; node=node->next, a++) {
+ for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
if (!(node->flag & NODE_BACKGROUND))
continue;
- node->nr= a; /* index of node in list, used for exec event code */
+ node->nr = a; /* index of node in list, used for exec event code */
node_draw(C, ar, snode, ntree, node);
}
/* node lines */
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
- for (link= ntree->links.first; link; link= link->next)
+ for (link = ntree->links.first; link; link = link->next)
node_draw_link(&ar->v2d, snode, link);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
/* draw foreground nodes, last nodes in front */
- for (a=0, node= ntree->nodes.first; node; node=node->next, a++) {
+ for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
if (node->flag & NODE_BACKGROUND)
continue;
- node->nr= a; /* index of node in list, used for exec event code */
+ node->nr = a; /* index of node in list, used for exec event code */
node_draw(C, ar, snode, ntree, node);
}
}
@@ -1093,8 +1093,8 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
{
View2DScrollers *scrollers;
- SpaceNode *snode= CTX_wm_space_node(C);
- Scene *scene= CTX_data_scene(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ Scene *scene = CTX_data_scene(C);
int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
bNodeLinkDrag *nldrag;
LinkData *linkdata;
@@ -1134,7 +1134,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
/* uiBlocks must be initialized in drawing order for correct event clipping.
* Node group internal blocks added after the main group block.
*/
- for (node= snode->nodetree->nodes.first; node; node= node->next) {
+ for (node = snode->nodetree->nodes.first; node; node = node->next) {
if (node->flag & NODE_GROUP_EDIT)
node_uiblocks_init(C, (bNodeTree *)node->id);
}
@@ -1144,7 +1144,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
#if 0
/* active group */
- for (node= snode->nodetree->nodes.first; node; node= node->next) {
+ for (node = snode->nodetree->nodes.first; node; node = node->next) {
if (node->flag & NODE_GROUP_EDIT)
node_draw_group(C, ar, snode, snode->nodetree, node);
}
@@ -1154,9 +1154,10 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
/* temporary links */
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
- for (nldrag= snode->linkdrag.first; nldrag; nldrag= nldrag->next) {
- for (linkdata=nldrag->links.first; linkdata; linkdata=linkdata->next)
+ for (nldrag = snode->linkdrag.first; nldrag; nldrag = nldrag->next) {
+ for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
node_draw_link(&ar->v2d, snode, (bNodeLink *)linkdata->data);
+ }
}
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
@@ -1175,7 +1176,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
draw_gpencil_view2d(C, 0);
/* scrollers */
- scrollers= UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ scrollers = UI_view2d_scrollers_calc(C, v2d, 10, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}