[Bf-blender-cvs] [51f1ed82210] blender2.8: Cleanup: style

Campbell Barton noreply at git.blender.org
Thu Jun 14 22:46:09 CEST 2018


Commit: 51f1ed8221042f2e273f5ee47a6053f506a783fc
Author: Campbell Barton
Date:   Thu Jun 14 22:44:53 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB51f1ed8221042f2e273f5ee47a6053f506a783fc

Cleanup: style

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

M	source/blender/blenkernel/BKE_particle.h
M	source/blender/blenkernel/intern/studiolight.c
M	source/blender/draw/engines/workbench/workbench_forward.c
M	source/blender/draw/modes/edit_mesh_mode.c
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/screen/area.c
M	source/blender/gpu/intern/gpu_framebuffer.c
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 0a5bac267ac..dcc9c366b44 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -91,7 +91,7 @@ typedef struct ParticleSimulationData {
 	 * this at the moment. Other solvers could, too. */
 	float courant_num;
 	/* Only valid during dynamics_step(). */
-	struct RNG* rng;
+	struct RNG *rng;
 } ParticleSimulationData;
 
 typedef struct SPHData {
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 52dc706637c..60c25b8976d 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -107,8 +107,7 @@ static struct StudioLight *studiolight_create(int flag)
 	sl->path_irr = NULL;
 	sl->flag = flag;
 	sl->index = BLI_listbase_count(&studiolights);
-	if (flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL)
-	{
+	if (flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL) {
 		sl->icon_id_matcap = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_MATCAP);
 		sl->icon_id_matcap_flipped = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_MATCAP_FLIPPED);
 	}
@@ -428,7 +427,7 @@ static void studiolight_calculate_specular_irradiance(StudioLight *sl, float col
 	studiolight_evaluate_specular_radiance_buffer(
 	        sl->radiance_cubemap_buffers[STUDIOLIGHT_Z_NEG], normal, color, 0, 1, 2, -0.5);
 
-	mul_v3_fl(color, 1.0/ M_PI);
+	mul_v3_fl(color, 1.0 / M_PI);
 }
 
 static bool studiolight_load_irradiance_equirectangular_image(StudioLight *sl)
@@ -640,17 +639,17 @@ static uint *studiolight_matcap_preview(StudioLight *sl, int icon_size, bool fli
 	for (int y = 0; y < icon_size; y++) {
 		fy = y * ibuf->y / icon_size;
 		for (int x = 0; x < icon_size; x++) {
-			if (flipped)
-			{
+			if (flipped) {
 				fx = ibuf->x - (x * ibuf->x / icon_size) - 1;
 			}
 			else {
 				fx = x * ibuf->x / icon_size;
 			}
 			nearest_interpolation_color(ibuf, NULL, color, fx, fy);
-			rect[offset++] = rgb_to_cpack(linearrgb_to_srgb(color[0]),
-			                              linearrgb_to_srgb(color[1]),
-			                              linearrgb_to_srgb(color[2])) | alphamask;
+			rect[offset++] = rgb_to_cpack(
+			        linearrgb_to_srgb(color[0]),
+			        linearrgb_to_srgb(color[1]),
+			        linearrgb_to_srgb(color[2])) | alphamask;
 		}
 	}
 	return rect;
@@ -850,8 +849,7 @@ struct ListBase *BKE_studiolight_listbase(void)
 
 uint *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type)
 {
-	switch(icon_id_type)
-	{
+	switch (icon_id_type) {
 		case STUDIOLIGHT_ICON_ID_TYPE_RADIANCE:
 		default:
 			return studiolight_radiance_preview(sl, icon_size);
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 3912494d9db..bbb43f3655e 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -476,7 +476,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
 				struct Gwn_Batch **geom_array = me->totcol ? DRW_cache_mesh_surface_texpaint_get(ob) : NULL;
 				if (materials_len > 0 && geom_array) {
 					for (int i = 0; i < materials_len; i++) {
-						if(geom_array[i] == NULL) {
+						if (geom_array[i] == NULL) {
 							continue;
 						}
 
@@ -524,14 +524,13 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
 				        ob, gpumat_array, materials_len, NULL, NULL, NULL);
 				if (mat_geom) {
 					for (int i = 0; i < materials_len; ++i) {
-						if(mat_geom[i] == NULL) {
+						if (mat_geom[i] == NULL) {
 							continue;
 						}
 
 						Material *mat = give_current_material(ob, i + 1);
 						material = get_or_create_material_data(vedata, ob, mat, NULL, OB_SOLID);
-						if (is_sculpt_mode)
-						{
+						if (is_sculpt_mode) {
 							DRW_shgroup_call_sculpt_add(material->shgrp_object_outline, ob, ob->obmat);
 							DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
 						}
diff --git a/source/blender/draw/modes/edit_mesh_mode.c b/source/blender/draw/modes/edit_mesh_mode.c
index d51f3a85105..94eeb58dcb2 100644
--- a/source/blender/draw/modes/edit_mesh_mode.c
+++ b/source/blender/draw/modes/edit_mesh_mode.c
@@ -139,8 +139,7 @@ typedef struct EDIT_MESH_PrivateData {
 static int EDIT_MESH_sh_index(ToolSettings *tsettings, RegionView3D *rv3d, bool supports_fast_mode)
 {
 	int result = tsettings->selectmode << 1;
-	if (supports_fast_mode)
-	{
+	if (supports_fast_mode) {
 		SET_FLAG_FROM_TEST(result, (rv3d->rflag & RV3D_NAVIGATING), 1 << 0);
 	}
 	return result;
@@ -154,28 +153,23 @@ static char *EDIT_MESH_sh_defines(ToolSettings *tsettings, RegionView3D *rv3d, b
 	char *str = NULL;
 	DynStr *ds = BLI_dynstr_new();
 
-	if (selectmode & SCE_SELECT_VERTEX)
-	{
+	if (selectmode & SCE_SELECT_VERTEX) {
 		BLI_dynstr_append(ds, "#define VERTEX_SELECTION\n");
 	}
 
-	if (selectmode & SCE_SELECT_EDGE)
-	{
+	if (selectmode & SCE_SELECT_EDGE) {
 		BLI_dynstr_append(ds, "#define EDGE_SELECTION\n");
 	}
 
-	if (selectmode & SCE_SELECT_FACE)
-	{
+	if (selectmode & SCE_SELECT_FACE) {
 		BLI_dynstr_append(ds, "#define FACE_SELECTION\n");
 	}
 
-	if (!fast_mode)
-	{
+	if (!fast_mode) {
 		BLI_dynstr_append(ds, "#define EDGE_FIX\n");
 	}
 
-	if (anti_alias)
-	{
+	if (anti_alias) {
 		BLI_dynstr_append(ds, "#define ANTI_ALIASING\n");
 	}
 	BLI_dynstr_append(ds, "#define VERTEX_FACING\n");
@@ -188,10 +182,8 @@ static char *EDIT_MESH_sh_defines(ToolSettings *tsettings, RegionView3D *rv3d, b
 static GPUShader *EDIT_MESH_ensure_shader(ToolSettings *tsettings, RegionView3D *rv3d, bool fast_mode, bool looseedge)
 {
 	const int index = EDIT_MESH_sh_index(tsettings, rv3d, fast_mode);
-	if (looseedge)
-	{
-		if (!e_data.overlay_loose_edge_sh_cache[index])
-		{
+	if (looseedge) {
+		if (!e_data.overlay_loose_edge_sh_cache[index]) {
 			char *defines = EDIT_MESH_sh_defines(tsettings, rv3d, true);
 			e_data.overlay_loose_edge_sh_cache[index] = DRW_shader_create_with_lib(
 			        datatoc_edit_mesh_overlay_vert_glsl,
@@ -204,8 +196,7 @@ static GPUShader *EDIT_MESH_ensure_shader(ToolSettings *tsettings, RegionView3D
 		return e_data.overlay_loose_edge_sh_cache[index];
 	}
 	else {
-		if (!e_data.overlay_tri_sh_cache[index])
-		{
+		if (!e_data.overlay_tri_sh_cache[index]) {
 			char *defines = EDIT_MESH_sh_defines(tsettings, rv3d, true);
 			e_data.overlay_tri_sh_cache[index] = DRW_shader_create_with_lib(
 			        datatoc_edit_mesh_overlay_vert_glsl,
@@ -578,8 +569,7 @@ static void EDIT_MESH_engine_free(void)
 	DRW_SHADER_FREE_SAFE(e_data.normals_face_sh);
 	DRW_SHADER_FREE_SAFE(e_data.normals_sh);
 
-	for (int i = 0; i < MAX_SHADERS; i++)
-	{
+	for (int i = 0; i < MAX_SHADERS; i++) {
 		DRW_SHADER_FREE_SAFE(e_data.overlay_tri_sh_cache[i]);
 		DRW_SHADER_FREE_SAFE(e_data.overlay_loose_edge_sh_cache[i]);
 	}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 8f8640d17cf..a67a7740908 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3017,10 +3017,16 @@ static void ui_litem_grid_flow_compute(
 		const float wfac = (float)(parameters->litem_w - (parameters->tot_columns - 1) * parameters->space_x) / tot_w;
 
 		for (int col = 0; col < parameters->tot_columns; col++) {
-			results->cos_x_array[col] = col ? results->cos_x_array[col - 1] + results->widths_array[col - 1] + parameters->space_x : parameters->litem_x;
+			results->cos_x_array[col] = (
+			        col ?
+			        results->cos_x_array[col - 1] + results->widths_array[col - 1] + parameters->space_x :
+			        parameters->litem_x
+			);
 			if (parameters->even_columns) {
-				/*                     (<                        remaining width                          > - <       space between remaining columns              >) / <     remaining columns    > */
-				results->widths_array[col] = ((parameters->litem_w - (results->cos_x_array[col] - parameters->litem_x)) - (parameters->tot_columns - col - 1) * parameters->space_x) / (parameters->tot_columns - col);
+				/* (< remaining width > - < space between remaining columns >) / < remaining columns > */
+				results->widths_array[col] = (
+				        ((parameters->litem_w - (results->cos_x_array[col] - parameters->litem_x)) -
+				         (parameters->tot_columns - col - 1) * parameters->space_x) / (parameters->tot_columns - col));
 			}
 			else if (col == parameters->tot_columns - 1) {
 				/* Last column copes width rounding errors... */
@@ -3039,7 +3045,10 @@ static void ui_litem_grid_flow_compute(
 			else {
 				results->heights_array[row] = max_h[row];
 			}
-			results->cos_y_array[row] = row ? results->cos_y_array[row - 1] - parameters->space_y - results->heights_array[row] : parameters->litem_y - results->heights_array[row];
+			results->cos_y_array[row] = (
+			        row ?
+			        results->cos_y_array[row - 1] - parameters->space_y - results->heights_array[row] :
+			        parameters->litem_y - results->heights_array[row]);
 		}
 	}
 
@@ -3071,22 +3080,22 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
 		int max_h;
 
 		ui_litem_grid_flow_compute(
-		            &litem->items,
-		            &((UILayoutGridFlowInput) {
-		                  .row_major = gflow->row_major,
-		                  .even_columns = gflow->even_columns,
-		                  .even_rows = gflow->even_rows,
-		                  .litem_w = litem->w,
-		                  .litem_x = litem->x,
-		                  .litem_y = litem->y,
-		                  .space_x = space_x,
-		                  .space_y = space_y,
-		              }),
-		            &((UILayoutGridFlowOutput) {
-		                  .tot_items = &gflow->tot_items,
-		                  .global_avg_w = &avg_w,
-		                  .global_max_h = &max_h,
-		              }));
+		        &litem->items,
+		        &((UILayoutGridFlowInput) {
+		              .row_major = gflow->row_major,
+		              .even_columns = gflow->even_columns,
+		              .even_rows = gflow->even

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list