diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 15:51:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-31 15:55:15 +0300 |
commit | d8dbd49a2f23b7637f05fc058f39bdf6ab706624 (patch) | |
tree | 0805b9372c82ae6505d87e879824efe1d3e32f8e /source/blender/modifiers | |
parent | 8987f7987d8160e1f6e79e8c85d6ce65b885ab25 (diff) |
Cleanup: style, use braces in source/
Automated using clang-tidy.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim_util.c | 42 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_ocean.c | 3 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_remesh.c | 6 |
3 files changed, 34 insertions, 17 deletions
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 0776806f541..3083d89d555 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -63,8 +63,9 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fluidmd->fss = fss; - if (!fss) + if (!fss) { return; + } fss->fmd = fluidmd; fss->type = OB_FLUIDSIM_ENABLE; @@ -186,22 +187,25 @@ static Mesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example) gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1; /* read number of normals */ - if (gotBytes) + if (gotBytes) { gotBytes = gzread(gzf, &wri, sizeof(wri)); + } /* skip normals */ gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1; /* get no. of triangles */ - if (gotBytes) + if (gotBytes) { gotBytes = gzread(gzf, &wri, sizeof(wri)); + } numfaces = wri; gzclose(gzf); /* ------------------------------------------------ */ - if (!numfaces || !numverts || !gotBytes) + if (!numfaces || !numverts || !gotBytes) { return NULL; + } gzf = BLI_gzopen(filename, "rb"); if (!gzf) { @@ -221,22 +225,25 @@ static Mesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example) /* read vertex position from file */ mv = mesh->mvert; - for (i = 0; i < numverts; i++, mv++) + for (i = 0; i < numverts; i++, mv++) { gotBytes = gzread(gzf, mv->co, sizeof(float) * 3); + } /* should be the same as numverts */ gotBytes = gzread(gzf, &wri, sizeof(wri)); if (wri != numverts) { - if (mesh) + if (mesh) { BKE_id_free(NULL, mesh); + } gzclose(gzf); return NULL; } normals = MEM_calloc_arrayN(numverts, 3 * sizeof(short), "fluid_tmp_normals"); if (!normals) { - if (mesh) + if (mesh) { BKE_id_free(NULL, mesh); + } gzclose(gzf); return NULL; } @@ -252,8 +259,9 @@ static Mesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example) if (wri != numfaces) { printf("Fluidsim: error in reading data from file.\n"); - if (mesh) + if (mesh) { BKE_id_free(NULL, mesh); + } gzclose(gzf); MEM_freeN(normals); return NULL; @@ -385,15 +393,17 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, Mesh *mesh, c /* mesh and vverts have to be valid from loading... */ - if (fss->meshVelocities) + if (fss->meshVelocities) { MEM_freeN(fss->meshVelocities); + } if (len < 7) { return; } - if (fss->domainNovecgen > 0) + if (fss->domainNovecgen > 0) { return; + } fss->meshVelocities = MEM_calloc_arrayN( mesh->totvert, sizeof(FluidVertexVelocity), "Fluidsim_velocities"); @@ -510,8 +520,9 @@ static Mesh *fluidsim_read_cache( fluidsim_read_vel_cache(fluidmd, newmesh, targetFile); } else { - if (fss->meshVelocities) + if (fss->meshVelocities) { MEM_freeN(fss->meshVelocities); + } fss->meshVelocities = NULL; } @@ -536,12 +547,14 @@ Mesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, framenr = (int)DEG_get_ctime(depsgraph); /* only handle fluidsim domains */ - if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN)) + if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN)) { return mesh; + } /* sanity check */ - if (!fluidmd || !fluidmd->fss) + if (!fluidmd || !fluidmd->fss) { return mesh; + } fss = fluidmd->fss; @@ -556,8 +569,9 @@ Mesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, /* try to read from cache */ /* if the frame is there, fine, otherwise don't do anything */ - if ((result = fluidsim_read_cache(ob, mesh, fluidmd, framenr, useRenderParams))) + if ((result = fluidsim_read_cache(ob, mesh, fluidmd, framenr, useRenderParams))) { return result; + } return mesh; #else diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index cd0046b8a31..5cded96efe2 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -120,8 +120,9 @@ static void freeData(ModifierData *md) OceanModifierData *omd = (OceanModifierData *)md; BKE_ocean_free(omd->ocean); - if (omd->oceancache) + if (omd->oceancache) { BKE_ocean_free_cache(omd->oceancache); + } #else /* WITH_OCEANSIM */ /* unused */ (void)md; diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index daf9a615f3f..23da1ec2754 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -126,8 +126,9 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4]) cur_poly->loopstart = output->curface * 4; cur_poly->totloop = 4; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { mloop[output->curface * 4 + i].v = vert_indices[i]; + } output->curface++; } @@ -145,8 +146,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *UNUSED(c init_dualcon_mesh(&input, mesh); - if (rmd->flag & MOD_REMESH_FLOOD_FILL) + if (rmd->flag & MOD_REMESH_FLOOD_FILL) { flags |= DUALCON_FLOOD_FILL; + } switch (rmd->mode) { case MOD_REMESH_CENTROID: |