From 1f693aefca052918d308082f752f388d487f39b6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 May 2018 19:45:03 +0200 Subject: Cleanup: style/whitespace Also use 'uint'. --- source/blender/blenkernel/intern/mesh_convert.c | 2 +- source/blender/blenkernel/intern/object.c | 3 +- source/blender/blenkernel/intern/studiolight.c | 16 +- .../depsgraph/intern/depsgraph_query_iter.cc | 3 +- source/blender/draw/engines/eevee/eevee_effects.c | 7 +- source/blender/draw/engines/eevee/eevee_lookdev.c | 23 +- .../draw/engines/workbench/workbench_data.c | 2 +- source/blender/draw/intern/draw_cache_impl_mesh.c | 10 +- .../draw/intern/draw_cache_impl_particles.c | 352 +++++++++++---------- source/blender/draw/intern/draw_debug.c | 2 +- source/blender/draw/intern/draw_hair.c | 2 +- source/blender/draw/intern/draw_manager_data.c | 8 +- source/blender/draw/intern/draw_manager_exec.c | 5 +- .../blender/editors/interface/interface_layout.c | 10 +- source/blender/makesrna/intern/rna_space.c | 5 +- source/blender/modifiers/intern/MOD_normal_edit.c | 3 +- 16 files changed, 250 insertions(+), 203 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index b441c3f7a40..14f563d6053 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -886,7 +886,7 @@ Mesh *BKE_mesh_new_from_object( BKE_object_free_modifiers(tmpobj, 0); /* copies the data */ - BKE_id_copy_ex(bmain,ob->data, (ID **)©cu, LIB_ID_CREATE_NO_DEG_TAG, false); + BKE_id_copy_ex(bmain, ob->data, (ID **)©cu, LIB_ID_CREATE_NO_DEG_TAG, false); tmpobj->data = copycu; /* make sure texture space is calculated for a copy of curve, diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 71ed9211064..986812faebf 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3351,7 +3351,8 @@ MovieClip *BKE_object_movieclip_get(Scene *scene, Object *ob, bool use_default) return clip; } -void BKE_object_runtime_reset(Object *object) { +void BKE_object_runtime_reset(Object *object) +{ memset(&object->runtime, 0, sizeof(object->runtime)); } diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 12702275643..76b655f1fa5 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -207,7 +207,7 @@ static void studiolight_calculate_radiance_cubemap_buffers(StudioLight *sl) { if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) { BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED); - ImBuf* ibuf = sl->equirectangular_radiance_buffer; + ImBuf *ibuf = sl->equirectangular_radiance_buffer; if (ibuf) { float *colbuf = MEM_mallocN(SQUARE(STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) * sizeof(float[4]), __func__); const float add = 1.0f / (STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE + 1); @@ -462,7 +462,7 @@ static void studiolight_add_files_from_datafolder(const int folder_id, const cha struct direntry *dir; const char *folder = BKE_appdir_folder_id(folder_id, subfolder); if (folder) { - unsigned int totfile = BLI_filelist_dir_contents(folder, &dir); + uint totfile = BLI_filelist_dir_contents(folder, &dir); int i; for (i = 0; i < totfile; i++) { if ((dir[i].type & S_IFREG)) { @@ -512,7 +512,7 @@ static int studiolight_cmp(const void *a, const void *b) } /* icons */ -static unsigned int* studiolight_radiance_preview(StudioLight *sl, int icon_size) +static uint *studiolight_radiance_preview(StudioLight *sl, int icon_size) { BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED); @@ -566,7 +566,7 @@ static unsigned int* studiolight_radiance_preview(StudioLight *sl, int icon_size return rect; } -static unsigned int* studiolight_irradiance_preview(StudioLight *sl, int icon_size) +static uint *studiolight_irradiance_preview(StudioLight *sl, int icon_size) { BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_DIFFUSE_LIGHT_CALCULATED); @@ -660,7 +660,8 @@ struct StudioLight *BKE_studiolight_find(const char *name, int flag) if (STREQLEN(sl->name, name, FILE_MAXFILE)) { if ((sl->flag & flag) == flag) { return sl; - } else { + } + else { /* flags do not match, so use default */ return studiolights.first; } @@ -686,11 +687,12 @@ const struct ListBase *BKE_studiolight_listbase(void) return &studiolights; } -unsigned int *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type) +uint *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type) { if (icon_id_type == STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE) { return studiolight_irradiance_preview(sl, icon_size); - } else { + } + else { return studiolight_radiance_preview(sl, icon_size); } } diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index 843d379058a..4f3769b6768 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -300,7 +300,8 @@ void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data) iter->data = data; if ((num_id_nodes == 0) || - (data->only_updated && !DEG_id_type_any_updated(depsgraph))) { + (data->only_updated && !DEG_id_type_any_updated(depsgraph))) + { iter->valid = false; return; } diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 211a8abd42c..d7a978066d5 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -511,10 +511,13 @@ void EEVEE_draw_effects(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) /* Save the final texture and framebuffer for final transformation or read. */ effects->final_tx = effects->source_buffer; effects->final_fb = (effects->target_buffer != fbl->main_color_fb) ? fbl->main_fb : fbl->effect_fb; - if ((effects->enabled_effects & EFFECT_TAA) && (effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0) { + if ((effects->enabled_effects & EFFECT_TAA) && + (effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0) + { if (!effects->swap_double_buffer) { effects->final_fb = fbl->double_buffer_fb; - } else { + } + else { effects->final_fb = fbl->main_fb; } } diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 77472fcda67..0e0bea53927 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -32,13 +32,14 @@ #include "eevee_private.h" -void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass, World *world, EEVEE_LightProbesInfo *pinfo) +void EEVEE_lookdev_cache_init( + EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass, + World *world, EEVEE_LightProbesInfo *pinfo) { EEVEE_StorageList *stl = vedata->stl; const DRWContextState *draw_ctx = DRW_context_state_get(); View3D *v3d = draw_ctx->v3d; - if (LOOK_DEV_MODE_ENABLED(v3d)) - { + if (LOOK_DEV_MODE_ENABLED(v3d)) { StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATION_WORLD); if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) { struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get(); @@ -57,14 +58,18 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShad BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE); tex = sl->equirectangular_irradiance_gputexture; - } else { + } + else { BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE); tex = sl->equirectangular_radiance_gputexture; } DRW_shgroup_uniform_texture(*grp, "image", tex); /* Do we need to recalc the lightprobes? */ - if (pinfo && (pinfo->studiolight_index != sl->index || pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z)) { + if (pinfo && + ((pinfo->studiolight_index != sl->index) || + (pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z))) + { pinfo->update_world |= PROBE_UPDATE_ALL; pinfo->studiolight_index = sl->index; pinfo->studiolight_rot_z = v3d->shading.studiolight_rot_z; @@ -106,8 +111,8 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata) BKE_camera_params_compute_matrix(¶ms); const float *viewport_size = DRW_viewport_size_get(); - int viewport_inset_x = viewport_size[0]/4; - int viewport_inset_y = viewport_size[1]/4; + int viewport_inset_x = viewport_size[0] / 4; + int viewport_inset_y = viewport_size[1] / 4; EEVEE_CommonUniformBuffer *common = &sldata->common_data; common->la_num_light = 0; @@ -137,10 +142,10 @@ void EEVEE_lookdev_draw_background(EEVEE_Data *vedata) GPUFrameBuffer *fb = effects->final_fb; GPU_framebuffer_bind(fb); - GPU_framebuffer_viewport_set(fb, viewport_size[0]-viewport_inset_x, 0, viewport_inset_x, viewport_inset_y); + GPU_framebuffer_viewport_set(fb, viewport_size[0] - viewport_inset_x, 0, viewport_inset_x, viewport_inset_y); DRW_draw_pass(psl->lookdev_pass); DRW_viewport_matrix_override_unset_all(); DRW_stats_group_end(); } -} \ No newline at end of file +} diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index 062a5b04988..03155b45a34 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -37,7 +37,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) copy_v3_v3(wd->object_outline_color, wpd->shading.object_outline_color); wd->object_outline_color[3] = 1.0f; - wd->specular_sharpness = 100 - sqrtf(scene->display.roughness)* 100; + wd->specular_sharpness = 100.0f - sqrtf(scene->display.roughness) * 100.0f; wpd->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), &wpd->world_data); } diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 188ba6b07f7..e1b66a85ca2 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -3252,7 +3252,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata, /* Create edges for each pair of triangles sharing an edge. */ for (int i = 0; i < tri_len; i++) { for (int e = 0; e < 3; ++e) { - unsigned int v0, v1, v2; + uint v0, v1, v2; if (rdata->edit_bmesh) { const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i]; if (BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) { @@ -3283,7 +3283,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata, /* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */ *pval = SET_INT_IN_POINTER(NO_EDGE); bool inv_opposite = (v_data < 0); - unsigned int v_opposite = (unsigned int)abs(v_data) - 1; + uint v_opposite = (uint)abs(v_data) - 1; if (inv_opposite == inv_indices) { /* Don't share edge if triangles have non matching winding. */ @@ -3303,15 +3303,15 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata, BLI_edgehashIterator_isDone(ehi) == false; BLI_edgehashIterator_step(ehi)) { - unsigned int v1, v2; + uint v1, v2; int v_data = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); if (v_data == NO_EDGE) { continue; } BLI_edgehashIterator_getKey(ehi, &v1, &v2); - unsigned int v0 = (unsigned int)abs(v_data) - 1; + uint v0 = (uint)abs(v_data) - 1; if (v_data < 0) { /* inv_opposite */ - SWAP(unsigned int, v1, v2); + SWAP(uint, v1, v2); } GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0); cache->is_manifold = false; diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index dbf1b9357d3..1348968bad7 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -216,9 +216,10 @@ void DRW_particle_batch_cache_free(ParticleSystem *psys) MEM_SAFE_FREE(psys->batch_cache); } -static void count_cache_segment_keys(ParticleCacheKey **pathcache, - const int num_path_cache_keys, - ParticleHairCache *hair_cache) +static void count_cache_segment_keys( + ParticleCacheKey **pathcache, + const int num_path_cache_keys, + ParticleHairCache *hair_cache) { for (int i = 0; i < num_path_cache_keys; i++) { ParticleCacheKey *path = pathcache[i]; @@ -230,12 +231,14 @@ static void count_cache_segment_keys(ParticleCacheKey **pathcache, } } -static void ensure_seg_pt_count(PTCacheEdit *edit, - ParticleSystem *psys, - ParticleHairCache *hair_cache) +static void ensure_seg_pt_count( + PTCacheEdit *edit, + ParticleSystem *psys, + ParticleHairCache *hair_cache) { if ((hair_cache->pos != NULL && hair_cache->indices != NULL) || - (hair_cache->proc_point_buf != NULL)) { + (hair_cache->proc_point_buf != NULL)) + { return; } @@ -268,12 +271,13 @@ static void particle_pack_mcol(MCol *mcol, unsigned short r_scol[3]) } /* Used by parent particles and simple children. */ -static void particle_calculate_parent_uvs(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_uv_layers, - const int parent_index, - /*const*/ MTFace **mtfaces, - float (*r_uv)[2]) +static void particle_calculate_parent_uvs( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_uv_layers, + const int parent_index, + /*const*/ MTFace **mtfaces, + float (*r_uv)[2]) { if (psmd == NULL) { return; @@ -292,20 +296,22 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { - psys_interpolate_uvs(mtfaces[j] + num, - mface->v4, - particle->fuv, - r_uv[j]); + psys_interpolate_uvs( + mtfaces[j] + num, + mface->v4, + particle->fuv, + r_uv[j]); } } } -static void particle_calculate_parent_mcol(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_uv_layers, - const int parent_index, - /*const*/ MCol **mcols, - MCol *r_mcol) +static void particle_calculate_parent_mcol( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_uv_layers, + const int parent_index, + /*const*/ MCol **mcols, + MCol *r_mcol) { if (psmd == NULL) { return; @@ -324,21 +330,23 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { - psys_interpolate_mcol(mcols[j] + num, - mface->v4, - particle->fuv, - &r_mcol[j]); + psys_interpolate_mcol( + mcols[j] + num, + mface->v4, + particle->fuv, + &r_mcol[j]); } } } /* Used by interpolated children. */ -static void particle_interpolate_children_uvs(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_uv_layers, - const int child_index, - /*const*/ MTFace **mtfaces, - float (*r_uv)[2]) +static void particle_interpolate_children_uvs( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_uv_layers, + const int child_index, + /*const*/ MTFace **mtfaces, + float (*r_uv)[2]) { if (psmd == NULL) { return; @@ -352,20 +360,22 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_uv_layers; j++) { - psys_interpolate_uvs(mtfaces[j] + num, - mface->v4, - particle->fuv, - r_uv[j]); + psys_interpolate_uvs( + mtfaces[j] + num, + mface->v4, + particle->fuv, + r_uv[j]); } } } -static void particle_interpolate_children_mcol(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const int num_col_layers, - const int child_index, - /*const*/ MCol **mcols, - MCol *r_mcol) +static void particle_interpolate_children_mcol( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const int num_col_layers, + const int child_index, + /*const*/ MCol **mcols, + MCol *r_mcol) { if (psmd == NULL) { return; @@ -379,23 +389,25 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys, if (num != DMCACHE_NOTFOUND) { MFace *mface = &psmd->mesh_final->mface[num]; for (int j = 0; j < num_col_layers; j++) { - psys_interpolate_mcol(mcols[j] + num, - mface->v4, - particle->fuv, - &r_mcol[j]); + psys_interpolate_mcol( + mcols[j] + num, + mface->v4, + particle->fuv, + &r_mcol[j]); } } } -static void particle_calculate_uvs(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const bool is_simple, - const int num_uv_layers, - const int parent_index, - const int child_index, - /*const*/ MTFace **mtfaces, - float (**r_parent_uvs)[2], - float (**r_uv)[2]) +static void particle_calculate_uvs( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const bool is_simple, + const int num_uv_layers, + const int parent_index, + const int child_index, + /*const*/ MTFace **mtfaces, + float (**r_parent_uvs)[2], + float (**r_uv)[2]) { if (psmd == NULL) { return; @@ -433,15 +445,16 @@ static void particle_calculate_uvs(ParticleSystem *psys, } } -static void particle_calculate_mcol(ParticleSystem *psys, - ParticleSystemModifierData *psmd, - const bool is_simple, - const int num_col_layers, - const int parent_index, - const int child_index, - /*const*/ MCol **mcols, - MCol **r_parent_mcol, - MCol **r_mcol) +static void particle_calculate_mcol( + ParticleSystem *psys, + ParticleSystemModifierData *psmd, + const bool is_simple, + const int num_col_layers, + const int parent_index, + const int child_index, + /*const*/ MCol **mcols, + MCol **r_parent_mcol, + MCol **r_mcol) { if (psmd == NULL) { return; @@ -508,12 +521,14 @@ static int particle_batch_cache_fill_segments( const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN); if (is_simple && *r_parent_uvs == NULL) { /* TODO(sergey): For edit mode it should be edit->totcached. */ - *r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart, - "Parent particle UVs"); + *r_parent_uvs = MEM_callocN( + sizeof(*r_parent_uvs) * psys->totpart, + "Parent particle UVs"); } if (is_simple && *r_parent_mcol == NULL) { - *r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart, - "Parent particle MCol"); + *r_parent_mcol = MEM_callocN( + sizeof(*r_parent_mcol) * psys->totpart, + "Parent particle MCol"); } int curr_point = start_index; for (int i = 0; i < num_path_keys; i++) { @@ -552,17 +567,16 @@ static int particle_batch_cache_fill_segments( for (int k = 0; k < num_uv_layers; k++) { GWN_vertbuf_attr_set( hair_cache->pos, uv_id[k], curr_point, - (is_simple && is_child) - ? (*r_parent_uvs)[psys->child[i].parent][k] - : uv[k]); + (is_simple && is_child) ? + (*r_parent_uvs)[psys->child[i].parent][k] : uv[k]); } for (int k = 0; k < num_col_layers; k++) { /* TODO Put the conversion outside the loop */ unsigned short scol[4]; - particle_pack_mcol((is_simple && is_child) - ? &(*r_parent_mcol)[psys->child[i].parent][k] - : &mcol[k], - scol); + particle_pack_mcol( + (is_simple && is_child) ? + &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], + scol); GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol); } } @@ -580,17 +594,16 @@ static int particle_batch_cache_fill_segments( for (int k = 0; k < num_uv_layers; k++) { GWN_vertbuf_attr_set( hair_cache->pos, uv_id[k], curr_point, - (is_simple && is_child) - ? (*r_parent_uvs)[psys->child[i].parent][k] - : uv[k]); + (is_simple && is_child) ? + (*r_parent_uvs)[psys->child[i].parent][k] : uv[k]); } for (int k = 0; k < num_col_layers; k++) { /* TODO Put the conversion outside the loop */ unsigned short scol[4]; - particle_pack_mcol((is_simple && is_child) - ? &(*r_parent_mcol)[psys->child[i].parent][k] - : &mcol[k], - scol); + particle_pack_mcol( + (is_simple && is_child) ? + &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], + scol); GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol); } if (!is_simple) { @@ -632,7 +645,7 @@ static void particle_batch_cache_fill_segments_proc_pos( } if (total_len > 0.0f) { /* Divide by total length to have a [0-1] number. */ - for (int j = 0; j <= path->segments; j++, seg_data_first+=4) { + for (int j = 0; j <= path->segments; j++, seg_data_first += 4) { seg_data_first[3] /= total_len; } } @@ -669,18 +682,20 @@ static int particle_batch_cache_fill_strands_data( const int num_path_keys, Gwn_VertBufRaw *data_step, float (***r_parent_uvs)[2], Gwn_VertBufRaw *uv_step, MTFace **mtfaces, int num_uv_layers, - MCol ***r_parent_mcol, Gwn_VertBufRaw *col_step, MCol **mcols, int num_col_layers) + MCol ***r_parent_mcol, Gwn_VertBufRaw *col_step, MCol **mcols, int num_col_layers) { const bool is_simple = (psys->part->childtype == PART_CHILD_PARTICLES); const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN); if (is_simple && *r_parent_uvs == NULL) { /* TODO(sergey): For edit mode it should be edit->totcached. */ - *r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart, - "Parent particle UVs"); + *r_parent_uvs = MEM_callocN( + sizeof(*r_parent_uvs) * psys->totpart, + "Parent particle UVs"); } if (is_simple && *r_parent_mcol == NULL) { - *r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart, - "Parent particle MCol"); + *r_parent_mcol = MEM_callocN( + sizeof(*r_parent_mcol) * psys->totpart, + "Parent particle MCol"); } int curr_point = start_index; for (int i = 0; i < num_path_keys; i++) { @@ -689,7 +704,7 @@ static int particle_batch_cache_fill_strands_data( continue; } - unsigned int *seg_data = (unsigned int *)GWN_vertbuf_raw_step(data_step); + uint *seg_data = (uint *)GWN_vertbuf_raw_step(data_step); *seg_data = (curr_point & 0xFFFFFF) | (path->segments << 24); curr_point += path->segments + 1; @@ -719,10 +734,10 @@ static int particle_batch_cache_fill_strands_data( } for (int k = 0; k < num_col_layers; k++) { unsigned short *scol = (unsigned short *)GWN_vertbuf_raw_step(col_step + k); - particle_pack_mcol((is_simple && is_child) - ? &(*r_parent_mcol)[psys->child[i].parent][k] - : &mcol[k], - scol); + particle_pack_mcol( + (is_simple && is_child) ? + &(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k], + scol); } if (!is_simple) { MEM_freeN(uv); @@ -733,8 +748,9 @@ static int particle_batch_cache_fill_strands_data( return curr_point; } -static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCache *cache, - int subdiv) +static void particle_batch_cache_ensure_procedural_final_points( + ParticleHairCache *cache, + int subdiv) { /* Same format as point_tex. */ Gwn_VertFormat format = { 0 }; @@ -752,10 +768,11 @@ static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCach cache->final[subdiv].proc_tex = GPU_texture_create_from_vertbuf(cache->final[subdiv].proc_buf); } -static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit, - ParticleSystem *psys, - ModifierData *md, - ParticleHairCache *cache) +static void particle_batch_cache_ensure_procedural_strand_data( + PTCacheEdit *edit, + ParticleSystem *psys, + ModifierData *md, + ParticleHairCache *cache) { int active_uv = 0; int active_col = 0; @@ -783,13 +800,13 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit MCol **parent_mcol = NULL; Gwn_VertFormat format_data = {0}; - unsigned int data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT); + uint data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT); Gwn_VertFormat format_uv = {0}; - unsigned int uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); Gwn_VertFormat format_col = {0}; - unsigned int col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); + uint col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); memset(cache->uv_layer_names, 0, sizeof(cache->uv_layer_names)); memset(cache->col_layer_names, 0, sizeof(cache->col_layer_names)); @@ -806,7 +823,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GWN_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]); const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i); - unsigned int hash = BLI_ghashutil_strhash_p(name); + uint hash = BLI_ghashutil_strhash_p(name); int n = 0; BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%u", hash); BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash); @@ -822,7 +839,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit GWN_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]); const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i); - unsigned int hash = BLI_ghashutil_strhash_p(name); + uint hash = BLI_ghashutil_strhash_p(name); int n = 0; BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%u", hash); @@ -909,15 +926,16 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit } } -static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit, - ParticleSystem *psys, - ParticleHairCache *cache, - int thickness_res, - int subdiv) +static void particle_batch_cache_ensure_procedural_indices( + PTCacheEdit *edit, + ParticleSystem *psys, + ParticleHairCache *cache, + int thickness_res, + int subdiv) { BLI_assert(thickness_res <= MAX_THICKRES); /* Cylinder strip not currently supported. */ - if (cache->final[subdiv].proc_hairs[thickness_res-1] != NULL) { + if (cache->final[subdiv].proc_hairs[thickness_res - 1] != NULL) { return; } @@ -957,15 +975,17 @@ static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit, } } - cache->final[subdiv].proc_hairs[thickness_res-1] = GWN_batch_create_ex(prim_type, - vbo, - GWN_indexbuf_build(&elb), - GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); + cache->final[subdiv].proc_hairs[thickness_res - 1] = GWN_batch_create_ex( + prim_type, + vbo, + GWN_indexbuf_build(&elb), + GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX); } -static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit, - ParticleSystem *psys, - ParticleHairCache *cache) +static void particle_batch_cache_ensure_procedural_pos( + PTCacheEdit *edit, + ParticleSystem *psys, + ParticleHairCache *cache) { if (cache->proc_point_buf != NULL) { return; @@ -1011,10 +1031,11 @@ static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit, cache->point_tex = GPU_texture_create_from_vertbuf(cache->proc_point_buf); } -static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, - ParticleSystem *psys, - ModifierData *md, - ParticleHairCache *hair_cache) +static void particle_batch_cache_ensure_pos_and_seg( + PTCacheEdit *edit, + ParticleSystem *psys, + ModifierData *md, + ParticleHairCache *hair_cache) { if (hair_cache->pos != NULL && hair_cache->indices != NULL) { return; @@ -1090,10 +1111,11 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, GWN_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_count); Gwn_IndexBufBuilder elb; - GWN_indexbuf_init_ex(&elb, - GWN_PRIM_LINE_STRIP, - hair_cache->elems_count, hair_cache->point_count, - true); + GWN_indexbuf_init_ex( + &elb, + GWN_PRIM_LINE_STRIP, + hair_cache->elems_count, hair_cache->point_count, + true); if (num_uv_layers || num_col_layers) { BKE_mesh_tessface_ensure(psmd->mesh_final); @@ -1163,9 +1185,10 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit, hair_cache->indices = GWN_indexbuf_build(&elb); } -static void particle_batch_cache_ensure_pos(Object *object, - ParticleSystem *psys, - ParticlePointCache *point_cache) +static void particle_batch_cache_ensure_pos( + Object *object, + ParticleSystem *psys, + ParticlePointCache *point_cache) { if (point_cache->pos != NULL) { return; @@ -1240,9 +1263,10 @@ static void particle_batch_cache_ensure_pos(Object *object, } } -static void drw_particle_update_ptcache_edit(Object *object_eval, - ParticleSystem *psys, - PTCacheEdit *edit) +static void drw_particle_update_ptcache_edit( + Object *object_eval, + ParticleSystem *psys, + PTCacheEdit *edit) { if (edit->psys == NULL) { return; @@ -1259,16 +1283,18 @@ static void drw_particle_update_ptcache_edit(Object *object_eval, } if (edit->pathcache == NULL) { Depsgraph *depsgraph = draw_ctx->depsgraph; - psys_cache_edit_paths(depsgraph, - scene_orig, object_orig, - edit, - DEG_get_ctime(depsgraph), - DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); + psys_cache_edit_paths( + depsgraph, + scene_orig, object_orig, + edit, + DEG_get_ctime(depsgraph), + DEG_get_mode(depsgraph) == DAG_EVAL_RENDER); } } -static void drw_particle_update_ptcache(Object *object_eval, - ParticleSystem *psys) +static void drw_particle_update_ptcache( + Object *object_eval, + ParticleSystem *psys) { if ((object_eval->mode & OB_MODE_PARTICLE_EDIT) == 0) { return; @@ -1294,11 +1320,11 @@ Gwn_Batch *DRW_particles_batch_cache_get_hair( drw_particle_update_ptcache(object, psys); ensure_seg_pt_count(NULL, psys, &cache->hair); particle_batch_cache_ensure_pos_and_seg(NULL, psys, md, &cache->hair); - cache->hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP, - cache->hair.pos, - cache->hair.indices); + cache->hair.hairs = GWN_batch_create( + GWN_PRIM_LINE_STRIP, + cache->hair.pos, + cache->hair.indices); } - return cache->hair.hairs; } @@ -1326,14 +1352,16 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_strands( drw_particle_update_ptcache_edit(object, psys, edit); ensure_seg_pt_count(edit, psys, &cache->edit_hair); particle_batch_cache_ensure_pos_and_seg(edit, psys, NULL, &cache->edit_hair); - cache->edit_hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP, - cache->edit_hair.pos, - cache->edit_hair.indices); + cache->edit_hair.hairs = GWN_batch_create( + GWN_PRIM_LINE_STRIP, + cache->edit_hair.pos, + cache->edit_hair.indices); return cache->edit_hair.hairs; } -static void ensure_edit_inner_points_count(const PTCacheEdit *edit, - ParticleBatchCache *cache) +static void ensure_edit_inner_points_count( + const PTCacheEdit *edit, + ParticleBatchCache *cache) { if (cache->edit_inner_pos != NULL) { return; @@ -1346,9 +1374,10 @@ static void ensure_edit_inner_points_count(const PTCacheEdit *edit, } } -static void edit_colors_get(PTCacheEdit *edit, - float selected_color[4], - float normal_color[4]) +static void edit_colors_get( + PTCacheEdit *edit, + float selected_color[4], + float normal_color[4]) { rgb_uchar_to_float(selected_color, edit->sel_col); rgb_uchar_to_float(normal_color, edit->nosel_col); @@ -1410,14 +1439,16 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_inner_points( drw_particle_update_ptcache_edit(object, psys, edit); ensure_edit_inner_points_count(edit, cache); particle_batch_cache_ensure_edit_inner_pos(edit, cache); - cache->edit_inner_points = GWN_batch_create(GWN_PRIM_POINTS, - cache->edit_inner_pos, - NULL); + cache->edit_inner_points = GWN_batch_create( + GWN_PRIM_POINTS, + cache->edit_inner_pos, + NULL); return cache->edit_inner_points; } -static void ensure_edit_tip_points_count(const PTCacheEdit *edit, - ParticleBatchCache *cache) +static void ensure_edit_tip_points_count( + const PTCacheEdit *edit, + ParticleBatchCache *cache) { if (cache->edit_tip_pos != NULL) { return; @@ -1475,9 +1506,10 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_tip_points( drw_particle_update_ptcache_edit(object, psys, edit); ensure_edit_tip_points_count(edit, cache); particle_batch_cache_ensure_edit_tip_pos(edit, cache); - cache->edit_tip_points = GWN_batch_create(GWN_PRIM_POINTS, - cache->edit_tip_pos, - NULL); + cache->edit_tip_points = GWN_batch_create( + GWN_PRIM_POINTS, + cache->edit_tip_pos, + NULL); return cache->edit_tip_points; } @@ -1515,7 +1547,7 @@ bool particles_ensure_procedural_data( particle_batch_cache_ensure_procedural_final_points(&cache->hair, subdiv); need_ft_update = true; } - if ((*r_hair_cache)->final[subdiv].proc_hairs[thickness_res-1] == NULL) { + if ((*r_hair_cache)->final[subdiv].proc_hairs[thickness_res - 1] == NULL) { particle_batch_cache_ensure_procedural_indices(NULL, psys, &cache->hair, thickness_res, subdiv); } diff --git a/source/blender/draw/intern/draw_debug.c b/source/blender/draw/intern/draw_debug.c index 00960d92962..0e4176f90a6 100644 --- a/source/blender/draw/intern/draw_debug.c +++ b/source/blender/draw/intern/draw_debug.c @@ -65,7 +65,7 @@ void DRW_debug_polygon_v3(const float (*v)[3], const int vert_len, const float c BLI_assert(vert_len > 1); for (int i = 0; i < vert_len; ++i) { - DRW_debug_line_v3v3(v[i], v[(i+1)%vert_len], color); + DRW_debug_line_v3v3(v[i], v[(i + 1) % vert_len], color); } } diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 2b1f658a276..8cb9e0886a9 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -126,7 +126,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex( DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", part->rad_tip * part->rad_scale * 0.5f); DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", (part->shape_flag & PART_SHAPE_CLOSE_TIP) != 0); /* TODO(fclem): Until we have a better way to cull the hair and render with orco, bypass culling test. */ - DRW_shgroup_call_object_add_no_cull(shgrp, hair_cache->final[subdiv].proc_hairs[thickness_res-1], object); + DRW_shgroup_call_object_add_no_cull(shgrp, hair_cache->final[subdiv].proc_hairs[thickness_res - 1], object); /* Transform Feedback subdiv. */ if (need_ft_update) { diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index c5d7f205687..054db5968cc 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -367,7 +367,7 @@ void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, float (*obm } static void drw_shgroup_call_procedural_add_ex( - DRWShadingGroup *shgroup, Gwn_PrimType prim_type, unsigned int prim_count, float (*obmat)[4]) + DRWShadingGroup *shgroup, Gwn_PrimType prim_type, uint prim_count, float (*obmat)[4]) { BLI_assert(ELEM(shgroup->type, DRW_SHG_NORMAL, DRW_SHG_FEEDBACK_TRANSFORM)); @@ -383,17 +383,17 @@ static void drw_shgroup_call_procedural_add_ex( BLI_LINKS_APPEND(&shgroup->calls, call); } -void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, unsigned int point_count, float (*obmat)[4]) +void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_count, float (*obmat)[4]) { drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_POINTS, point_count, obmat); } -void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, unsigned int line_count, float (*obmat)[4]) +void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, uint line_count, float (*obmat)[4]) { drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_LINES, line_count, obmat); } -void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, unsigned int tria_count, float (*obmat)[4]) +void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, uint tria_count, float (*obmat)[4]) { drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_TRIS, tria_count, obmat); } diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index 98135a614d9..94250920c57 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -749,11 +749,12 @@ static void draw_matrices_model_prepare(DRWCallState *st) /* No need to go further the call will not be used. */ if ((st->flag & DRW_CALL_CULLED) != 0 && (st->flag & DRW_CALL_BYPASS_CULLING) == 0) + { return; - + } /* Order matters */ if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE | - DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC)) + DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC)) { mul_m4_m4m4(st->modelview, DST.view_data.matstate.mat[DRW_MAT_VIEW], st->model); } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 3449e9b0190..bfd37db4bef 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1533,7 +1533,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index layout_sub->space = 0; if ((index == RNA_NO_INDEX && is_array) && - ((ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) == 0)) + ((ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) == 0)) { char name_with_suffix[UI_MAX_DRAW_STR + 2]; char str[2] = {'\0'}; @@ -1548,8 +1548,8 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index *s++ = '\0'; } but = uiDefBut( - block, UI_BTYPE_LABEL, 0, use_prefix ? name_with_suffix : str, - 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + block, UI_BTYPE_LABEL, 0, use_prefix ? name_with_suffix : str, + 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->drawflag |= UI_BUT_TEXT_RIGHT; but->drawflag &= ~UI_BUT_TEXT_LEFT; } @@ -1557,8 +1557,8 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index else { if (name) { but = uiDefBut( - block, UI_BTYPE_LABEL, 0, name, - 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + block, UI_BTYPE_LABEL, 0, name, + 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); but->drawflag |= UI_BUT_TEXT_RIGHT; but->drawflag &= ~UI_BUT_TEXT_LEFT; } diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 26cb2241ea5..71f647b7009 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -717,7 +717,7 @@ static void rna_View3DShading_studio_light_orientation_set(PointerRNA *UNUSED(pt static int rna_View3DShading_studio_light_get(PointerRNA *ptr) { View3D *v3d = (View3D *)ptr->data; - const int flag = v3d->drawtype == OB_MATERIAL? STUDIOLIGHT_ORIENTATION_WORLD: 0; + const int flag = (v3d->drawtype == OB_MATERIAL) ? STUDIOLIGHT_ORIENTATION_WORLD : 0; StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, flag); BLI_strncpy(v3d->shading.studio_light, sl->name, FILE_MAXFILE); return sl->index; @@ -747,7 +747,8 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf( if ((sl->flag & STUDIOLIGHT_EXTERNAL_FILE) == 0) { /* always show internal lights */ show_studiolight = true; - } else { + } + else { switch (v3d->drawtype) { case OB_SOLID: case OB_TEXTURE: diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c index bbb4608ee71..08dbcf81256 100644 --- a/source/blender/modifiers/intern/MOD_normal_edit.c +++ b/source/blender/modifiers/intern/MOD_normal_edit.c @@ -415,7 +415,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, Mes LIB_ID_CREATE_NO_DEG_TAG | LIB_ID_COPY_NO_PREVIEW, false); - } else { + } + else { result = mesh; } -- cgit v1.2.3