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 +- source/blender/blenlib/intern/BLI_kdopbvh.c | 45 ++--- source/blender/blenlib/intern/math_geom.c | 51 ++---- source/blender/blenlib/intern/winstuff.c | 6 +- source/blender/blenloader/intern/readfile.c | 14 +- source/blender/editors/object/object_relations.c | 3 +- source/blender/editors/space_logic/logic_window.c | 12 +- source/blender/editors/space_node/node_edit.c | 3 +- source/blender/editors/space_view3d/drawobject.c | 8 +- source/blender/editors/transform/transform.c | 9 +- .../editors/transform/transform_constraints.c | 21 +-- .../editors/transform/transform_conversions.c | 13 +- .../blender/editors/transform/transform_generics.c | 33 ++-- .../editors/transform/transform_orientations.c | 91 ++++------ source/blender/editors/transform/transform_snap.c | 55 ++---- source/blender/gpu/intern/gpu_material.c | 18 +- source/blender/makesrna/intern/rna_scene.c | 6 +- source/blender/makesrna/intern/rna_sensor.c | 3 +- source/blender/modifiers/intern/MOD_collision.c | 15 +- source/blender/modifiers/intern/MOD_simpledeform.c | 3 +- .../blender/render/intern/source/convertblender.c | 3 +- source/blender/render/intern/source/volumetric.c | 18 +- 31 files changed, 270 insertions(+), 479 deletions(-) (limited to 'source/blender') 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) diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 1876a625bc3..561c7ffb57e 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -766,8 +766,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, //Loop all branches on this level #pragma omp parallel for private(j) schedule(static) - for(j = i; j < end_j; j++) - { + for(j = i; j < end_j; j++) { int k; const int parent_level_index= j-i; BVHNode* parent = branches_array + j; @@ -791,8 +790,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, //Split_leafs takes care of that "sort" problem. nth_positions[ 0] = parent_leafs_begin; nth_positions[tree_type] = parent_leafs_end; - for(k = 1; k < tree_type; k++) - { + for (k = 1; k < tree_type; k++) { int child_index = j * tree_type + tree_offset + k; int child_level_index = child_index - first_of_next_level; //child level index nth_positions[k] = implicit_leafs_index(&data, depth+1, child_level_index); @@ -803,26 +801,24 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, //Setup children and totnode counters //Not really needed but currently most of BVH code relies on having an explicit children structure - for(k = 0; k < tree_type; k++) - { + for (k = 0; k < tree_type; k++) { int child_index = j * tree_type + tree_offset + k; int child_level_index = child_index - first_of_next_level; //child level index int child_leafs_begin = implicit_leafs_index(&data, depth+1, child_level_index); int child_leafs_end = implicit_leafs_index(&data, depth+1, child_level_index+1); - if(child_leafs_end - child_leafs_begin > 1) - { + if (child_leafs_end - child_leafs_begin > 1) { parent->children[k] = branches_array + child_index; parent->children[k]->parent = parent; } - else if(child_leafs_end - child_leafs_begin == 1) - { + else if (child_leafs_end - child_leafs_begin == 1) { parent->children[k] = leafs_array[ child_leafs_begin ]; parent->children[k]->parent = parent; } - else + else { break; + } parent->totnode = k+1; } @@ -853,39 +849,32 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis) //this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces epsilon = MAX2(FLT_EPSILON, epsilon); - if(tree) - { + if(tree) { tree->epsilon = epsilon; tree->tree_type = tree_type; tree->axis = axis; - if(axis == 26) - { + if (axis == 26) { tree->start_axis = 0; tree->stop_axis = 13; } - else if(axis == 18) - { + else if (axis == 18) { tree->start_axis = 7; tree->stop_axis = 13; } - else if(axis == 14) - { + else if (axis == 14) { tree->start_axis = 0; tree->stop_axis = 7; } - else if(axis == 8) // AABB - { + else if (axis == 8) { /* AABB */ tree->start_axis = 0; tree->stop_axis = 4; } - else if(axis == 6) // OBB - { + else if (axis == 6) { /* OBB */ tree->start_axis = 0; tree->stop_axis = 3; } - else - { + else { MEM_freeN(tree); return NULL; } @@ -1221,12 +1210,10 @@ static float calc_nearest_point(const float proj[3], BVHNode *node, float *neare float dl = bv[0] - proj; float du = bv[1] - proj; - if(dl > 0) - { + if(dl > 0) { madd_v3_v3fl(nearest, KDOP_AXES[i], dl); } - else if(du < 0) - { + else if(du < 0) { madd_v3_v3fl(nearest, KDOP_AXES[i], du); } } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 18418f3105c..405db864598 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -808,8 +808,7 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], if (u > 1) du = u - 1; if (v < 0) dv = v; if (v > 1) dv = v - 1; - if (u > 0 && v > 0 && u + v > 1) - { + if (u > 0 && v > 0 && u + v > 1) { float t = u + v - 1; du = u - t/2; dv = v - t/2; @@ -818,8 +817,7 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], mul_v3_fl(e1, du); mul_v3_fl(e2, dv); - if (dot_v3v3(e1, e1) + dot_v3v3(e2, e2) > threshold * threshold) - { + if (dot_v3v3(e1, e1) + dot_v3v3(e2, e2) > threshold * threshold) { return 0; } @@ -895,8 +893,7 @@ static int getLowestRoot(const float a, const float b, const float c, const floa float determinant = b*b - 4.0f*a*c; // If determinant is negative it means no solutions. - if (determinant >= 0.0f) - { + if (determinant >= 0.0f) { // calculate the two roots: (if determinant == 0 then // x1==x2 but lets disregard that slight optimization) float sqrtD = (float)sqrt(determinant); @@ -908,16 +905,14 @@ static int getLowestRoot(const float a, const float b, const float c, const floa SWAP(float, r1, r2); // Get lowest root: - if (r1 > 0.0f && r1 < maxR) - { + if (r1 > 0.0f && r1 < maxR) { *root = r1; return 1; } // It is possible that we want x2 - this can happen // if x1 < 0 - if (r2 > 0.0f && r2 < maxR) - { + if (r2 > 0.0f && r2 < maxR) { *root = r2; return 1; } @@ -951,8 +946,7 @@ int isect_sweeping_sphere_tri_v3( a=dot_v3v3(p1,nor)-dot_v3v3(v0,nor); nordotv=dot_v3v3(nor,vel); - if (fabsf(nordotv) < 0.000001f) - { + if (fabsf(nordotv) < 0.000001f) { if(fabsf(a) >= radius) { return 0; } @@ -992,8 +986,7 @@ int isect_sweeping_sphere_tri_v3( z=x+y-(a*c-b*b); - if(z <= 0.0f && (x >= 0.0f && y >= 0.0f)) - { + if (z <= 0.0f && (x >= 0.0f && y >= 0.0f)) { //(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000) { *r_lambda=t0; copy_v3_v3(ipoint,point); @@ -1012,8 +1005,7 @@ int isect_sweeping_sphere_tri_v3( b=2.0f*dot_v3v3(vel,temp); c=dot_v3v3(temp,temp)-radius2; - if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) - { + if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) { copy_v3_v3(ipoint,v0); found_by_sweep=1; } @@ -1023,8 +1015,7 @@ int isect_sweeping_sphere_tri_v3( b=2.0f*dot_v3v3(vel,temp); c=dot_v3v3(temp,temp)-radius2; - if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) - { + if (getLowestRoot(a, b, c, *r_lambda, r_lambda)) { copy_v3_v3(ipoint,v1); found_by_sweep=1; } @@ -1034,8 +1025,7 @@ int isect_sweeping_sphere_tri_v3( b=2.0f*dot_v3v3(vel,temp); c=dot_v3v3(temp,temp)-radius2; - if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) - { + if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) { copy_v3_v3(ipoint,v2); found_by_sweep=1; } @@ -1055,12 +1045,10 @@ int isect_sweeping_sphere_tri_v3( b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv); c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv; - if(getLowestRoot(a, b, c, *r_lambda, &newLambda)) - { + if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) { e=(edotv*newLambda-edotbv)/elen2; - if(e >= 0.0f && e <= 1.0f) - { + if (e >= 0.0f && e <= 1.0f) { *r_lambda = newLambda; copy_v3_v3(ipoint,e1); mul_v3_fl(ipoint,e); @@ -1079,12 +1067,10 @@ int isect_sweeping_sphere_tri_v3( b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv); c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv; - if(getLowestRoot(a, b, c, *r_lambda, &newLambda)) - { + if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) { e=(edotv*newLambda-edotbv)/elen2; - if(e >= 0.0f && e <= 1.0f) - { + if (e >= 0.0f && e <= 1.0f) { *r_lambda = newLambda; copy_v3_v3(ipoint,e2); mul_v3_fl(ipoint,e); @@ -1108,12 +1094,10 @@ int isect_sweeping_sphere_tri_v3( b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv); c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv; - if(getLowestRoot(a, b, c, *r_lambda, &newLambda)) - { + if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) { e=(edotv*newLambda-edotbv)/elen2; - if(e >= 0.0f && e <= 1.0f) - { + if (e >= 0.0f && e <= 1.0f) { *r_lambda = newLambda; copy_v3_v3(ipoint,e3); mul_v3_fl(ipoint,e); @@ -2543,8 +2527,7 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo if (lrot) unit_m3(lrot); if (lscale) unit_m3(lscale); /* do com for both clouds */ - if (pos && rpos && (list_size > 0)) /* paranoya check */ - { + if (pos && rpos && (list_size > 0)) { /* paranoya check */ /* do com for both clouds */ for(a=0; adomain->point_cache[1] = NULL; } } - else if(smd->type==MOD_SMOKE_TYPE_FLOW) - { + else if (smd->type==MOD_SMOKE_TYPE_FLOW) { smd->domain = NULL; smd->coll = NULL; smd->flow = newdataadr(fd, smd->flow); smd->flow->smd = smd; smd->flow->psys = newdataadr(fd, smd->flow->psys); } - else if(smd->type==MOD_SMOKE_TYPE_COLL) - { + else if (smd->type==MOD_SMOKE_TYPE_COLL) { smd->flow = NULL; smd->domain = NULL; smd->coll = newdataadr(fd, smd->coll); @@ -12217,8 +12215,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) - { + else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) { smd->flow->vel_multi = 1.0f; } @@ -12968,10 +12965,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* sigh, this dscale vs dsize version patching was not done right, fix for fix, * this intentionally checks an exact subversion, also note this was never in a release, * at some point this could be removed. */ - else if (main->versionfile == 260 && main->subversionfile == 6) - { + else if (main->versionfile == 260 && main->subversionfile == 6) { Object *ob; - for (ob= main->object.first; ob; ob= ob->id.next) { + for (ob = main->object.first; ob; ob= ob->id.next) { if (is_zero_v3(ob->dscale)) { fill_vn_fl(ob->dscale, 3, 1.0f); } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 931896ed916..a388e465a21 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -586,8 +586,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object if (partype == PAR_PATH_CONST) { /* don't do anything here, since this is not technically "parenting" */ } - else if (ELEM(partype, PAR_CURVE, PAR_LATTICE) || (pararm)) - { + else if (ELEM(partype, PAR_CURVE, PAR_LATTICE) || (pararm)) { /* partype is now set to PAROBJECT so that invisible 'virtual' modifiers don't need to be created * NOTE: the old (2.4x) method was to set ob->partype = PARSKEL, creating the virtual modifiers */ diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 07d47e64be2..4a301277ff3 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1616,8 +1616,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short "Specify which button to use"); } } - else if(joy->type == SENS_JOY_AXIS) - { + else if(joy->type == SENS_JOY_AXIS) { uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19, &joy->axis, 1, 8.0, 100, 0, "Specify which axis pair to use, 1 is useually the main direction input"); @@ -1633,8 +1632,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short "The direction of the axis, use 'All Events' to receive events on any direction"); } } - else if (joy->type == SENS_JOY_HAT) - { + else if (joy->type == SENS_JOY_HAT) { uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19, &joy->hat, 1, 4.0, 100, 0, "Specify which hat to use"); @@ -2547,8 +2545,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo // uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation"); } #if 0 - else if (gma->type == ACT_GAME_START) - { + else if (gma->type == ACT_GAME_START) { ysize = 68; glRects(xco, yco-ysize, xco+width, yco); uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); @@ -2557,8 +2554,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation"); } #endif - else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG)) - { + else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG)) { ysize = 28; glRects(xco, yco-ysize, xco+width, yco); uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index a423322edd5..1593710a98a 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3402,8 +3402,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } } - else if(RNA_struct_property_is_set(op->ptr, "name")) - { + else if(RNA_struct_property_is_set(op->ptr, "name")) { char name[MAX_ID_NAME-2]; RNA_string_get(op->ptr, "name", name); ima= (Image *)find_id("IM", name); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 0cc5d877b44..77a686e81b7 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -6803,10 +6803,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) // only draw domains if (smd->domain && smd->domain->fluid) { - if (CFRA < smd->domain->point_cache[0]->startframe) - ; /* don't show smoke before simulation starts, this could be made an option in the future */ - else if (!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) - { + if (CFRA < smd->domain->point_cache[0]->startframe) { + /* don't show smoke before simulation starts, this could be made an option in the future */ + } + else if (!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG)) { // #if 0 smd->domain->tex = NULL; GPU_create_smoke(smd, 0); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 979e3820018..7bd0aaf89db 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -316,13 +316,11 @@ static void viewRedrawForce(const bContext *C, TransInfo *t) else if (t->spacetype == SPACE_NLA) { WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL); } - else if(t->spacetype == SPACE_NODE) - { + else if(t->spacetype == SPACE_NODE) { //ED_area_tag_redraw(t->sa); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE_VIEW, NULL); } - else if(t->spacetype == SPACE_SEQ) - { + else if(t->spacetype == SPACE_SEQ) { WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL); } else if (t->spacetype==SPACE_IMAGE) { @@ -1519,8 +1517,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int { t->launch_event = RIGHTMOUSE; } - else if (t->launch_event == EVT_TWEAK_L) - { + else if (t->launch_event == EVT_TWEAK_L) { t->launch_event = LEFTMOUSE; } diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 1292a058f41..dfe582412b6 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -80,16 +80,13 @@ static void constraintAutoValues(TransInfo *t, float vec[3]) { float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f; - if ((mode & CON_AXIS0) == 0) - { + if ((mode & CON_AXIS0) == 0) { vec[0] = nval; } - if ((mode & CON_AXIS1) == 0) - { + if ((mode & CON_AXIS1) == 0) { vec[1] = nval; } - if ((mode & CON_AXIS2) == 0) - { + if ((mode & CON_AXIS2) == 0) { vec[2] = nval; } } @@ -165,8 +162,7 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) } /* autovalues is operator param, use that directly but not if snapping is forced */ - if (t->flag & T_AUTOVALUES && (t->tsnap.status & SNAP_FORCED) == 0) - { + if (t->flag & T_AUTOVALUES && (t->tsnap.status & SNAP_FORCED) == 0) { mul_v3_m3v3(vec, t->con.imtx, t->auto_values); constraintAutoValues(t, vec); /* inverse transformation at the end */ @@ -716,8 +712,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) UI_ThemeColor(TH_GRID); - if(t->spacetype == SPACE_VIEW3D && rv3d != NULL) - { + if(t->spacetype == SPACE_VIEW3D && rv3d != NULL) { copy_m4_m4(tmat, rv3d->viewmat); invert_m4_m4(imat, tmat); } @@ -730,12 +725,10 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) copy_v3_v3(center, t->center); - if((t->spacetype == SPACE_VIEW3D) && t->obedit) - { + if((t->spacetype == SPACE_VIEW3D) && t->obedit) { mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */ } - else if(t->spacetype == SPACE_IMAGE) - { + else if(t->spacetype == SPACE_IMAGE) { float aspx, aspy; ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index ed01de848ae..fa0575ca9db 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -717,7 +717,9 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb) { bone->flag |= BONE_HINGE_CHILD_TRANSFORM; } - else if (bone->flag & BONE_TRANSFORM && (mode == TFM_ROTATION || mode == TFM_TRACKBALL) && around == V3D_LOCAL) + else if ((bone->flag & BONE_TRANSFORM) && + (mode == TFM_ROTATION || mode == TFM_TRACKBALL) && + (around == V3D_LOCAL)) { bone->flag |= BONE_TRANSFORM_CHILD; } @@ -1126,8 +1128,7 @@ static void createTransArmatureVerts(TransInfo *t) if (ebo->flag & BONE_SELECTED) t->total++; } - else if (t->mode==TFM_BONE_ROLL) - { + else if (t->mode==TFM_BONE_ROLL) { if (ebo->flag & BONE_SELECTED) t->total++; } @@ -1190,8 +1191,7 @@ static void createTransArmatureVerts(TransInfo *t) } } - else if (t->mode==TFM_BONESIZE) - { + else if (t->mode==TFM_BONESIZE) { if (ebo->flag & BONE_SELECTED) { if(arm->drawtype==ARM_ENVELOPE) { @@ -1223,8 +1223,7 @@ static void createTransArmatureVerts(TransInfo *t) td++; } } - else if (t->mode==TFM_BONE_ROLL) - { + else if (t->mode==TFM_BONE_ROLL) { if (ebo->flag & BONE_SELECTED) { td->loc= NULL; diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index f3cede75786..b32ed17f57a 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1098,21 +1098,18 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } } - else if(t->spacetype==SPACE_IMAGE) - { + else if(t->spacetype==SPACE_IMAGE) { SpaceImage *sima = sa->spacedata.first; // XXX for now, get View2D from the active region t->view = &ar->v2d; t->around = sima->around; } - else if(t->spacetype==SPACE_NODE) - { + else if(t->spacetype==SPACE_NODE) { // XXX for now, get View2D from the active region t->view = &ar->v2d; t->around = V3D_CENTER; } - else if(t->spacetype==SPACE_IPO) - { + else if(t->spacetype==SPACE_IPO) { SpaceIpo *sipo= sa->spacedata.first; t->view = &ar->v2d; t->around = sipo->around; @@ -1151,8 +1148,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) } } // Need stuff to take it from edit mesh or whatnot here - else if (t->spacetype == SPACE_VIEW3D) - { + else if (t->spacetype == SPACE_VIEW3D) { if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X)) { t->flag |= T_MIRROR; @@ -1552,8 +1548,7 @@ void calculateCenter(TransInfo *t) { Scene *scene = t->scene; Object *ob= OBACT; - if(ob) - { + if (ob) { copy_v3_v3(t->center, ob->obmat[3]); projectIntView(t, t->center, t->center2d); } @@ -1564,23 +1559,19 @@ void calculateCenter(TransInfo *t) /* setting constraint center */ copy_v3_v3(t->con.center, t->center); - if(t->flag & (T_EDIT|T_POSE)) - { + if (t->flag & (T_EDIT|T_POSE)) { Object *ob= t->obedit?t->obedit:t->poseobj; mul_m4_v3(ob->obmat, t->con.center); } /* for panning from cameraview */ - if(t->flag & T_OBJECT) - { - if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) - { + if (t->flag & T_OBJECT) { + if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) { View3D *v3d = t->view; Scene *scene = t->scene; RegionView3D *rv3d = t->ar->regiondata; - if(v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB) - { + if (v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB) { float axis[3]; /* persinv is nasty, use viewinv instead, always right */ copy_v3_v3(axis, t->viewinv[2]); @@ -1603,8 +1594,7 @@ void calculateCenter(TransInfo *t) } } - if(t->spacetype==SPACE_VIEW3D) - { + if (t->spacetype==SPACE_VIEW3D) { /* initgrabz() defines a factor for perspective depth correction, used in window_to_3d_delta() */ if(t->flag & (T_EDIT|T_POSE)) { Object *ob= t->obedit?t->obedit:t->poseobj; @@ -1632,8 +1622,7 @@ void calculatePropRatio(TransInfo *t) if (td->flag & TD_SELECTED) { td->factor = 1.0f; } - else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f) - { + else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f) { td->flag |= TD_SKIP; td->factor = 0.0f; restoreElement(td); diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 6b3380ea42e..2b5758c5ec1 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -122,8 +122,7 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name ts = createObjectSpace(C, reports, name, overwrite); } - if (use && ts != NULL) - { + if (use && ts != NULL) { BIF_selectTransformOrientation(C, ts); } } @@ -144,8 +143,7 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports) normalize_m3(mat); /* use object name if no name is given */ - if (name[0] == 0) - { + if (name[0] == 0) { strncpy(name, ob->id.name+2, MAX_ID_NAME-2); } @@ -164,8 +162,7 @@ TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *na return NULL; } - if (name[0] == 0) - { + if (name[0] == 0) { strcpy(name, "Bone"); } @@ -188,8 +185,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na return NULL; } - if (name[0] == 0) - { + if (name[0] == 0) { strcpy(name, "Vertex"); } break; @@ -199,8 +195,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na return NULL; } - if (name[0] == 0) - { + if (name[0] == 0) { strcpy(name, "Edge"); } break; @@ -210,8 +205,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na return NULL; } - if (name[0] == 0) - { + if (name[0] == 0) { strcpy(name, "Face"); } break; @@ -254,8 +248,7 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]) } /* preempt zero length tangent from causing trouble */ - if (tangent[0] == 0 && tangent[1] == 0 && tangent[2] == 0) - { + if (tangent[0] == 0 && tangent[1] == 0 && tangent[2] == 0) { tangent[2] = 1; } @@ -284,8 +277,7 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], } /* if not, create a new one */ - if (ts == NULL) - { + if (ts == NULL) { ts = MEM_callocN(sizeof(TransformOrientation), "UserTransSpace from matrix"); BLI_addtail(transform_spaces, ts); strncpy(ts->name, name, sizeof(ts->name)); @@ -566,8 +558,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], normal[0] = normal[1] = normal[2] = 0; plane[0] = plane[1] = plane[2] = 0; - if(obedit) - { + if (obedit) { float imat[3][3], mat[3][3]; /* we need the transpose of the inverse for a normal... */ @@ -578,8 +569,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], ob= obedit; - if(ob->type==OB_MESH) - { + if (ob->type==OB_MESH) { Mesh *me= ob->data; BMEditMesh *em = me->edit_btmesh; BMVert *eve; @@ -587,8 +577,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], float vec[3]= {0,0,0}; /* USE LAST SELECTED WITH ACTIVE */ - if (activeOnly && EDBM_get_actSelection(em, &ese)) - { + if (activeOnly && EDBM_get_actSelection(em, &ese)) { EDBM_editselection_normal(normal, &ese); EDBM_editselection_plane(em, plane, &ese); @@ -622,8 +611,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], result = ORIENTATION_FACE; } - else if (em->bm->totvertsel == 3) - { + else if (em->bm->totvertsel == 3) { BMVert *v1 = NULL, *v2 = NULL, *v3 = NULL; BMIter iter; float cotangent[3]; @@ -648,8 +636,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } /* if there's an edge available, use that for the tangent */ - if (em->bm->totedgesel >= 1) - { + if (em->bm->totedgesel >= 1) { BMEdge *eed = NULL; BMIter iter; @@ -663,8 +650,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], result = ORIENTATION_FACE; } - else if (em->bm->totedgesel == 1) - { + else if (em->bm->totedgesel == 1) { BMEdge *eed = NULL; BMIter iter; @@ -679,8 +665,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } result = ORIENTATION_EDGE; } - else if (em->bm->totvertsel == 2) - { + else if (em->bm->totvertsel == 2) { BMVert *v1 = NULL, *v2 = NULL; BMIter iter; @@ -701,8 +686,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } result = ORIENTATION_EDGE; } - else if (em->bm->totvertsel == 1) - { + else if (em->bm->totvertsel == 1) { BMIter iter; BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) { @@ -713,8 +697,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } result = ORIENTATION_VERT; } - else if (em->bm->totvertsel > 3) - { + else if (em->bm->totvertsel > 3) { BMIter iter; normal[0] = normal[1] = normal[2] = 0.0f; @@ -728,19 +711,16 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } } } /* end editmesh */ - else if ELEM(obedit->type, OB_CURVE, OB_SURF) - { + else if ELEM(obedit->type, OB_CURVE, OB_SURF) { Curve *cu= obedit->data; Nurb *nu; BezTriple *bezt; int a; ListBase *nurbs= curve_editnurbs(cu); - for (nu = nurbs->first; nu; nu = nu->next) - { + for (nu = nurbs->first; nu; nu = nu->next) { /* only bezier has a normal */ - if(nu->type == CU_BEZIER) - { + if (nu->type == CU_BEZIER) { bezt= nu->bezt; a= nu->pntsu; while(a--) @@ -756,8 +736,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], if (bezt->f2) { sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]); } - if(bezt->f3) - { + if (bezt->f3) { sub_v3_v3v3(normal, bezt->vec[1], bezt->vec[2]); } } @@ -766,21 +745,18 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } } - if (normal[0] != 0 || normal[1] != 0 || normal[2] != 0) - { + if (normal[0] != 0 || normal[1] != 0 || normal[2] != 0) { result = ORIENTATION_NORMAL; } } - else if(obedit->type==OB_MBALL) - { + else if(obedit->type==OB_MBALL){ #if 0 // XXX /* editmball.c */ extern ListBase editelems; /* go away ! */ MetaElem *ml, *ml_sel = NULL; /* loop and check that only one element is selected */ - for (ml = editelems.first; ml; ml = ml->next) - { + for (ml = editelems.first; ml; ml = ml->next) { if (ml->flag & SELECT) { if (ml_sel == NULL) { ml_sel = ml; @@ -792,8 +768,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], } } - if (ml_sel) - { + if (ml_sel) { float mat[4][4]; /* Rotation of MetaElem is stored in quat */ @@ -808,16 +783,13 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], #endif } - else if (obedit->type == OB_ARMATURE) - { + else if (obedit->type == OB_ARMATURE) { bArmature *arm = obedit->data; EditBone *ebone; for (ebone = arm->edbo->first; ebone; ebone=ebone->next) { - if (arm->layer & ebone->layer) - { - if (ebone->flag & BONE_SELECTED) - { + if (arm->layer & ebone->layer) { + if (ebone->flag & BONE_SELECTED) { float tmat[3][3]; float vec[3]; sub_v3_v3v3(vec, ebone->tail, ebone->head); @@ -849,8 +821,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], mul_m3_v3(mat, plane); } } - else if(ob && (ob->mode & OB_MODE_POSE)) - { + else if(ob && (ob->mode & OB_MODE_POSE)) { bArmature *arm= ob->data; bPoseChannel *pchan; int totsel; @@ -879,8 +850,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], result = ORIENTATION_EDGE; } } - else if(ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT))) - { + else if(ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT))) { + /* pass */ } else { /* we need the one selected object, if its not active */ diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 1ee87b395b2..c4e871f83c5 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -198,8 +198,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) if(v3d->zbuf) glEnable(GL_DEPTH_TEST); } - else if (t->spacetype==SPACE_IMAGE) - { + else if (t->spacetype==SPACE_IMAGE) { /* This will not draw, and Im nor sure why - campbell */ #if 0 float xuser_asp, yuser_asp; @@ -288,8 +287,7 @@ void applyProject(TransInfo *t) Object *ob = t->obedit?t->obedit:t->poseobj; mul_m4_v3(ob->obmat, iloc); } - else if (t->flag & T_OBJECT) - { + else if (t->flag & T_OBJECT) { td->ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; object_handle_update(t->scene, td->ob); copy_v3_v3(iloc, td->ob->obmat[3]); @@ -327,8 +325,7 @@ void applySnapping(TransInfo *t, float *vec) t->tsnap.applySnap(t, vec); } - else if ((t->tsnap.mode != SCE_SNAP_MODE_INCREMENT) && activeSnap(t)) - { + else if ((t->tsnap.mode != SCE_SNAP_MODE_INCREMENT) && activeSnap(t)) { double current = PIL_check_seconds_timer(); // Time base quirky code to go around findnearest slowness @@ -478,10 +475,8 @@ void initSnapping(TransInfo *t, wmOperator *op) } } /* use scene defaults only when transform is modal */ - else if (t->flag & T_MODAL) - { - if(ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) - { + else if (t->flag & T_MODAL) { + if(ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) { if (ts->snap_flag & SCE_SNAP) { t->modifiers |= MOD_SNAP; } @@ -895,8 +890,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec)) t->tsnap.status &= ~POINT_INIT; } } - else if (t->spacetype == SPACE_IMAGE && t->obedit != NULL && t->obedit->type==OB_MESH) - { /* same as above but for UV's */ + else if (t->spacetype == SPACE_IMAGE && t->obedit != NULL && t->obedit->type==OB_MESH) { /* same as above but for UV's */ Image *ima= ED_space_image(t->sa->spacedata.first); float aspx, aspy, co[2]; @@ -1306,8 +1300,7 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm } } } - else if (ob->pose && ob->pose->chanbase.first) - { + else if (ob->pose && ob->pose->chanbase.first) { bPoseChannel *pchan; Bone *bone; @@ -1630,8 +1623,7 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo dm->release(dm); } - else if (ob->type == OB_ARMATURE) - { + else if (ob->type == OB_ARMATURE) { retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth); } @@ -1648,8 +1640,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c ED_view3d_win_to_ray(ar, v3d, mval, ray_start, ray_normal); - if (mode == SNAP_ALL && obedit) - { + if (mode == SNAP_ALL && obedit) { Object *ob = obedit; retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth); @@ -1661,8 +1652,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c * To solve that problem, we do it first as an exception. * */ base= BASACT; - if(base && base->object && base->object->mode & OB_MODE_PARTICLE_EDIT) - { + if (base && base->object && base->object->mode & OB_MODE_PARTICLE_EDIT) { Object *ob = base->object; retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth); } @@ -1676,8 +1666,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c { Object *ob = base->object; - if (ob->transflag & OB_DUPLI) - { + if (ob->transflag & OB_DUPLI) { DupliObject *dupli_ob; ListBase *lb = object_duplilist(scene, ob); @@ -1720,12 +1709,10 @@ static int cmpPeel(void *arg1, void *arg2) DepthPeel *p2 = arg2; int val = 0; - if (p1->depth < p2->depth) - { + if (p1->depth < p2->depth) { val = -1; } - else if (p1->depth > p2->depth) - { + else if (p1->depth > p2->depth) { val = 1; } @@ -1739,13 +1726,11 @@ static void removeDoublesPeel(ListBase *depth_peels) for (peel = depth_peels->first; peel; peel = peel->next) { DepthPeel *next_peel = peel->next; - - if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) - { + + if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) { peel->next = next_peel->next; - if (next_peel->next) - { + if (next_peel->next) { next_peel->next->prev = peel; } @@ -1841,8 +1826,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], addDepthPeel(depth_peels, new_depth, location, normal, ob); } - if (f->v4 && result == 0) - { + if (f->v4 && result == 0) { result = isect_ray_tri_threshold_v3(ray_start_local, ray_normal_local, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, &lambda, NULL, 0.001); if (result) { @@ -1886,12 +1870,11 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L ED_view3d_win_to_ray(ar, v3d, mval, ray_start, ray_normal); - for ( base = scene->base.first; base != NULL; base = base->next ) { + for (base = scene->base.first; base != NULL; base = base->next) { if ( BASE_SELECTABLE(v3d, base) ) { Object *ob = base->object; - if (ob->transflag & OB_DUPLI) - { + if (ob->transflag & OB_DUPLI) { DupliObject *dupli_ob; ListBase *lb = object_duplilist(scene, ob); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 0ddaf07c67e..c59af3cc7fb 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1053,23 +1053,21 @@ static void do_material_tex(GPUShadeInput *shi) if(mtex->norfac < 0.0f) GPU_link(mat, "mtex_negate_texnormal", tnor, &tnor); - if(mtex->normapspace == MTEX_NSPACE_TANGENT) - { - if(iFirstTimeNMap!=0) - { + if (mtex->normapspace == MTEX_NSPACE_TANGENT) { + if (iFirstTimeNMap != 0) { // use unnormalized normal (this is how we bake it - closer to gamedev) GPUNodeLink *vNegNorm; GPU_link(mat, "vec_math_negate", GPU_builtin(GPU_VIEW_NORMAL), &vNegNorm); GPU_link(mat, "mtex_nspace_tangent", GPU_attribute(CD_TANGENT, ""), vNegNorm, tnor, &newnor); iFirstTimeNMap = 0; } - else // otherwise use accumulated perturbations - { + else { /* otherwise use accumulated perturbations */ GPU_link(mat, "mtex_nspace_tangent", GPU_attribute(CD_TANGENT, ""), shi->vn, tnor, &newnor); } } - else + else { newnor = tnor; + } norfac = minf(fabsf(mtex->norfac), 1.0f); @@ -1085,7 +1083,8 @@ static void do_material_tex(GPUShadeInput *shi) GPU_link(mat, "mtex_blend_normal", tnorfac, shi->vn, newnor, &shi->vn); } - } else if( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) || found_deriv_map) { + } + else if( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) || found_deriv_map) { /* ntap bumpmap image */ int iBumpSpace; float ima_x, ima_y; @@ -1120,8 +1119,7 @@ static void do_material_tex(GPUShadeInput *shi) // to inverting the bump map. Should this ever change // this negate must be removed. norfac = -hScale * mtex->norfac; - if(found_deriv_map) - { + if (found_deriv_map) { float fVirtDim = sqrtf(fabsf(ima_x*mtex->size[0]*ima_y*mtex->size[1])); norfac /= MAX2(fVirtDim, FLT_EPSILON); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2305ff770a3..7a60a413703 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1248,10 +1248,10 @@ static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value) { Scene *scene = (Scene*)ptr->data; - if (value == AUDIO_SYNC) + if (value == AUDIO_SYNC) { scene->audio.flag |= AUDIO_SYNC; - else if (value == SCE_FRAME_DROP) - { + } + else if (value == SCE_FRAME_DROP) { scene->audio.flag &= ~AUDIO_SYNC; scene->flag |= SCE_FRAME_DROP; } diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index fb7813f0b4f..aeb67cb0410 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -118,8 +118,7 @@ void rna_Sensor_name_set(PointerRNA *ptr, const char *value) static void rna_Sensor_type_set(struct PointerRNA *ptr, int value) { bSensor *sens = (bSensor *)ptr->data; - if (value != sens->type) - { + if (value != sens->type) { sens->type = value; init_sensor(sens); } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 82c8b19db2d..a1467c55ecf 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -176,8 +176,7 @@ static void deformVerts(ModifierData *md, Object *ob, collmd->time_x = collmd->time_xnew = current_time; } - else if(numverts == collmd->numverts) - { + else if(numverts == collmd->numverts) { // put positions to old positions tempVert = collmd->x; collmd->x = collmd->xnew; @@ -186,8 +185,7 @@ static void deformVerts(ModifierData *md, Object *ob, memcpy(collmd->xnew, dm->getVertArray(dm), numverts*sizeof(MVert)); - for ( i = 0; i < numverts; i++ ) - { + for (i = 0; i < numverts; i++) { // we save global positions mul_m4_v3( ob->obmat, collmd->xnew[i].co ); } @@ -196,10 +194,8 @@ static void deformVerts(ModifierData *md, Object *ob, memcpy(collmd->current_x, collmd->x, numverts*sizeof(MVert)); /* check if GUI setting has changed for bvh */ - if(collmd->bvhtree) - { - if(ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) - { + if(collmd->bvhtree) { + if(ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) { BLI_bvhtree_free(collmd->bvhtree); collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft); } @@ -217,8 +213,7 @@ static void deformVerts(ModifierData *md, Object *ob, collmd->time_xnew = current_time; } - else if(numverts != collmd->numverts) - { + else if(numverts != collmd->numverts) { freeData((ModifierData *)collmd); } diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index f8e50828ef8..88c21eea806 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -165,8 +165,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object smd->limit[0] = MIN2(smd->limit[0], smd->limit[1]); //Upper limit >= than lower limit //Calculate matrixs do convert between coordinate spaces - if(smd->origin) - { + if(smd->origin) { transf = &tmp_transf; if (smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL) { diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 0af55e28b04..4f891ea17c2 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3476,8 +3476,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) mc[vindex]=mcol[a*4+rev_tab[vindex]]; } else if (layer->type == CD_TANGENT && mtng < 1) { - if(need_nmap_tangent!=0) - { + if (need_nmap_tangent != 0) { const float * tangent = (const float *) layer->data; float * ftang = RE_vlakren_get_nmap_tangent(obr, vlr, 1); for(vindex=0; vindexskip = RE_SKIP_VLR_NEIGHBOUR; isect->orig.face = (void*)shi->vlr; isect->orig.ob = (void*)shi->obi; - } else { // if (intersect_type == VOL_BOUNDS_SS) { + } + else { // if (intersect_type == VOL_BOUNDS_SS) { isect->skip= 0; isect->orig.face= NULL; isect->orig.ob = NULL; } - if(RE_rayobject_raycast(R.raytree, isect)) - { + if(RE_rayobject_raycast(R.raytree, isect)) { hitco[0] = isect->start[0] + isect->dist*isect->dir[0]; hitco[1] = isect->start[1] + isect->dist*isect->dir[1]; hitco[2] = isect->start[2] + isect->dist*isect->dir[2]; return 1; - } else { + } + else { return 0; } } @@ -492,8 +493,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const if (shi->mat->vol.shade_type == MA_VOL_SHADE_SHADOWED) { mul_v3_fl(lacol, vol_get_shadow(shi, lar, co)); } - else if (ELEM3(shi->mat->vol.shade_type, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) - { + else if (ELEM3(shi->mat->vol.shade_type, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) { Isect is; if (shi->mat->vol.shadeflag & MA_VOL_RECV_EXT_SHADOW) { @@ -686,8 +686,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in } - if (inside_volume == VOL_SHADE_INSIDE) - { + if (inside_volume == VOL_SHADE_INSIDE) { startco = shi->camera_co; endco = shi->co; @@ -706,8 +705,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in } /* trace to find a backface, the other side bounds of the volume */ /* (ray intersect ignores front faces here) */ - else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) - { + else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) { VlakRen *vlr = (VlakRen *)is.hit.face; startco = shi->co; -- cgit v1.2.3