[Bf-blender-cvs] [8c3bd1eda1a] master: Cleanup: style

Campbell Barton noreply at git.blender.org
Tue Jan 15 00:51:26 CET 2019


Commit: 8c3bd1eda1a2f35e28773f18c879f5f8f971b306
Author: Campbell Barton
Date:   Tue Jan 15 08:47:04 2019 +1100
Branches: master
https://developer.blender.org/rB8c3bd1eda1a2f35e28773f18c879f5f8f971b306

Cleanup: style

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/gpencil/gpencil_select.c
M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/imbuf/IMB_imbuf_types.h
M	source/blender/modifiers/intern/MOD_bevel.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/windowmanager/intern/wm_window.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 54025a3cd20..989649f65b8 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1645,7 +1645,7 @@ void BKE_gpencil_stroke_2d_flat_ref(
 		copy_v3_v3(v3, &pt3->x);
 	}
 
-	sub_v3_v3v3(loc3,v3, &pt0->x);
+	sub_v3_v3v3(loc3, v3, &pt0->x);
 
 	/* vector orthogonal to polygon plane */
 	cross_v3_v3v3(normal, locx, loc3);
@@ -1686,7 +1686,7 @@ void BKE_gpencil_stroke_2d_flat_ref(
 		else {
 			copy_v3_v3(v1, &pt->x);
 		}
-		
+
 		/* Get local space using first point as origin (ref stroke) */
 		sub_v3_v3v3(loc, v1, &pt0->x);
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index f925f9fb506..f11082c2e09 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1253,7 +1253,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
 	const bool is_show_gizmo = (((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) && ((v3d->gizmo_flag & V3D_GIZMO_HIDE_TOOL) == 0));
 
 	if ((overlay) && (is_cppoint || is_speed_guide) && (is_show_gizmo) &&
-		((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0))
+	    ((gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0))
 	{
 		DRWShadingGroup *shgrp = DRW_shgroup_create(
 			e_data->gpencil_edit_point_sh, psl->drawing_pass);
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index c560321df9f..b9bb5db5c2e 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -366,7 +366,7 @@ typedef struct GpencilBatchCache {
 struct DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
         struct GPENCIL_e_data *e_data, struct GPENCIL_Data *vedata, struct DRWPass *pass, struct GPUShader *shader,
         struct Object *ob, struct bGPdata *gpd, struct bGPDstroke *gps,
-		struct MaterialGPencilStyle *gp_style, int id, bool onion);
+        struct MaterialGPencilStyle *gp_style, int id, bool onion);
 void DRW_gpencil_populate_datablock(
         struct GPENCIL_e_data *e_data, void *vedata,
         struct Object *ob, struct tGPencilObjectCache *cache_ob);
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 72f65ce8a37..5c6f7de9426 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -2545,14 +2545,21 @@ static int gp_stroke_caps_set_exec(bContext *C, wmOperator *op)
 			MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
 
 			/* skip strokes that are not selected or invalid for current view */
-			if (((gps->flag & GP_STROKE_SELECT) == 0) || ED_gpencil_stroke_can_use(C, gps) == false)
+			if (((gps->flag & GP_STROKE_SELECT) == 0) ||
+			    (ED_gpencil_stroke_can_use(C, gps) == false))
+			{
 				continue;
+			}
 			/* skip hidden or locked colors */
-			if (!gp_style || (gp_style->flag & GP_STYLE_COLOR_HIDE) || (gp_style->flag & GP_STYLE_COLOR_LOCKED))
+			if (!gp_style ||
+			    (gp_style->flag & GP_STYLE_COLOR_HIDE) ||
+			    (gp_style->flag & GP_STYLE_COLOR_LOCKED))
+			{
 				continue;
+			}
 
 			if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) ||
-				(type == GP_STROKE_CAPS_TOGGLE_START))
+			    (type == GP_STROKE_CAPS_TOGGLE_START))
 			{
 				++gps->caps[0];
 				if (gps->caps[0] >= GP_STROKE_CAP_MAX) {
@@ -2560,7 +2567,7 @@ static int gp_stroke_caps_set_exec(bContext *C, wmOperator *op)
 				}
 			}
 			if ((type == GP_STROKE_CAPS_TOGGLE_BOTH) ||
-				(type == GP_STROKE_CAPS_TOGGLE_END))
+			    (type == GP_STROKE_CAPS_TOGGLE_END))
 			{
 				++gps->caps[1];
 				if (gps->caps[1] >= GP_STROKE_CAP_MAX) {
@@ -3851,7 +3858,7 @@ static void gpencil_cutter_dissolve(bGPDlayer *hit_layer, bGPDstroke *hit_stroke
 
 	/* if all points selected delete or only 2 points and 1 selected */
 	if (((totselect == 1) && (hit_stroke->totpoints == 2)) ||
-		(hit_stroke->totpoints == totselect))
+	    (hit_stroke->totpoints == totselect))
 	{
 		BLI_remlink(&hit_layer->actframe->strokes, hit_stroke);
 		BKE_gpencil_free_stroke(hit_stroke);
@@ -3950,7 +3957,7 @@ static int gpencil_cutter_lasso_select(
 		}
 		/* if mark all points inside lasso set to remove all stroke */
 		if ((tot_inside == oldtot) ||
-			((tot_inside == 1) && (oldtot == 2)))
+		    ((tot_inside == 1) && (oldtot == 2)))
 		{
 			for (i = 0; i < gps->totpoints; i++) {
 				pt = &gps->points[i];
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index b138fa8a0d2..baf8ca41062 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2628,10 +2628,12 @@ static void gp_rotate_v2_v2v2fl(float v[2], const float p[2], const float origin
 /* Helper to snap value to grid */
 static float gp_snap_to_grid_fl(float v, const float offset, const float spacing)
 {
-	if (spacing > 0.0f)
+	if (spacing > 0.0f) {
 		return roundf(v / spacing) * spacing + fmodf(offset, spacing);
-	else 
+	}
+	else {
 		return v;
+	}
 }
 
 static void UNUSED_FUNCTION(gp_snap_to_grid_v2)(float v[2], const float offset[2], const float spacing)
@@ -2666,7 +2668,8 @@ static void gp_origin_get(tGPsdata *p, float origin[2])
 		copy_v3_v3(location, guide->location);
 	}
 	else if (guide->reference_point == GP_GUIDE_REF_OBJECT &&
-		guide->reference_object != NULL) {
+	         guide->reference_object != NULL)
+	{
 		copy_v3_v3(location, guide->reference_object->loc);
 	}
 	else {
@@ -2762,7 +2765,7 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 		p->straight = 0;
 
 		/* save initial mouse */
-		copy_v2_v2(p->mvali, p->mval); 
+		copy_v2_v2(p->mvali, p->mval);
 
 		/* calculate once and store snapping distance and origin */
 		RegionView3D * rv3d = p->ar->regiondata;
@@ -2791,9 +2794,10 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 		 * it requires direction which needs at least two points
 		 */
 		if (!ELEM(p->paintmode, GP_PAINTMODE_ERASER, GP_PAINTMODE_SET_CP) &&
-			guide->use_guide &&
-			guide->use_snapping &&
-			(guide->type == GP_GUIDE_GRID)) {
+		    guide->use_guide &&
+		    guide->use_snapping &&
+		    (guide->type == GP_GUIDE_GRID))
+		{
 			p->flags |= GP_PAINTFLAG_REQ_VECTOR;
 		}
 	}
@@ -2809,7 +2813,7 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 		/* create fake events */
 		float tmp[2];
 		float pt[2];
-		copy_v2_v2(tmp, p->mval);						
+		copy_v2_v2(tmp, p->mval);
 		sub_v2_v2v2(pt, p->mval, p->mvali);
 		gpencil_draw_apply_event(C, op, event, CTX_data_depsgraph(C), pt[0], pt[1]);
 		if (len_v2v2(p->mval, p->mvalo)) {
@@ -2820,8 +2824,9 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 	}
 
 	/* check if stroke is straight or guided */
-	if ((p->paintmode != GP_PAINTMODE_ERASER)
-		&& ((p->straight) || (guide->use_guide))) {
+	if ((p->paintmode != GP_PAINTMODE_ERASER) &&
+	    ((p->straight) || (guide->use_guide)))
+	{
 		/* guided stroke */
 		if (guide->use_guide) {
 			switch (guide->type) {
@@ -2836,12 +2841,11 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 					}
 
 					dist_ensure_v2_v2fl(p->mval, p->origin, distance);
+					break;
 				}
-				break;
 				case GP_GUIDE_RADIAL:
 				{
-					if (guide->use_snapping &&
-						(guide->angle_snap > 0.0f)) {
+					if (guide->use_snapping && (guide->angle_snap > 0.0f)) {
 						float point[2];
 						float xy[2];
 						float angle;
@@ -2857,8 +2861,8 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 					else {
 						closest_to_line_v2(p->mval, p->mval, p->mvali, p->origin);
 					}
+					break;
 				}
-				break;
 				case GP_GUIDE_PARALLEL:
 				{
 					float point[2];
@@ -2867,21 +2871,17 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 					unit[0] += 1.0f; /* start from horizontal */
 					gp_rotate_v2_v2v2fl(point, unit, p->mvali, guide->angle);
 					closest_to_line_v2(p->mval, p->mval, p->mvali, point);
-					
-					if (guide->use_snapping &&
-						(guide->spacing > 0.0f)) {						
+
+					if (guide->use_snapping && (guide->spacing > 0.0f)) {
 						gp_rotate_v2_v2v2fl(p->mval, p->mval, p->origin, -guide->angle);
 						p->mval[1] = gp_snap_to_grid_fl(p->mval[1] - p->half_spacing, p->origin[1], p->guide_spacing);
 						gp_rotate_v2_v2v2fl(p->mval, p->mval, p->origin, guide->angle);
 					}
-
+					break;
 				}
-				break;
 				case GP_GUIDE_GRID:
 				{
-					if (guide->use_snapping &&
-						(guide->spacing > 0.0f)) {
-	
+					if (guide->use_snapping && (guide->spacing > 0.0f)) {
 						float point[2];
 						float unit[2];
 						float angle;
@@ -2904,11 +2904,11 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 					else {
 						p->mval[0] = p->mvali[0]; /* replace x */
 					}
+					break;
 				}
-				break;
 			}
 		}
-		else if (p->straight == STROKE_HORIZONTAL) {	
+		else if (p->straight == STROKE_HORIZONTAL) {
 			p->mval[1] = p->mvali[1]; /* replace y */
 		}
 		else {
@@ -3020,9 +3020,9 @@ static void gpencil_guide_event_handling(bContext *C, wmOperator *op, const wmEv
 	/* Enter or exit set center point mode */
 	if ((event->type == OKEY) && (event->val == KM_RELEASE)) {
 		if (p->paintmode == GP_PAINTMODE_DRAW && guide->reference_point != GP_GUIDE_REF_OBJECT) {
-			add_notifier = true; 
+			add_notifier = true;
 			p->paintmode = GP_PAINTMODE_SET_CP;
-			ED_gpencil_toggle_brush_cursor(C, false, NULL);			
+			ED_gpencil_toggle_brush_cursor(C, false, NULL);
 		}
 	}
 	/* Freehand mode, turn off speed guide */
@@ -3052,7 +3052,7 @@ static void gpencil_guide_event_handling(bContext *C, wmOperator *op, const wmEv
 	/* Line guides */
 	else if ((event->type == LKEY) && (event->val == KM_RELEASE)) {
 		add_notifier = true;
-		guide->use_guide = true;		
+		guide->use_guide = true;
 		if (event->ctrl) {
 			

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list