diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-14 23:44:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-14 23:44:53 +0300 |
commit | 51f1ed8221042f2e273f5ee47a6053f506a783fc (patch) | |
tree | 1f8462a771da1a3ecddf5be04c05626d96239ce0 | |
parent | 928d31d94a49f0b2644e7345ac58264c75db94f7 (diff) |
Cleanup: style
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 18 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_forward.c | 7 | ||||
-rw-r--r-- | source/blender/draw/modes/edit_mesh_mode.c | 30 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 121 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 19 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 4 |
8 files changed, 100 insertions, 103 deletions
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_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, + })); if (gflow->tot_items == 0) { litem->w = litem->h = 0; @@ -3156,23 +3165,23 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem) int tot_w, tot_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, - .tot_columns = gflow->tot_columns, - .tot_rows = gflow->tot_rows, - }), - &((UILayoutGridFlowOutput) { - .tot_w = &tot_w, - .tot_h = &tot_h, - })); + &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, + .tot_columns = gflow->tot_columns, + .tot_rows = gflow->tot_rows, + }), + &((UILayoutGridFlowOutput) { + .tot_w = &tot_w, + .tot_h = &tot_h, + })); litem->w = tot_w; litem->h = tot_h; @@ -3204,25 +3213,25 @@ static void ui_litem_layout_grid_flow(uiLayout *litem) /* This time we directly compute coordinates and sizes of all cells. */ 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, - .tot_columns = gflow->tot_columns, - .tot_rows = gflow->tot_rows, - }), - &((UILayoutGridFlowOutput) { - .cos_x_array = cos_x, - .cos_y_array = cos_y, - .widths_array = widths, - .heights_array = heights, - })); + &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, + .tot_columns = gflow->tot_columns, + .tot_rows = gflow->tot_rows, + }), + &((UILayoutGridFlowOutput) { + .cos_x_array = cos_x, + .cos_y_array = cos_y, + .widths_array = widths, + .heights_array = heights, + })); for (item = litem->items.first, i = 0; item; item = item->next, i++) { const int col = gflow->row_major ? i % gflow->tot_columns : i / gflow->tot_rows; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 02ce64bc915..8d8d046c741 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1840,15 +1840,16 @@ BLI_INLINE bool streq_array_any(const char *s, const char *arr[]) return false; } -static void ed_panel_draw(const bContext *C, - ScrArea *sa, - ARegion *ar, - ListBase *lb, - PanelType *pt, - Panel *panel, - int w, - int em, - bool vertical) +static void ed_panel_draw( + const bContext *C, + ScrArea *sa, + ARegion *ar, + ListBase *lb, + PanelType *pt, + Panel *panel, + int w, + int em, + bool vertical) { uiStyle *style = UI_style_get_dpi(); diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index 889c365edca..18f8c33c3ca 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -44,7 +44,7 @@ #include "intern/gpu_private.h" -static ThreadLocal(void*) g_currentfb; +static ThreadLocal(void *) g_currentfb; typedef enum { GPU_FB_DEPTH_ATTACHMENT = 0, diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 14a3b9cbe5a..5ce27a533b8 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -719,7 +719,7 @@ static const EnumPropertyItem *rna_View3DShading_light_itemf( static int rna_View3DShading_studio_light_get(PointerRNA *ptr) { View3D *v3d = (View3D *)ptr->data; - char* dna_storage = v3d->shading.studio_light; + char *dna_storage = v3d->shading.studio_light; int flag = STUDIOLIGHT_ORIENTATIONS_SOLID; if (v3d->drawtype == OB_SOLID && v3d->shading.light == V3D_LIGHTING_MATCAP) { @@ -737,7 +737,7 @@ static int rna_View3DShading_studio_light_get(PointerRNA *ptr) static void rna_View3DShading_studio_light_set(PointerRNA *ptr, int value) { View3D *v3d = (View3D *)ptr->data; - char* dna_storage = v3d->shading.studio_light; + char *dna_storage = v3d->shading.studio_light; int flag = STUDIOLIGHT_ORIENTATIONS_SOLID; if (v3d->drawtype == OB_SOLID && v3d->shading.light == V3D_LIGHTING_MATCAP) { |