From 46045fbb09684ebc74835168ff4c5924261e3fc0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 7 Mar 2012 04:53:43 +0000 Subject: style cleanup - braces & else / if's --- source/blender/blenkernel/intern/DerivedMesh.c | 6 +- source/blender/blenkernel/intern/anim_sys.c | 30 ++-- source/blender/blenkernel/intern/bvhutils.c | 199 ++++++++---------------- source/blender/blenkernel/intern/cloth.c | 3 +- source/blender/blenkernel/intern/dynamicpaint.c | 6 +- source/blender/blenkernel/intern/effect.c | 3 +- source/blender/blenkernel/intern/fcurve.c | 54 +++---- source/blender/blenkernel/intern/implicit.c | 3 +- source/blender/blenkernel/intern/shrinkwrap.c | 9 +- source/blender/blenkernel/intern/sketch.c | 6 +- 10 files changed, 116 insertions(+), 203 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index bc9794db698..f2cdff3d417 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2473,8 +2473,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm) verts[0]=mvert[mface[f].v1].co; verts[1]=mvert[mface[f].v2].co; verts[2]=mvert[mface[f].v3].co; tex_coords[0]=mtface[f].uv[0]; tex_coords[1]=mtface[f].uv[1]; tex_coords[2]=mtface[f].uv[2]; - if(nr_verts==4) - { + if (nr_verts==4) { verts[3]=mvert[mface[f].v4].co; tex_coords[3]=mtface[f].uv[3]; } @@ -2567,8 +2566,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm) sub_v2_v2v2(edge_t1, tex_coords[indices[t*3+2]], tex_coords[indices[t*3+0]]); f2x_area_uv = fabsf(edge_t0[0]*edge_t1[1] - edge_t0[1]*edge_t1[0]); - if ( f2x_area_uv>FLT_EPSILON ) - { + if (f2x_area_uv>FLT_EPSILON) { float norm[3], v0[3], v1[3], f2x_surf_area, fsurf_ratio; sub_v3_v3v3(v0, p1, p0); sub_v3_v3v3(v1, p2, p0); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 90b411b6f20..db8bd8f2066 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1124,15 +1124,12 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i //printf("%p %s %i %f\n", ptr, path, array_index, value); /* get property to write to */ - if (RNA_path_resolve(ptr, path, &new_ptr, &prop)) - { + if (RNA_path_resolve(ptr, path, &new_ptr, &prop)) { /* set value - only for animatable numerical values */ - if (RNA_property_animateable(&new_ptr, prop)) - { + if (RNA_property_animateable(&new_ptr, prop)) { int array_len= RNA_property_array_length(&new_ptr, prop); - if (array_len && array_index >= array_len) - { + if (array_len && array_index >= array_len) { if (G.f & G_DEBUG) { printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d \n", (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "", @@ -1142,8 +1139,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i return 0; } - switch (RNA_property_type(prop)) - { + switch (RNA_property_type(prop)) { case PROP_BOOLEAN: if (array_len) RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value)); @@ -1251,8 +1247,7 @@ static void animsys_evaluate_fcurves (PointerRNA *ptr, ListBase *list, AnimMappe /* check if this F-Curve doesn't belong to a muted group */ if ((fcu->grp == NULL) || (fcu->grp->flag & AGRP_MUTED)==0) { /* check if this curve should be skipped */ - if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) - { + if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) { calculate_fcurve(fcu, ctime); animsys_execute_fcurve(ptr, remap, fcu); } @@ -1277,8 +1272,7 @@ static void animsys_evaluate_drivers (PointerRNA *ptr, AnimData *adt, float ctim short ok= 0; /* check if this driver's curve should be skipped */ - if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) - { + if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) { /* check if driver itself is tagged for recalculation */ if ((driver) && !(driver->flag & DRIVER_FLAG_INVALID)/*&& (driver->flag & DRIVER_FLAG_RECALC)*/) { // XXX driver recalc flag is not set yet by depsgraph! /* evaluate this using values set already in other places */ @@ -1352,8 +1346,7 @@ void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup for (fcu= agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu= fcu->next) { /* check if this curve should be skipped */ - if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) - { + if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) { calculate_fcurve(fcu, ctime); animsys_execute_fcurve(ptr, remap, fcu); } @@ -2195,11 +2188,9 @@ void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float c * that overrides 'rough' work in NLA */ // TODO: need to double check that this all works correctly - if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) - { + if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) { /* evaluate NLA data */ - if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) - { + if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) { /* evaluate NLA-stack * - active action is evaluated as part of the NLA stack as the last item */ @@ -2232,8 +2223,7 @@ void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float c animsys_evaluate_overrides(&id_ptr, adt); /* execute and clear all cached property update functions */ - if (scene) - { + if (scene) { Main *bmain = G.main; // xxx - to get passed in! RNA_property_update_cache_flush(bmain, scene); RNA_property_update_cache_free(); diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 8d9333c8aec..4cade876d09 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -67,8 +67,7 @@ static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, con normal_tri_v3(plane_normal, v0, v1, v2); madd_v3_v3v3fl(p1, ray->origin, ray->direction, m_dist); - if(isect_sweeping_sphere_tri_v3(ray->origin, p1, radius, v0, v1, v2, &idist, hit_point)) - { + if (isect_sweeping_sphere_tri_v3(ray->origin, p1, radius, v0, v1, v2, &idist, hit_point)) { return idist * m_dist; } @@ -111,23 +110,17 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f S = A01 * B1 - A11 * B0; T = A01 * B0 - A00 * B1; - if ( S + T <= Det ) - { - if ( S < 0.0f ) - { - if ( T < 0.0f ) // Region 4 - { - if ( B0 < 0.0f ) - { + if (S + T <= Det) { + if (S < 0.0f) { + if (T < 0.0f) { /* Region 4 */ + if (B0 < 0.0f) { T = 0.0f; - if ( -B0 >= A00 ) - { + if (-B0 >= A00) { S = 1.0f; sqrDist = A00 + 2.0f * B0 + C; lv = 1; } - else - { + else { if(fabsf(A00) > FLT_EPSILON) S = -B0/A00; else @@ -136,23 +129,19 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f le = 0; } } - else - { + else { S = 0.0f; - if ( B1 >= 0.0f ) - { + if (B1 >= 0.0f) { T = 0.0f; sqrDist = C; lv = 0; } - else if ( -B1 >= A11 ) - { + else if (-B1 >= A11) { T = 1.0f; sqrDist = A11 + 2.0f * B1 + C; lv = 2; } - else - { + else { if(fabsf(A11) > FLT_EPSILON) T = -B1 / A11; else @@ -162,23 +151,19 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f } } } - else // Region 3 - { + else { /* Region 3 */ S = 0.0f; - if ( B1 >= 0.0f ) - { + if (B1 >= 0.0f) { T = 0.0f; sqrDist = C; lv = 0; } - else if ( -B1 >= A11 ) - { + else if (-B1 >= A11) { T = 1.0f; sqrDist = A11 + 2.0f * B1 + C; lv = 2; } - else - { + else { if(fabsf(A11) > FLT_EPSILON) T = -B1 / A11; else @@ -188,24 +173,20 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f } } } - else if ( T < 0.0f ) // Region 5 - { + else if (T < 0.0f) { /* Region 5 */ T = 0.0f; - if ( B0 >= 0.0f ) - { + if (B0 >= 0.0f) { S = 0.0f; sqrDist = C; lv = 0; } - else if ( -B0 >= A00 ) - { + else if (-B0 >= A00) { S = 1.0f; sqrDist = A00 + 2.0f * B0 + C; lv = 1; } - else - { - if(fabsf(A00) > FLT_EPSILON) + else { + if (fabsf(A00) > FLT_EPSILON) S = -B0 / A00; else S = 0.0f; @@ -213,8 +194,7 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f le = 0; } } - else // Region 0 - { + else { /* Region 0 */ // Minimum at interior lv float invDet; if(fabsf(Det) > FLT_EPSILON) @@ -224,57 +204,48 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f S *= invDet; T *= invDet; sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0) + - T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; + T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; } } - else - { + else { float tmp0, tmp1, numer, denom; - if ( S < 0.0f ) // Region 2 - { + if (S < 0.0f) { /* Region 2 */ tmp0 = A01 + B0; tmp1 = A11 + B1; - if ( tmp1 > tmp0 ) - { + if ( tmp1 > tmp0 ) { numer = tmp1 - tmp0; denom = A00 - 2.0f * A01 + A11; - if ( numer >= denom ) - { + if ( numer >= denom ) { S = 1.0f; T = 0.0f; sqrDist = A00 + 2.0f * B0 + C; lv = 1; } - else - { + else { if(fabsf(denom) > FLT_EPSILON) S = numer / denom; else S = 0.0f; T = 1.0f - S; sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0 ) + - T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; + T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; le = 2; } } - else - { + else { S = 0.0f; - if ( tmp1 <= 0.0f ) - { + if ( tmp1 <= 0.0f ) { T = 1.0f; sqrDist = A11 + 2.0f * B1 + C; lv = 2; } - else if ( B1 >= 0.0f ) - { + else if (B1 >= 0.0f) { T = 0.0f; sqrDist = C; lv = 0; } - else - { + else { if(fabsf(A11) > FLT_EPSILON) T = -B1 / A11; else @@ -284,50 +255,42 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f } } } - else if ( T < 0.0f ) // Region 6 - { + else if (T < 0.0f) { /* Region 6 */ tmp0 = A01 + B1; tmp1 = A00 + B0; - if ( tmp1 > tmp0 ) - { + if ( tmp1 > tmp0 ) { numer = tmp1 - tmp0; denom = A00 - 2.0f * A01 + A11; - if ( numer >= denom ) - { + if ( numer >= denom ) { T = 1.0f; S = 0.0f; sqrDist = A11 + 2.0f * B1 + C; lv = 2; } - else - { + else { if(fabsf(denom) > FLT_EPSILON) T = numer / denom; else T = 0.0f; S = 1.0f - T; sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0 ) + - T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; + T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; le = 2; } } - else - { + else { T = 0.0f; - if ( tmp1 <= 0.0f ) - { + if (tmp1 <= 0.0f) { S = 1.0f; sqrDist = A00 + 2.0f * B0 + C; lv = 1; } - else if ( B0 >= 0.0f ) - { + else if (B0 >= 0.0f) { S = 0.0f; sqrDist = C; lv = 0; } - else - { + else { if(fabsf(A00) > FLT_EPSILON) S = -B0 / A00; else @@ -337,35 +300,30 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f } } } - else // Region 1 - { + else { /* Region 1 */ numer = A11 + B1 - A01 - B0; - if ( numer <= 0.0f ) - { + if ( numer <= 0.0f ) { S = 0.0f; T = 1.0f; sqrDist = A11 + 2.0f * B1 + C; lv = 2; } - else - { + else { denom = A00 - 2.0f * A01 + A11; - if ( numer >= denom ) - { + if ( numer >= denom ) { S = 1.0f; T = 0.0f; sqrDist = A00 + 2.0f * B0 + C; lv = 1; } - else - { + else { if(fabsf(denom) > FLT_EPSILON) S = numer / denom; else S = 0.0f; T = 1.0f - S; sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0 ) + - T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; + T * ( A01 * S + A11 * T + 2.0f * B1 ) + C; le = 2; } } @@ -421,8 +379,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3 int vertex, edge; dist = nearest_point_in_tri_surface(t0, t1, t2, co, &vertex, &edge, nearest_tmp); - if(dist < nearest->dist) - { + if (dist < nearest->dist) { nearest->index = index; nearest->dist = dist; copy_v3_v3(nearest->co, nearest_tmp); @@ -459,8 +416,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r else dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2); - if(dist >= 0 && dist < hit->dist) - { + if (dist >= 0 && dist < hit->dist) { hit->index = index; hit->dist = dist; madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist); @@ -491,8 +447,7 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3 closest_to_line_segment_v3(nearest_tmp, co, t0, t1); dist = len_squared_v3v3(nearest_tmp, co); - if(dist < nearest->dist) - { + if (dist < nearest->dist) { nearest->index = index; nearest->dist = dist; copy_v3_v3(nearest->co, nearest_tmp); @@ -510,20 +465,18 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_VERTICES); //Not in cache - if(tree == NULL) - { + if(tree == NULL) { int i; int numVerts= mesh->getNumVerts(mesh); MVert *vert = mesh->getVertDataArray(mesh, CD_MVERT); - if(vert != NULL) - { + if (vert != NULL) { tree = BLI_bvhtree_new(numVerts, epsilon, tree_type, axis); - if(tree != NULL) - { - for(i = 0; i < numVerts; i++) + if (tree != NULL) { + for (i = 0; i < numVerts; i++) { BLI_bvhtree_insert(tree, i, vert[i].co, 1); + } BLI_bvhtree_balance(tree); @@ -533,8 +486,7 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float } } } - else - { + else { // printf("BVHTree is already build, using cached tree\n"); } @@ -543,8 +495,7 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float memset(data, 0, sizeof(*data)); data->tree = tree; - if(data->tree) - { + if (data->tree) { data->cached = TRUE; //a NULL nearest callback works fine @@ -568,8 +519,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_FACES); //Not in cache - if(tree == NULL) - { + if (tree == NULL) { int i; int numFaces= mesh->getNumTessFaces(mesh); @@ -580,12 +530,10 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float * if not caller should use DM_ensure_tessface() */ BLI_assert(!(numFaces == 0 && mesh->getNumPolys(mesh) != 0)); - if(numFaces != 0) - { + if(numFaces != 0) { /* Create a bvh-tree of the given target */ tree = BLI_bvhtree_new(numFaces, epsilon, tree_type, axis); - if(tree != NULL) - { + if (tree != NULL) { BMEditMesh *em= data->em_evil; if(em) { /* data->em_evil is only set for snapping, and only for the mesh of the object @@ -633,8 +581,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float } } - if (insert) - { + if (insert) { /* No reason found to block hit-testing the triangle for snap, * so insert it now.*/ float co[4][3]; @@ -671,8 +618,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float } } } - else - { + else { // printf("BVHTree is already build, using cached tree\n"); } @@ -681,8 +627,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float memset(data, 0, sizeof(*data)); data->tree = tree; - if(data->tree) - { + if(data->tree) { data->cached = TRUE; data->nearest_callback = mesh_faces_nearest_point; @@ -711,14 +656,11 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float MVert *vert = mesh->getVertDataArray(mesh, CD_MVERT); MEdge *edge = mesh->getEdgeDataArray(mesh, CD_MEDGE); - if(vert != NULL && edge != NULL) - { + if (vert != NULL && edge != NULL) { /* Create a bvh-tree of the given target */ tree = BLI_bvhtree_new(numEdges, epsilon, tree_type, axis); - if(tree != NULL) - { - for(i = 0; i < numEdges; i++) - { + if (tree != NULL) { + for (i = 0; i < numEdges; i++) { float co[4][3]; copy_v3_v3(co[0], vert[ edge[i].v1 ].co); copy_v3_v3(co[1], vert[ edge[i].v2 ].co); @@ -743,8 +685,7 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float memset(data, 0, sizeof(*data)); data->tree = tree; - if(data->tree) - { + if(data->tree) { data->cached = TRUE; data->nearest_callback = mesh_edges_nearest_point; @@ -763,8 +704,7 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float // Frees data allocated by a call to bvhtree_from_mesh_*. void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data) { - if(data->tree) - { + if(data->tree) { if(!data->cached) BLI_bvhtree_free(data->tree); @@ -786,8 +726,7 @@ static void bvhcacheitem_set_if_match(void *_cached, void *_search) BVHCacheItem * cached = (BVHCacheItem *)_cached; BVHCacheItem * search = (BVHCacheItem *)_search; - if(search->type == cached->type) - { + if(search->type == cached->type) { search->tree = cached->tree; } } diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index e5276d1bbd4..3aeeb265c01 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -826,8 +826,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d cloth = clmd->clothObject; clmd->clothObject->edgehash = NULL; } - else if ( !clmd->clothObject ) - { + else if (!clmd->clothObject) { modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject." ); return 0; } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 708bf288cc2..4830d7ed61e 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -4889,16 +4889,14 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su } /* surfaces operations that use adjacency data */ - if (sData->adj_data && bData->bNeighs) - { + if (sData->adj_data && bData->bNeighs) { /* wave type surface simulation step */ if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) { dynamicPaint_doWaveStep(surface, timescale); } /* paint surface effects */ - if (surface->effect && surface->type == MOD_DPAINT_SURFACE_T_PAINT) - { + if (surface->effect && surface->type == MOD_DPAINT_SURFACE_T_PAINT) { int steps = 1, s; PaintPoint *prevPoint; float *force = NULL; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 1124922efaa..117414060df 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -433,8 +433,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect hit.dist = len + FLT_EPSILON; // check if the way is blocked - if(BLI_bvhtree_ray_cast(collmd->bvhtree, point->loc, norm, 0.0f, &hit, eff_tri_ray_hit, NULL)>=0) - { + if (BLI_bvhtree_ray_cast(collmd->bvhtree, point->loc, norm, 0.0f, &hit, eff_tri_ray_hit, NULL)>=0) { absorption= col->ob->pd->absorption; // visibility is only between 0 and 1, calculated from 1-absorption diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 50e3c2c63eb..59f62c43b73 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1883,10 +1883,10 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim /* Use the next center point instead of our own handle for * linear interpolated extrapolate */ - if (fcu->totvert == 1) + if (fcu->totvert == 1) { cvalue= prevbezt->vec[1][1]; - else - { + } + else { bezt = prevbezt+1; dx= prevbezt->vec[1][0] - evaltime; fac= bezt->vec[1][0] - prevbezt->vec[1][0]; @@ -1896,12 +1896,12 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim fac= (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac; cvalue= prevbezt->vec[1][1] - (fac * dx); } - else + else { cvalue= prevbezt->vec[1][1]; + } } } - else - { + else { /* Use the first handle (earlier) of first BezTriple to calculate the * gradient and thus the value of the curve at evaltime */ @@ -1913,34 +1913,32 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim fac= (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac; cvalue= prevbezt->vec[1][1] - (fac * dx); } - else + else { cvalue= prevbezt->vec[1][1]; + } } } - else - { + else { /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, * so just extend first keyframe's value */ cvalue= prevbezt->vec[1][1]; } } - else if (lastbezt->vec[1][0] <= evaltime) - { + else if (lastbezt->vec[1][0] <= evaltime) { /* after or on last keyframe */ if ( (fcu->extend == FCURVE_EXTRAPOLATE_LINEAR) && (lastbezt->ipo != BEZT_IPO_CONST) && !(fcu->flag & FCURVE_DISCRETE_VALUES) ) { /* linear or bezier interpolation */ - if (lastbezt->ipo==BEZT_IPO_LIN) - { + if (lastbezt->ipo==BEZT_IPO_LIN) { /* Use the next center point instead of our own handle for * linear interpolated extrapolate */ - if (fcu->totvert == 1) + if (fcu->totvert == 1) { cvalue= lastbezt->vec[1][1]; - else - { + } + else { prevbezt = lastbezt - 1; dx= evaltime - lastbezt->vec[1][0]; fac= lastbezt->vec[1][0] - prevbezt->vec[1][0]; @@ -1950,12 +1948,12 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim fac= (lastbezt->vec[1][1] - prevbezt->vec[1][1]) / fac; cvalue= lastbezt->vec[1][1] + (fac * dx); } - else + else { cvalue= lastbezt->vec[1][1]; + } } } - else - { + else { /* Use the gradient of the second handle (later) of last BezTriple to calculate the * gradient and thus the value of the curve at evaltime */ @@ -1967,12 +1965,12 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim fac= (lastbezt->vec[2][1] - lastbezt->vec[1][1]) / fac; cvalue= lastbezt->vec[1][1] + (fac * dx); } - else + else { cvalue= lastbezt->vec[1][1]; + } } } - else - { + else { /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, * so just extend last keyframe's value */ @@ -1981,8 +1979,7 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim } else { /* evaltime occurs somewhere in the middle of the curve */ - for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) - { + for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) { /* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */ if(fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) { cvalue= bezt->vec[1][1]; @@ -1990,13 +1987,11 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim /* evaltime occurs within the interval defined by these two keyframes */ else if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime)) { /* value depends on interpolation mode */ - if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES)) - { + if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES)) { /* constant (evaltime not relevant, so no interpolation needed) */ cvalue= prevbezt->vec[1][1]; } - else if (prevbezt->ipo == BEZT_IPO_LIN) - { + else if (prevbezt->ipo == BEZT_IPO_LIN) { /* linear - interpolate between values of the two keyframes */ fac= bezt->vec[1][0] - prevbezt->vec[1][0]; @@ -2005,8 +2000,9 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim fac= (evaltime - prevbezt->vec[1][0]) / fac; cvalue= prevbezt->vec[1][1] + (fac * (bezt->vec[1][1] - prevbezt->vec[1][1])); } - else + else { cvalue= prevbezt->vec[1][1]; + } } else { /* bezier interpolation */ diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index f54a885c55e..cb2c077d14d 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1307,8 +1307,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, } } - else if(s->type & CLOTH_SPRING_TYPE_GOAL) - { + else if (s->type & CLOTH_SPRING_TYPE_GOAL) { float tvect[3]; s->flags |= CLOTH_SPRING_FLAG_NEEDED; diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 6800c210963..dab945c44f3 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -502,12 +502,10 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM //DeformVertex calc.vgroup = defgroup_name_index(calc.ob, calc.smd->vgroup_name); - if(dm) - { + if(dm) { calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); } - else if(calc.ob->type == OB_LATTICE) - { + else if (calc.ob->type == OB_LATTICE) { calc.dvert = lattice_get_deform_verts(calc.ob); } @@ -562,8 +560,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM } //Projecting target defined - lets work! - if(calc.target) - { + if (calc.target) { switch(smd->shrinkType) { case MOD_SHRINKWRAP_NEAREST_SURFACE: diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index 7134f5ac8c1..b05188e7183 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -574,15 +574,13 @@ void sk_selectAllSketch(SK_Sketch *sketch, int mode) stk->selected = 0; } } - else if (mode == 0) - { + else if (mode == 0) { for (stk = sketch->strokes.first; stk; stk = stk->next) { stk->selected = 1; } } - else if (mode == 1) - { + else if (mode == 1) { int selected = 1; for (stk = sketch->strokes.first; stk; stk = stk->next) -- cgit v1.2.3