[Bf-blender-cvs] [f1c81a1] master: Cleanup: Remove tabs in empty lines, use bool when possible instead of int, and mark const values/parameters as such.

Bastien Montagne noreply at git.blender.org
Thu Jan 9 20:38:06 CET 2014


Commit: f1c81a199a7e17789d8b1f9404730420eb492021
Author: Bastien Montagne
Date:   Thu Jan 9 11:08:17 2014 +0100
https://developer.blender.org/rBf1c81a199a7e17789d8b1f9404730420eb492021

Cleanup: Remove tabs in empty lines, use bool when possible instead of int, and mark const values/parameters as such.

===================================================================

M	source/blender/editors/gpencil/gpencil_edit.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 715b771..138eb81 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -27,8 +27,6 @@
  *  \ingroup edgpencil
  */
 
- 
-
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -37,7 +35,6 @@
 
 #include "MEM_guardedalloc.h"
 
-
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_rand.h"
@@ -85,6 +82,7 @@
 
 #include "gpencil_intern.h"
 
+
 /* ************************************************ */
 /* Context Wrangling... */
 
@@ -94,7 +92,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 	ID *screen_id = (ID *)CTX_wm_screen(C);
 	Scene *scene = CTX_data_scene(C);
 	ScrArea *sa = CTX_wm_area(C);
-	
+
 	/* if there's an active area, check if the particular editor may
 	 * have defined any special Grease Pencil context for editing...
 	 */
@@ -103,7 +101,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 			case SPACE_VIEW3D: /* 3D-View */
 			{
 				Object *ob = CTX_data_active_object(C);
-				
+
 				/* TODO: we can include other data-types such as bones later if need be... */
 
 				/* just in case no active/selected object */
@@ -117,7 +115,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 			case SPACE_NODE: /* Nodes Editor */
 			{
 				SpaceNode *snode = (SpaceNode *)CTX_wm_space_data(C);
-				
+
 				/* return the GP data for the active node block/node */
 				if (snode && snode->nodetree) {
 					/* for now, as long as there's an active node tree, default to using that in the Nodes Editor */
@@ -131,7 +129,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 			case SPACE_SEQ: /* Sequencer */
 			{
 				SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
-				
+
 				/* for now, Grease Pencil data is associated with the space (actually preview region only) */
 				/* XXX our convention for everything else is to link to data though... */
 				if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceSequenceEditor, sseq, ptr);
@@ -140,7 +138,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 			case SPACE_IMAGE: /* Image/UV Editor */
 			{
 				SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C);
-				
+
 				/* for now, Grease Pencil data is associated with the space... */
 				/* XXX our convention for everything else is to link to data though... */
 				if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceImageEditor, sima, ptr);
@@ -150,23 +148,23 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 			{
 				SpaceClip *sc = (SpaceClip *)CTX_wm_space_data(C);
 				MovieClip *clip = ED_space_clip_get_clip(sc);
-				
+
 				if (clip) {
 					if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) {
 						MovieTrackingTrack *track = BKE_tracking_track_get_active(&clip->tracking);
-						
+
 						if (!track)
 							return NULL;
-						
+
 						if (ptr)
 							RNA_pointer_create(&clip->id, &RNA_MovieTrackingTrack, track, ptr);
-						
+
 						return &track->gpd;
 					}
 					else {
 						if (ptr)
 							RNA_id_pointer_create(&clip->id, ptr);
-						
+
 						return &clip->gpd;
 					}
 				}
@@ -176,7 +174,7 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr)
 				return NULL;
 		}
 	}
-	
+
 	/* just fall back on the scene's GP data */
 	if (ptr) RNA_id_pointer_create((ID *)scene, ptr);
 	return (scene) ? &scene->gpd : NULL;
@@ -219,7 +217,7 @@ static int gp_add_poll(bContext *C)
 static int gp_data_add_exec(bContext *C, wmOperator *op)
 {
 	bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
-	
+
 	if (gpd_ptr == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
 		return OPERATOR_CANCELLED;
@@ -227,14 +225,14 @@ static int gp_data_add_exec(bContext *C, wmOperator *op)
 	else {
 		/* decrement user count and add new datablock */
 		bGPdata *gpd = (*gpd_ptr);
-		
+
 		id_us_min(&gpd->id);
 		*gpd_ptr = gpencil_data_addnew(DATA_("GPencil"));
 	}
-	
+
 	/* notifiers */
 	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
-	
+
 	return OPERATOR_FINISHED;
 }
 
@@ -245,7 +243,7 @@ void GPENCIL_OT_data_add(wmOperatorType *ot)
 	ot->idname = "GPENCIL_OT_data_add";
 	ot->description = "Add new Grease Pencil datablock";
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-	
+
 	/* callbacks */
 	ot->exec = gp_data_add_exec;
 	ot->poll = gp_add_poll;
@@ -257,7 +255,7 @@ void GPENCIL_OT_data_add(wmOperatorType *ot)
 static int gp_data_unlink_poll(bContext *C)
 {
 	bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
-	
+
 	/* if we have access to some active data, make sure there's a datablock before enabling this */
 	return (gpd_ptr && *gpd_ptr);
 }
@@ -267,7 +265,7 @@ static int gp_data_unlink_poll(bContext *C)
 static int gp_data_unlink_exec(bContext *C, wmOperator *op)
 {
 	bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
-	
+
 	if (gpd_ptr == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
 		return OPERATOR_CANCELLED;
@@ -275,14 +273,14 @@ static int gp_data_unlink_exec(bContext *C, wmOperator *op)
 	else {
 		/* just unlink datablock now, decreasing its user count */
 		bGPdata *gpd = (*gpd_ptr);
-		
+
 		id_us_min(&gpd->id);
 		*gpd_ptr = NULL;
 	}
-	
+
 	/* notifiers */
 	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); 
-	
+
 	return OPERATOR_FINISHED;
 }
 
@@ -293,7 +291,7 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot)
 	ot->idname = "GPENCIL_OT_data_unlink";
 	ot->description = "Unlink active Grease Pencil datablock";
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-	
+
 	/* callbacks */
 	ot->exec = gp_data_unlink_exec;
 	ot->poll = gp_data_unlink_poll;
@@ -305,7 +303,7 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot)
 static int gp_layer_add_exec(bContext *C, wmOperator *op)
 {
 	bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
-	
+
 	/* if there's no existing Grease-Pencil data there, add some */
 	if (gpd_ptr == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
@@ -313,13 +311,13 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op)
 	}
 	if (*gpd_ptr == NULL)
 		*gpd_ptr = gpencil_data_addnew(DATA_("GPencil"));
-	
+
 	/* add new layer now */
 	gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), 1);
-	
+
 	/* notifiers */
 	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
-	
+
 	return OPERATOR_FINISHED;
 }
 
@@ -330,7 +328,7 @@ void GPENCIL_OT_layer_add(wmOperatorType *ot)
 	ot->idname = "GPENCIL_OT_layer_add";
 	ot->description = "Add new Grease Pencil layer for the active Grease Pencil datablock";
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-	
+
 	/* callbacks */
 	ot->exec = gp_layer_add_exec;
 	ot->poll = gp_add_poll;
@@ -342,7 +340,7 @@ static int gp_actframe_delete_poll(bContext *C)
 {
 	bGPdata *gpd = gpencil_data_get_active(C);
 	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
-	
+
 	/* only if there's an active layer with an active frame */
 	return (gpl && gpl->actframe);
 }
@@ -354,7 +352,7 @@ static int gp_actframe_delete_exec(bContext *C, wmOperator *op)
 	bGPdata *gpd = gpencil_data_get_active(C);
 	bGPDlayer *gpl = gpencil_layer_getactive(gpd);
 	bGPDframe *gpf = gpencil_layer_getframe(gpl, CFRA, 0);
-	
+
 	/* if there's no existing Grease-Pencil data there, add some */
 	if (gpd == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "No grease pencil data");
@@ -364,13 +362,13 @@ static int gp_actframe_delete_exec(bContext *C, wmOperator *op)
 		BKE_report(op->reports, RPT_ERROR, "No active frame to delete");
 		return OPERATOR_CANCELLED;
 	}
-	
+
 	/* delete it... */
 	gpencil_layer_delframe(gpl, gpf);
-	
+
 	/* notifiers */
 	WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
-	
+
 	return OPERATOR_FINISHED;
 }
 
@@ -381,7 +379,7 @@ void GPENCIL_OT_active_frame_delete(wmOperatorType *ot)
 	ot->idname = "GPENCIL_OT_active_frame_delete";
 	ot->description = "Delete the active frame for the active Grease Pencil datablock";
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-	
+
 	/* callbacks */
 	ot->exec = gp_actframe_delete_exec;
 	ot->poll = gp_actframe_delete_poll;
@@ -447,7 +445,7 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
 	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
 	ARegion *ar = CTX_wm_region(C);
-	
+
 	if (gps->flag & GP_STROKE_3DSPACE) {
 		/* directly use 3d-coordinates */
 		copy_v3_v3(p3d, &pt->x);
@@ -455,7 +453,7 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
 	else {
 		const float *fp = ED_view3d_cursor3d_get(scene, v3d);
 		float mvalf[2];
-		
+
 		/* get screen coordinate */
 		if (gps->flag & GP_STROKE_2DSPACE) {
 			int mvali[2];
@@ -473,7 +471,7 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
 				mvalf[1] = (float)pt->y / 100.0f * ar->winy;
 			}
 		}
-		
+
 		/* convert screen coordinate to 3d coordinates 
 		 *	- method taken from editview.c - mouse_cursor() 
 		 */
@@ -489,7 +487,7 @@ typedef struct tGpTimingData {
 	int mode;
 	int frame_range; /* Number of frames evaluated for path animation */
 	int start_frame, end_frame;
-	int realtime; /* A bool, actually, will overwrite end_frame in case of Original or CustomGap timing... */
+	bool realtime; /* Will overwrite end_frame in case of Original or CustomGap timing... */
 	float gap_duration, gap_randomness; /* To be used with CustomGap mode*/
 	int seed;
 
@@ -507,12 +505,12 @@ typedef struct tGpTimingData {
 } tGpTimingData;
 
 /* init point buffers for timing data */
-static void _gp_timing_data_set_nbr(tGpTimingData *gtd, int nbr)
+static void _gp_timing_data_set_nbr(tGpTimingData *gtd, const int nbr)
 {
 	float *tmp;
 
 	BLI_assert(nbr > gtd->num_points);
-	
+
 	/* distances */
 	tmp = gtd->dists;
 	gtd->dists = MEM_callocN(sizeof(float) * nbr, __func__);
@@ -520,7 +518,7 @@ static void _gp_timing_data_set_nbr(tGpTimingData *gtd, int nbr)
 		memcpy(gtd->dists, tmp, sizeof(float) * gtd->num_points);
 		MEM_freeN(tmp);
 	}
-	
+
 	/* times */
 	tmp = gtd->times;
 	gtd->t

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list