[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46020] trunk/blender/source/blender/nodes /composite/nodes: Style cleanup in own compositor nodes

Sergey Sharybin sergey.vfx at gmail.com
Sat Apr 28 10:43:24 CEST 2012


Revision: 46020
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46020
Author:   nazgul
Date:     2012-04-28 08:43:24 +0000 (Sat, 28 Apr 2012)
Log Message:
-----------
Style cleanup in own compositor nodes

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_movieclip.c
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_transform.c

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_movieclip.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_movieclip.c	2012-04-28 08:32:00 UTC (rev 46019)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_movieclip.c	2012-04-28 08:43:24 UTC (rev 46020)
@@ -33,7 +33,7 @@
 
 #include "node_composite_util.h"
 
-static bNodeSocketTemplate cmp_node_movieclip_out[]= {
+static bNodeSocketTemplate cmp_node_movieclip_out[] = {
 	{	SOCK_RGBA,		0,	"Image"},
 	{	SOCK_FLOAT,		1,	"Offset X"},
 	{	SOCK_FLOAT,		1,	"Offset Y"},
@@ -49,50 +49,50 @@
 	int type;
 
 	float *rect;
-	int alloc= FALSE;
+	int alloc = FALSE;
 
-	orig_ibuf= BKE_movieclip_get_ibuf(clip, user);
+	orig_ibuf = BKE_movieclip_get_ibuf(clip, user);
 
-	if (orig_ibuf==NULL || (orig_ibuf->rect==NULL && orig_ibuf->rect_float==NULL)) {
+	if (orig_ibuf == NULL || (orig_ibuf->rect == NULL && orig_ibuf->rect_float == NULL)) {
 		IMB_freeImBuf(orig_ibuf);
 		return NULL;
 	}
 
-	ibuf= IMB_dupImBuf(orig_ibuf);
+	ibuf = IMB_dupImBuf(orig_ibuf);
 	IMB_freeImBuf(orig_ibuf);
 
-	if (ibuf->rect_float == NULL || ibuf->userflags&IB_RECT_INVALID) {
+	if (ibuf->rect_float == NULL || (ibuf->userflags & IB_RECT_INVALID)) {
 		IMB_float_from_rect(ibuf);
-		ibuf->userflags&= ~IB_RECT_INVALID;
+		ibuf->userflags &= ~IB_RECT_INVALID;
 	}
 
 	/* now we need a float buffer from the image with matching color management */
 	if (ibuf->channels == 4) {
-		rect= node_composit_get_float_buffer(rd, ibuf, &alloc);
+		rect = node_composit_get_float_buffer(rd, ibuf, &alloc);
 	}
 	else {
 		/* non-rgba passes can't use color profiles */
-		rect= ibuf->rect_float;
+		rect = ibuf->rect_float;
 	}
 	/* done coercing into the correct color management */
 
 	if (!alloc) {
-		rect= MEM_dupallocN(rect);
-		alloc= 1;
+		rect = MEM_dupallocN(rect);
+		alloc = TRUE;
 	}
 
-	type= ibuf->channels;
+	type = ibuf->channels;
 
 	if (rd->scemode & R_COMP_CROP) {
-		stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
+		stackbuf = get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
 		if (alloc)
 			MEM_freeN(rect);
 	}
 	else {
 		/* we put imbuf copy on stack, cbuf knows rect is from other ibuf when freed! */
-		stackbuf= alloc_compbuf(ibuf->x, ibuf->y, type, FALSE);
-		stackbuf->rect= rect;
-		stackbuf->malloc= alloc;
+		stackbuf = alloc_compbuf(ibuf->x, ibuf->y, type, FALSE);
+		stackbuf->rect = rect;
+		stackbuf->malloc = alloc;
 	}
 
 	IMB_freeImBuf(ibuf);
@@ -103,32 +103,32 @@
 static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
 {
 	if (node->id) {
-		RenderData *rd= data;
-		MovieClip *clip= (MovieClip *)node->id;
-		MovieClipUser *user= (MovieClipUser *)node->storage;
-		CompBuf *stackbuf= NULL;
+		RenderData *rd = data;
+		MovieClip *clip = (MovieClip *)node->id;
+		MovieClipUser *user = (MovieClipUser *)node->storage;
+		CompBuf *stackbuf = NULL;
 
 		BKE_movieclip_user_set_frame(user, rd->cfra);
 
-		stackbuf= node_composit_get_movieclip(rd, clip, user);
+		stackbuf = node_composit_get_movieclip(rd, clip, user);
 
 		if (stackbuf) {
-			MovieTrackingStabilization *stab= &clip->tracking.stabilization;
+			MovieTrackingStabilization *stab = &clip->tracking.stabilization;
 
 			/* put image on stack */
-			out[0]->data= stackbuf;
+			out[0]->data = stackbuf;
 
-			if (stab->flag&TRACKING_2D_STABILIZATION) {
+			if (stab->flag & TRACKING_2D_STABILIZATION) {
 				float loc[2], scale, angle;
 
 				BKE_tracking_stabilization_data(&clip->tracking, rd->cfra, stackbuf->x, stackbuf->y,
 							loc, &scale, &angle);
 
-				out[1]->vec[0]= loc[0];
-				out[2]->vec[0]= loc[1];
+				out[1]->vec[0] = loc[0];
+				out[2]->vec[0] = loc[1];
 
-				out[3]->vec[0]= scale;
-				out[4]->vec[0]= angle;
+				out[3]->vec[0] = scale;
+				out[4]->vec[0] = angle;
 			}
 
 			/* generate preview */
@@ -139,10 +139,10 @@
 
 static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 {
-	MovieClipUser *user= MEM_callocN(sizeof(MovieClipUser), "node movie clip user");
+	MovieClipUser *user = MEM_callocN(sizeof(MovieClipUser), "node movie clip user");
 
-	node->storage= user;
-	user->framenr= 1;
+	node->storage = user;
+	user->framenr = 1;
 }
 
 void register_node_type_cmp_movieclip(bNodeTreeType *ttype)

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c	2012-04-28 08:32:00 UTC (rev 46019)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c	2012-04-28 08:43:24 UTC (rev 46020)
@@ -4,7 +4,7 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -37,12 +37,12 @@
 
 /* **************** Translate  ******************** */
 
-static bNodeSocketTemplate cmp_node_moviedistortion_in[]= {
+static bNodeSocketTemplate cmp_node_moviedistortion_in[] = {
 	{	SOCK_RGBA, 1, "Image",			0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
-static bNodeSocketTemplate cmp_node_moviedistortion_out[]= {
+static bNodeSocketTemplate cmp_node_moviedistortion_out[] = {
 	{	SOCK_RGBA, 0, "Image"},
 	{	-1, 0, ""	}
 };
@@ -51,63 +51,63 @@
 {
 	if (in[0]->data) {
 		if (node->id) {
-			MovieClip *clip= (MovieClip *)node->id;
-			CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
-			CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 0);
+			MovieClip *clip = (MovieClip *)node->id;
+			CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_RGBA);
+			CompBuf *stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 0);
 			ImBuf *ibuf;
 
-			ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
+			ibuf = IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
 
 			if (ibuf) {
-				RenderData *rd= data;
+				RenderData *rd = data;
 				ImBuf *obuf;
-				MovieTracking *tracking= &clip->tracking;
+				MovieTracking *tracking = &clip->tracking;
 				int width, height;
-				float overscan= 0.0f;
-				MovieClipUser user= {0};
+				float overscan = 0.0f;
+				MovieClipUser user = {0};
 
 				BKE_movieclip_user_set_frame(&user, rd->cfra);
 
-				ibuf->rect_float= cbuf->rect;
+				ibuf->rect_float = cbuf->rect;
 
 				BKE_movieclip_get_size(clip, &user, &width, &height);
 
 				if (!node->storage)
-					node->storage= BKE_tracking_distortion_create();
+					node->storage = BKE_tracking_distortion_create();
 
-				if (node->custom1==0)
+				if (node->custom1 == 0)
 					obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 1);
 				else
 					obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 0);
 
-				stackbuf->rect= obuf->rect_float;
-				stackbuf->malloc= 1;
+				stackbuf->rect = obuf->rect_float;
+				stackbuf->malloc = TRUE;
 
-				obuf->mall&= ~IB_rectfloat;
-				obuf->rect_float= NULL;
+				obuf->mall &= ~IB_rectfloat;
+				obuf->rect_float = NULL;
 
 				IMB_freeImBuf(ibuf);
 				IMB_freeImBuf(obuf);
 			}
 
 			/* pass on output and free */
-			out[0]->data= stackbuf;
+			out[0]->data = stackbuf;
 
-			if (cbuf!=in[0]->data)
+			if (cbuf != in[0]->data)
 				free_compbuf(cbuf);
 		}
 		else {
-			CompBuf *cbuf= in[0]->data;
-			CompBuf *stackbuf= pass_on_compbuf(cbuf);
+			CompBuf *cbuf = in[0]->data;
+			CompBuf *stackbuf = pass_on_compbuf(cbuf);
 
-			out[0]->data= stackbuf;
+			out[0]->data = stackbuf;
 		}
 	}
 }
 
 static const char *label(bNode *node)
 {
-	if (node->custom1==0)
+	if (node->custom1 == 0)
 		return IFACE_("Undistortion");
 	else
 		return IFACE_("Distortion");
@@ -124,7 +124,7 @@
 static void storage_copy(bNode *orig_node, bNode *new_node)
 {
 	if (orig_node->storage)
-		new_node->storage= BKE_tracking_distortion_copy(orig_node->storage);
+		new_node->storage = BKE_tracking_distortion_copy(orig_node->storage);
 }
 
 void register_node_type_cmp_moviedistortion(bNodeTreeType *ttype)

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c	2012-04-28 08:32:00 UTC (rev 46019)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c	2012-04-28 08:43:24 UTC (rev 46020)
@@ -48,20 +48,20 @@
 static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
 	if (in[0]->data && node->id) {
-		RenderData *rd= data;
-		MovieClip *clip= (MovieClip *)node->id;
-		CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
+		RenderData *rd = data;
+		MovieClip *clip = (MovieClip *)node->id;
+		CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_RGBA);
 		CompBuf *stackbuf;
 		float loc[2], scale, angle;
 
 		BKE_tracking_stabilization_data(&clip->tracking, rd->cfra, cbuf->x, cbuf->y, loc, &scale, &angle);
 
-		stackbuf= node_composit_transform(cbuf, loc[0], loc[1], angle, scale, node->custom1);
+		stackbuf = node_composit_transform(cbuf, loc[0], loc[1], angle, scale, node->custom1);
 
 		/* pass on output and free */
-		out[0]->data= stackbuf;
+		out[0]->data = stackbuf;
 
-		if (cbuf!=in[0]->data)
+		if (cbuf != in[0]->data)
 			free_compbuf(cbuf);
 	}
 }

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_transform.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_transform.c	2012-04-28 08:32:00 UTC (rev 46019)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_transform.c	2012-04-28 08:43:24 UTC (rev 46020)
@@ -4,7 +4,7 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version. 
+ * of the License, or (at your option) any later version.
  *

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list