[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47091] trunk/blender/source: style cleanup: draw node
Campbell Barton
ideasman42 at gmail.com
Sun May 27 21:38:10 CEST 2012
Revision: 47091
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47091
Author: campbellbarton
Date: 2012-05-27 19:38:10 +0000 (Sun, 27 May 2012)
Log Message:
-----------
style cleanup: draw node
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_node/drawnode.c
trunk/blender/source/tools/uncrustify.cfg
Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c 2012-05-27 19:31:35 UTC (rev 47090)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c 2012-05-27 19:38:10 UTC (rev 47091)
@@ -88,24 +88,24 @@
static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v)
{
- SpaceNode *snode= snode_v;
+ SpaceNode *snode = snode_v;
- if (snode->treetype==NTREE_SHADER) {
+ if (snode->treetype == NTREE_SHADER) {
nodeShaderSynchronizeID(node_v, 1);
// allqueue(REDRAWBUTSSHADING, 0);
}
}
static void node_socket_button_label(const bContext *UNUSED(C), uiBlock *block,
- bNodeTree *UNUSED(ntree), bNode *UNUSED(node), bNodeSocket *sock,
- const char *UNUSED(name), int x, int y, int width)
+ bNodeTree *UNUSED(ntree), bNode *UNUSED(node), bNodeSocket *sock,
+ const char *UNUSED(name), int x, int y, int width)
{
uiDefBut(block, LABEL, 0, sock->name, x, y, width, NODE_DY, NULL, 0, 0, 0, 0, "");
}
static void node_socket_button_default(const bContext *C, uiBlock *block,
- bNodeTree *ntree, bNode *node, bNodeSocket *sock,
- const char *name, int x, int y, int width)
+ bNodeTree *ntree, bNode *node, bNodeSocket *sock,
+ const char *name, int x, int y, int width)
{
if (sock->link || (sock->flag & SOCK_HIDE_VALUE))
node_socket_button_label(C, block, ntree, node, sock, name, x, y, width);
@@ -116,8 +116,8 @@
RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
bt = uiDefButR(block, NUM, B_NODE_EXEC, name,
- x, y+1, width, NODE_DY-2,
- &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
+ x, y + 1, width, NODE_DY - 2,
+ &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
if (node)
uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
}
@@ -132,22 +132,22 @@
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v)
{
- SocketComponentMenuArgs *args= (SocketComponentMenuArgs*)args_v;
+ SocketComponentMenuArgs *args = (SocketComponentMenuArgs *)args_v;
uiBlock *block;
uiLayout *layout;
- block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+ block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
- layout= uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y+2, args->width, NODE_DY, UI_GetStyle()), 0);
+ layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), 0);
uiItemR(layout, &args->ptr, "default_value", UI_ITEM_R_EXPAND, "", ICON_NONE);
return block;
}
static void node_socket_button_components(const bContext *C, uiBlock *block,
- bNodeTree *ntree, bNode *node, bNodeSocket *sock,
- const char *name, int x, int y, int width)
+ bNodeTree *ntree, bNode *node, bNodeSocket *sock,
+ const char *name, int x, int y, int width)
{
if (sock->link || (sock->flag & SOCK_HIDE_VALUE))
node_socket_button_label(C, block, ntree, node, sock, name, x, y, width);
@@ -157,7 +157,7 @@
RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
- args= MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs");
+ args = MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs");
args->ptr = ptr;
args->x = x;
@@ -167,37 +167,37 @@
args->arg1 = CTX_wm_space_node(C);
args->arg2 = node;
- uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, "");
+ uiDefBlockButN(block, socket_component_menu, args, name, x, y + 1, width, NODE_DY - 2, "");
}
}
static void node_socket_button_color(const bContext *C, uiBlock *block,
- bNodeTree *ntree, bNode *node, bNodeSocket *sock,
- const char *name, int x, int y, int width)
+ bNodeTree *ntree, bNode *node, bNodeSocket *sock,
+ const char *name, int x, int y, int width)
{
if (sock->link || (sock->flag & SOCK_HIDE_VALUE))
node_socket_button_label(C, block, ntree, node, sock, name, x, y, width);
else {
PointerRNA ptr;
uiBut *bt;
- int labelw= width - 40;
+ int labelw = width - 40;
RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
- bt=uiDefButR(block, COL, B_NODE_EXEC, "",
- x, y+2, (labelw>0 ? 40 : width), NODE_DY-2,
- &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
+ bt = uiDefButR(block, COL, B_NODE_EXEC, "",
+ x, y + 2, (labelw > 0 ? 40 : width), NODE_DY - 2,
+ &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
if (node)
uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
- if (name[0]!='\0' && labelw>0)
- uiDefBut(block, LABEL, 0, name, x + 40, y+2, labelw, NODE_DY-2, NULL, 0, 0, 0, 0, "");
+ if (name[0] != '\0' && labelw > 0)
+ uiDefBut(block, LABEL, 0, name, x + 40, y + 2, labelw, NODE_DY - 2, NULL, 0, 0, 0, 0, "");
}
}
/* standard draw function, display the default input value */
static void node_draw_input_default(const bContext *C, uiBlock *block,
- bNodeTree *ntree, bNode *node, bNodeSocket *sock,
- const char *name, int x, int y, int width)
+ bNodeTree *ntree, bNode *node, bNodeSocket *sock,
+ const char *name, int x, int y, int width)
{
bNodeSocketType *stype = ntreeGetSocketType(sock->type);
if (stype->buttonfunc)
@@ -214,13 +214,13 @@
float slen;
int ofs = 0;
UI_ThemeColor(TH_TEXT);
- slen= snode->aspect*UI_GetStringWidth(name);
+ slen = snode->aspect * UI_GetStringWidth(name);
while (slen > node->width) {
ofs++;
- slen= snode->aspect*UI_GetStringWidth(name+ofs);
+ slen = snode->aspect * UI_GetStringWidth(name + ofs);
}
- uiDefBut(block, LABEL, 0, name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f),
- (short)(node->width-NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, name + ofs, (short)(sock->locx - 15.0f - slen), (short)(sock->locy - 9.0f),
+ (short)(node->width - NODE_DY), NODE_DY, NULL, 0, 0, 0, 0, "");
}
/* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */
@@ -228,37 +228,37 @@
#if 0 /* UNUSED */
static void node_draw_socket_new(bNodeSocket *sock, float size)
{
- float x=sock->locx, y=sock->locy;
+ float x = sock->locx, y = sock->locy;
/* 16 values of sin function */
static float si[16] = {
- 0.00000000f, 0.39435585f, 0.72479278f,0.93775213f,
- 0.99871650f,0.89780453f,0.65137248f,0.29936312f,
- -0.10116832f,-0.48530196f,-0.79077573f,-0.96807711f,
- -0.98846832f,-0.84864425f,-0.57126821f,-0.20129852f
+ 0.00000000f, 0.39435585f, 0.72479278f, 0.93775213f,
+ 0.99871650f, 0.89780453f, 0.65137248f, 0.29936312f,
+ -0.10116832f, -0.48530196f, -0.79077573f, -0.96807711f,
+ -0.98846832f, -0.84864425f, -0.57126821f, -0.20129852f
};
/* 16 values of cos function */
- 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,
- 0.15142777f,0.52896401f,0.82076344f,0.97952994f,
+ 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,
+ 0.15142777f, 0.52896401f, 0.82076344f, 0.97952994f,
};
int a;
glColor3ub(180, 180, 180);
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();
glColor4ub(0, 0, 0, 150);
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);
@@ -298,9 +298,9 @@
{
uiLayout *row;
- bNodeTree *ntree= (bNodeTree*)ptr->id.data;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- row= uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, 1);
uiItemR(row, ptr, "blend_type", 0, "", ICON_NONE);
if (ntree->type == NTREE_COMPOSIT)
uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA);
@@ -311,19 +311,19 @@
uiLayout *row;
#if 0
/* XXX no context access here .. */
- bNode *node= ptr->data;
- CurveMapping *cumap= node->storage;
+ bNode *node = ptr->data;
+ CurveMapping *cumap = node->storage;
if (cumap) {
cumap->flag |= CUMA_DRAW_CFRA;
- if (node->custom1<node->custom2)
- cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
+ if (node->custom1 < node->custom2)
+ cumap->sample[0] = (float)(CFRA - node->custom1) / (float)(node->custom2 - node->custom1);
}
#endif
uiTemplateCurveMapping(layout, ptr, "curve", 's', 0, 0);
- row= uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, 1);
uiItemR(row, ptr, "frame_start", 0, "Sta", ICON_NONE);
uiItemR(row, ptr, "frame_end", 0, "End", ICON_NONE);
}
@@ -338,18 +338,18 @@
uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
}
-static float *_sample_col= NULL; // bad bad, 2.5 will do better?
+static float *_sample_col = NULL; // bad bad, 2.5 will do better?
#if 0
static void node_curvemap_sample(float *col)
{
- _sample_col= col;
+ _sample_col = col;
}
#endif
static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
- bNode *node= ptr->data;
- CurveMapping *cumap= node->storage;
+ bNode *node = ptr->data;
+ CurveMapping *cumap = node->storage;
if (_sample_col) {
cumap->flag |= CUMA_DRAW_SAMPLE;
@@ -366,79 +366,79 @@
Main *bmain = CTX_data_main(C);
ED_node_generic_update(bmain, ntree_v, node_v);
- WM_event_add_notifier(C, NC_NODE|NA_EDITED, ntree_v);
+ WM_event_add_notifier(C, NC_NODE | NA_EDITED, ntree_v);
}
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list