Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-31 15:51:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-31 15:55:15 +0300
commitd8dbd49a2f23b7637f05fc058f39bdf6ab706624 (patch)
tree0805b9372c82ae6505d87e879824efe1d3e32f8e /source/blender/modifiers/intern/MOD_fluidsim_util.c
parent8987f7987d8160e1f6e79e8c85d6ce65b885ab25 (diff)
Cleanup: style, use braces in source/
Automated using clang-tidy.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_fluidsim_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c42
1 files changed, 28 insertions, 14 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