diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_fluidsim_util.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_fluidsim_util.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index fe0cb2e650f..8d3b1871c51 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -66,8 +66,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) { #ifdef WITH_MOD_FLUID - if (fluidmd) - { + if (fluidmd) { FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); fluidmd->fss = fss; @@ -184,8 +183,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam // get numverts + numfaces first // ------------------------------------------------ gzf = BLI_gzopen(filename, "rb"); - if (!gzf) - { + if (!gzf) { return NULL; } @@ -216,15 +214,13 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam return NULL; gzf = BLI_gzopen(filename, "rb"); - if (!gzf) - { + if (!gzf) { return NULL; } dm = CDDM_new(numverts, 0, 0, numfaces * 3, numfaces); - if (!dm) - { + if (!dm) { gzclose(gzf); return NULL; } @@ -240,8 +236,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam // should be the same as numverts gotBytes = gzread(gzf, &wri, sizeof(wri)); - if (wri != numverts) - { + if (wri != numverts) { if (dm) dm->release(dm); gzclose(gzf); @@ -249,8 +244,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam } normals = MEM_callocN(sizeof(short) * numverts * 3, "fluid_tmp_normals" ); - if (!normals) - { + if (!normals) { if (dm) dm->release(dm); gzclose(gzf); @@ -258,8 +252,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam } // read normals from file (but don't save them yet) - for (i=numverts, no_s= normals; i>0; i--, no_s += 3) - { + for (i=numverts, no_s= normals; i>0; i--, no_s += 3) { gotBytes = gzread(gzf, no, sizeof(float) * 3); normal_float_to_short_v3(no_s, no); } @@ -279,8 +272,7 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_exam // read triangles from file mp = CDDM_get_polys(dm); ml = CDDM_get_loops(dm); - for (i=0; i < numfaces; i++, mp++, ml += 3) - { + for (i=0; i < numfaces; i++, mp++, ml += 3) { int face[3]; gotBytes = gzread(gzf, face, sizeof(int) * 3); @@ -390,8 +382,7 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * if (fss->meshVelocities) MEM_freeN(fss->meshVelocities); - if (len<7) - { + if (len < 7) { return; } @@ -409,25 +400,21 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh * filename[len-4] = 'l'; gzf = BLI_gzopen(filename, "rb"); - if (!gzf) - { + if (!gzf) { MEM_freeN(fss->meshVelocities); fss->meshVelocities = NULL; return; } gzread(gzf, &wri, sizeof( wri )); - if (wri != totvert) - { + if (wri != totvert) { MEM_freeN(fss->meshVelocities); fss->meshVelocities = NULL; return; } - for (i=0; i<totvert;i++) - { - for (j=0; j<3; j++) - { + for (i=0; i<totvert;i++) { + for (j=0; j<3; j++) { gzread(gzf, &wrf, sizeof( wrf )); velarray[i].vel[j] = wrf; } @@ -483,8 +470,7 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim dm = fluidsim_read_obj(targetFile, &mp_example); - if (!dm) - { + if (!dm) { // switch, abort background rendering when fluidsim mesh is missing const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp |