[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48777] trunk/blender/source/blender/ editors/space_node: style cleanup: line length, also comment some unused code

Campbell Barton ideasman42 at gmail.com
Tue Jul 10 01:07:16 CEST 2012


Revision: 48777
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48777
Author:   campbellbarton
Date:     2012-07-09 23:07:15 +0000 (Mon, 09 Jul 2012)
Log Message:
-----------
style cleanup: line length, also comment some unused code

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/editors/space_node/node_draw.c
    trunk/blender/source/blender/editors/space_node/node_intern.h

Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c	2012-07-09 22:57:23 UTC (rev 48776)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c	2012-07-09 23:07:15 UTC (rev 48777)
@@ -82,7 +82,7 @@
 
 #include "node_intern.h"
 
-// XXX interface.h
+/* XXX interface.h */
 extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
 
 /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
@@ -140,7 +140,8 @@
 	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()), FALSE);
+	layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
+	                                      args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), FALSE);
 	
 	uiItemR(layout, &args->ptr, "default_value", UI_ITEM_R_EXPAND, "", ICON_NONE);
 	
@@ -344,7 +345,7 @@
 	uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
 }
 
-static float _sample_col[4];    // bad bad, 2.5 will do better?
+static float _sample_col[4];  /* bad bad, 2.5 will do better?... no it won't... */
 #define SAMPLE_FLT_ISNONE FLT_MAX
 void ED_node_sample_set(const float col[4])
 {
@@ -396,7 +397,7 @@
 	               nor, 0.0f, 1.0f, 0, 0, "");
 	uiButSetFunc(bt, node_normal_cb, ntree, node);
 }
-#if 0 // not used in 2.5x yet
+#if 0 /* not used in 2.5x yet */
 static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
 {
 	Main *bmain = CTX_data_main(C);
@@ -649,7 +650,8 @@
 	ntreeUpdateTree(ngroup);
 }
 
-static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *sock, int in_out, float xoffset, float yoffset)
+static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *sock,
+                                   int in_out, float xoffset, float yoffset)
 {
 	bNodeTree *ngroup = (bNodeTree *)gnode->id;
 	uiBut *bt;
@@ -671,7 +673,8 @@
 	}
 }
 
-static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode, bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out)
+static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode,
+                              bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out)
 {
 	bNodeTree *ngroup = (bNodeTree *)gnode->id;
 	bNodeSocketType *stype = ntreeGetSocketType(gsock ? gsock->type : sock->type);
@@ -721,12 +724,14 @@
 		if (gsock) {
 			draw_group_socket_name(snode, gnode, gsock, in_out, offset, 0);
 			if (stype->buttonfunc)
-				stype->buttonfunc(C, gnode->block, ngroup, NULL, gsock, "", gsock->locx + offset, gsock->locy - NODE_DY, colw);
+				stype->buttonfunc(C, gnode->block, ngroup, NULL, gsock, "",
+				                  gsock->locx + offset, gsock->locy - NODE_DY, colw);
 		}
 		else {
 			draw_group_socket_name(snode, gnode, sock, in_out, offset, 0);
 			if (stype->buttonfunc)
-				stype->buttonfunc(C, gnode->block, ngroup, NULL, sock, "", sock->locx + offset, sock->locy - NODE_DY, colw);
+				stype->buttonfunc(C, gnode->block, ngroup, NULL, sock, "",
+				                  sock->locx + offset, sock->locy - NODE_DY, colw);
 		}
 	}
 	else {
@@ -789,7 +794,9 @@
 		glEnable(GL_BLEND);
 		uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
 		UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70);
-		uiDrawBox(GL_POLYGON, rect.xmin - node_group_frame, rect.ymax, rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
+		uiDrawBox(GL_POLYGON,
+		          rect.xmin - node_group_frame, rect.ymax,
+		          rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
 		
 		/* backdrop body */
 		UI_ThemeColorShadeAlpha(TH_BACK, -8, -70);
@@ -824,7 +831,9 @@
 		uiSetRoundBox(UI_CNR_ALL);
 		glColor4ub(200, 200, 200, 140);
 		glEnable(GL_LINE_SMOOTH);
-		uiDrawBox(GL_LINE_LOOP, rect.xmin - node_group_frame, rect.ymin, rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
+		uiDrawBox(GL_LINE_LOOP,
+		          rect.xmin - node_group_frame, rect.ymin,
+		          rect.xmax + node_group_frame, rect.ymax + group_header, BASIS_RAD);
 		glDisable(GL_LINE_SMOOTH);
 		glDisable(GL_BLEND);
 		
@@ -994,7 +1003,7 @@
 	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 ||
@@ -1028,7 +1037,9 @@
 		else
 			UI_ThemeColorShadeAlpha(TH_SELECT, 0, -40);
 		uiSetRoundBox(UI_CNR_ALL);
-		uiDrawBox(GL_LINE_LOOP, rct->xmin, rct->ymin, rct->xmax, rct->ymax, BASIS_RAD);
+		uiDrawBox(GL_LINE_LOOP,
+		          rct->xmin, rct->ymin,
+		          rct->xmax, rct->ymax, BASIS_RAD);
 		
 		glDisable(GL_LINE_SMOOTH);
 		glDisable(GL_BLEND);
@@ -1074,7 +1085,7 @@
 }
 
 
-#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 +1097,36 @@
 	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;
+	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;
+#endif
+	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 +1145,12 @@
 	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 +1160,13 @@
 	/* 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 +1175,12 @@
 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,16 +1208,17 @@
 			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;
 	}
 }
 
 /* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
 
-static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr)
+static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr,
+                                 PointerRNA *imaptr, PointerRNA *iuserptr)
 {
 	uiLayout *col;
 	int source;
@@ -1950,7 +1962,8 @@
 			imfptr = RNA_pointer_get(&inputptr, "format");
 		
 		imtype_prop = RNA_struct_find_property(&imfptr, "file_format");
-		RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name);
+		RNA_property_enum_name((bContext *)C, &imfptr, imtype_prop,
+		                       RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name);
 		uiBlockSetEmboss(block, UI_EMBOSSP);
 		uiItemL(row, imtype_name, 0);
 		uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -1988,19 +2001,23 @@
 	/* using different collection properties if multilayer format is enabled */
 	if (multilayer) {
 		uiTemplateList(layout, C, ptr, "layer_slots", ptr, "active_input_index", NULL, 0, 0, 0);
-		RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"), active_index, &active_input_ptr);
+		RNA_property_collection_lookup_int(ptr, RNA_struct_find_property(ptr, "layer_slots"),
+		                                   active_index, &active_input_ptr);
 	}
 	else {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list