From b340f930ec5639f24e7e2d47fab221fb752b61dd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 28 Apr 2012 06:31:57 +0000 Subject: style cleanup: changes to brace placement / newlines - for/while/if/switch --- source/blender/modifiers/intern/MOD_boolean.c | 2 +- source/blender/modifiers/intern/MOD_cast.c | 14 +++++--- source/blender/modifiers/intern/MOD_collision.c | 18 ++++------ source/blender/modifiers/intern/MOD_displace.c | 2 +- source/blender/modifiers/intern/MOD_explode.c | 4 +-- .../blender/modifiers/intern/MOD_fluidsim_util.c | 42 ++++++++-------------- source/blender/modifiers/intern/MOD_mask.c | 15 +++----- source/blender/modifiers/intern/MOD_remesh.c | 6 ++-- source/blender/modifiers/intern/MOD_screw.c | 2 +- source/blender/modifiers/intern/MOD_simpledeform.c | 9 ++--- source/blender/modifiers/intern/MOD_util.c | 2 +- source/blender/modifiers/intern/MOD_warp.c | 2 +- source/blender/modifiers/intern/MOD_wave.c | 4 +-- .../blender/modifiers/intern/MOD_weightvg_util.c | 6 ++-- 14 files changed, 55 insertions(+), 73 deletions(-) (limited to 'source/blender/modifiers/intern') diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index e4e89db403d..c11d6fc50af 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -97,7 +97,7 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh DerivedMesh *result = NULL; if (derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) { - switch(operation) { + switch (operation) { case eBooleanModifierOp_Intersect: result = CDDM_new(0, 0, 0, 0, 0); break; diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 15940112527..8ad5b72204b 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -423,8 +423,11 @@ static void cuboid_do( if (has_radius) { if (fabsf(tmp_co[0]) > cmd->radius || - fabsf(tmp_co[1]) > cmd->radius || - fabsf(tmp_co[2]) > cmd->radius) continue; + fabsf(tmp_co[1]) > cmd->radius || + fabsf(tmp_co[2]) > cmd->radius) + { + continue; + } } for (j = 0; j < dvert[i].totweight; ++j) { @@ -521,8 +524,11 @@ static void cuboid_do( if (has_radius) { if (fabsf(tmp_co[0]) > cmd->radius || - fabsf(tmp_co[1]) > cmd->radius || - fabsf(tmp_co[2]) > cmd->radius) continue; + fabsf(tmp_co[1]) > cmd->radius || + fabsf(tmp_co[2]) > cmd->radius) + { + continue; + } } octant = 0; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index b3faf6c140a..4c5ce184c22 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -71,8 +71,7 @@ static void freeData(ModifierData *md) { CollisionModifierData *collmd = (CollisionModifierData*) md; - if (collmd) - { + if (collmd) { if (collmd->bvhtree) BLI_bvhtree_free(collmd->bvhtree); if (collmd->x) @@ -120,14 +119,12 @@ static void deformVerts(ModifierData *md, Object *ob, if (derivedData) dm = CDDM_copy(derivedData); else if (ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob); - if (!ob->pd) - { + if (!ob->pd) { printf("CollisionModifier deformVerts: Should not happen!\n"); return; } - if (dm) - { + if (dm) { float current_time = 0; unsigned int numverts = 0; @@ -141,20 +138,17 @@ static void deformVerts(ModifierData *md, Object *ob, numverts = dm->getNumVerts ( dm ); - if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) - { + if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) { unsigned int i; // check if mesh has changed if (collmd->x && (numverts != collmd->numverts)) freeData((ModifierData *)collmd); - if (collmd->time_xnew == -1000) // first time - { + if (collmd->time_xnew == -1000) { /* first time */ collmd->x = dm->dupVertArray(dm); // frame start position - for ( i = 0; i < numverts; i++ ) - { + for ( i = 0; i < numverts; i++ ) { // we save global positions mul_m4_v3( ob->obmat, collmd->x[i].co ); } diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 293a8a8c686..70294588fd4 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -208,7 +208,7 @@ static void displaceModifier_do( delta *= strength; CLAMP(delta, -10000, 10000); - switch(dmd->direction) { + switch (dmd->direction) { case MOD_DISP_DIR_X: vertexCos[i][0] += delta; break; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index a1dc69918c2..11542dc4c1a 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -679,7 +679,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) for (i=0,fs=facesplit; igetTessFaceData(dm, i, CD_MFACE); - switch(*fs) { + switch (*fs) { case 3: case 10: case 11: @@ -711,7 +711,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) break; } - switch(*fs) { + switch (*fs) { case 3: case 6: case 9: 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; idw; int j; @@ -229,8 +228,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, BLI_ghash_free(vgroupHash, NULL, NULL); MEM_freeN(bone_select_array); } - else /* --- Using Nominated VertexGroup only --- */ - { + else { /* --- Using Nominated VertexGroup only --- */ int defgrp_index = defgroup_name_index(ob, mmd->vgroup); /* get dverts */ @@ -245,8 +243,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, vertHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask vert2 bh"); /* add vertices which exist in vertexgroup into ghash for filtering */ - for (i= 0, dv= dvert; i < maxVerts; i++, dv++) - { + for (i= 0, dv= dvert; i < maxVerts; i++, dv++) { const int weight_set= defvert_find_weight(dv, defgrp_index) != 0.0f; /* check if include vert in vertHash */ @@ -277,8 +274,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* loop over edges and faces, and do the same thing to * ensure that they only reference existing verts */ - for (i = 0; i < maxEdges; i++) - { + for (i = 0; i < maxEdges; i++) { MEdge me; dm->getEdge(dm, i, &me); @@ -290,8 +286,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, numEdges++; } } - for (i = 0; i < maxPolys; i++) - { + for (i = 0; i < maxPolys; i++) { MPoly *mp = &mpoly[i]; MLoop *ml = mloop + mp->loopstart; int ok = TRUE; diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index d408e5a3bee..56b6493eda6 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -103,8 +103,10 @@ static void *dualcon_alloc_output(int totvert, int totquad) DualConOutput *output; if (!(output = MEM_callocN(sizeof(DualConOutput), - "DualConOutput"))) + "DualConOutput"))) + { return NULL; + } output->dm = CDDM_new(totvert, 0, 0, 4*totquad, totquad); return output; @@ -164,7 +166,7 @@ static DerivedMesh *applyModifier(ModifierData *md, if (rmd->flag & MOD_REMESH_FLOOD_FILL) flags |= DUALCON_FLOOD_FILL; - switch(rmd->mode) { + switch (rmd->mode) { case MOD_REMESH_CENTROID: mode = DUALCON_CENTROID; break; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index ae21d3d66ad..60eed4abcb1 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -179,7 +179,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (!totvert) return CDDM_from_template(dm, 0, 0, 0, 0, 0); - switch(ltmd->axis) { + switch (ltmd->axis) { case 0: other_axis_1=1; other_axis_2=2; diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 6c1325b0bde..5ac52a97315 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -185,8 +185,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object float lower = FLT_MAX; float upper = -FLT_MAX; - for (i=0; ivgroup_name, &dvert, &vgroup); - switch(smd->mode) - { + switch (smd->mode) { case MOD_SIMPLEDEFORM_MODE_TWIST: simpleDeform_callback = simpleDeform_twist; break; case MOD_SIMPLEDEFORM_MODE_BEND: simpleDeform_callback = simpleDeform_bend; break; case MOD_SIMPLEDEFORM_MODE_TAPER: simpleDeform_callback = simpleDeform_taper; break; @@ -216,8 +214,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object return; //No simpledeform mode? } - for (i=0; ifalloff_type) { + switch (wmd->falloff_type) { case eWarp_Falloff_None: fac = 1.0f; break; diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 78e76e27c02..5fa3090cd87 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -247,7 +247,7 @@ static void waveModifier_do(WaveModifierData *md, } } - switch(wmd_axis) { + switch (wmd_axis) { case MOD_WAVE_X|MOD_WAVE_Y: amplit = sqrtf(x*x + y*y); break; @@ -270,7 +270,7 @@ static void waveModifier_do(WaveModifierData *md, if (falloff != 0.0f) { float dist = 0.0f; - switch(wmd_axis) { + switch (wmd_axis) { case MOD_WAVE_X|MOD_WAVE_Y: dist = sqrtf(x*x + y*y); break; diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 5ce435a7ca5..1f886812ab7 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -69,7 +69,9 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH, MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM, MOD_WVG_MAPPING_STEP)) + { return; + } /* Map each weight (vertex) to its new value, accordingly to the chosen mode. */ for (i = 0; i < num; ++i) { @@ -77,7 +79,7 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm /* Code borrowed from the warp modifier. */ /* Closely matches PROP_SMOOTH and similar. */ - switch(falloff_type) { + switch (falloff_type) { case MOD_WVG_MAPPING_CURVE: fac = curvemapping_evaluateF(cmap, 0, fac); break; @@ -157,7 +159,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne texres.nor = NULL; get_texture_value(texture, tex_co[idx], &texres); /* Get the good channel value... */ - switch(tex_use_channel) { + switch (tex_use_channel) { case MOD_WVG_MASK_TEX_USE_INT: org_w[i] = (new_w[i] * texres.tin * fact) + (org_w[i] * (1.0f - (texres.tin*fact))); break; -- cgit v1.2.3