From 2d2d36fe3b2f3e7eed7d05714abc80f1a5a82303 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 20 May 2012 19:49:27 +0000 Subject: code cleanup: - style - multi-line ifs move braces onto new lines. - iterators - convert some to macros, other split up and move brace. --- source/blender/blenkernel/intern/CCGSubSurf.c | 3 +- source/blender/blenkernel/intern/DerivedMesh.c | 4 +- source/blender/blenkernel/intern/blender.c | 3 +- source/blender/blenkernel/intern/cdderivedmesh.c | 21 ++++---- source/blender/blenkernel/intern/customdata.c | 3 +- source/blender/blenkernel/intern/displist.c | 3 +- source/blender/blenkernel/intern/dynamicpaint.c | 25 ++++++---- source/blender/blenkernel/intern/font.c | 19 +++---- source/blender/blenkernel/intern/image_gen.c | 10 ++-- source/blender/blenkernel/intern/key.c | 2 +- source/blender/blenkernel/intern/mesh.c | 4 +- source/blender/blenkernel/intern/mesh_validate.c | 8 +-- source/blender/blenkernel/intern/object.c | 10 ++-- source/blender/blenkernel/intern/ocean.c | 58 +++++++++++----------- source/blender/blenkernel/intern/particle_system.c | 2 +- source/blender/blenkernel/intern/sequencer.c | 17 ++++--- source/blender/blenkernel/intern/softbody.c | 9 ++-- source/blender/blenkernel/intern/subsurf_ccg.c | 3 +- source/blender/blenkernel/intern/text.c | 12 +++-- source/blender/blenkernel/intern/texture.c | 3 +- source/blender/blenkernel/intern/writeffmpeg.c | 20 +++++--- 21 files changed, 135 insertions(+), 104 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index 6f768a147f7..e4309a64e56 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -1166,7 +1166,8 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa v->flags = Vert_eEffected | seamflag; } else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize), ss) || - ((v->flags & Vert_eSeam) != seamflag)) { + ((v->flags & Vert_eSeam) != seamflag)) + { *prevp = v->next; _ehash_insert(ss->vMap, (EHEntry *) v); VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData, ss); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 18560d3dbc0..7e2d881689c 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1546,7 +1546,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos /* if this is not the last modifier in the stack then recalculate the normals * to avoid giving bogus normals to the next modifier see: [#23673] */ - if (isPrevDeform && mti->dependsOnNormals && mti->dependsOnNormals(md)) { + if (isPrevDeform && mti->dependsOnNormals && mti->dependsOnNormals(md)) { /* XXX, this covers bug #23673, but we may need normal calc for other types */ if (dm && dm->type == DM_TYPE_CDDM) { CDDM_apply_vert_coords(dm, deformedVerts); @@ -2942,7 +2942,7 @@ static void navmesh_drawColored(DerivedMesh *dm) #endif glDisable(GL_LIGHTING); - /* if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */ + /* if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */ DEBUG_VBO("Using legacy code. drawNavMeshColored\n"); //glShadeModel(GL_SMOOTH); glBegin(glmode = GL_QUADS); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index b2cbf0a1ce1..2ba4ab5d100 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -334,7 +334,8 @@ static int handle_subversion_warning(Main *main, ReportList *reports) { if (main->minversionfile > BLENDER_VERSION || (main->minversionfile == BLENDER_VERSION && - main->minsubversionfile > BLENDER_SUBVERSION)) { + main->minsubversionfile > BLENDER_SUBVERSION)) + { BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile); } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 65294e3e5f5..a34d2ecd47a 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -640,9 +640,8 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, if (drawParamsMapped) { draw_option = drawParamsMapped(userData, orig); } else { if (nors) nors += 3; continue; } } - else - if (drawParamsMapped) draw_option = drawParamsMapped(userData, i); - else { if (nors) nors += 3; continue; } + else if (drawParamsMapped) { draw_option = drawParamsMapped(userData, i); } + else { if (nors) nors += 3; continue; } } if (draw_option != DM_DRAW_OPTION_SKIP) { @@ -2397,11 +2396,13 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm) CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges); CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges); - ehi = BLI_edgehashIterator_new(eh); med = CustomData_get_layer(&edgeData, CD_MEDGE); index = CustomData_get_layer(&edgeData, CD_ORIGINDEX); - for (i = 0; !BLI_edgehashIterator_isDone(ehi); - BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) { + + for (ehi = BLI_edgehashIterator_new(eh), i = 0; + BLI_edgehashIterator_isDone(ehi) == FALSE; + BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) + { BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2); med->flag = ME_EDGEDRAW | ME_EDGERENDER; @@ -2460,11 +2461,13 @@ void CDDM_calc_edges(DerivedMesh *dm) CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges); CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges); - ehi = BLI_edgehashIterator_new(eh); med = CustomData_get_layer(&edgeData, CD_MEDGE); index = CustomData_get_layer(&edgeData, CD_ORIGINDEX); - for (i = 0; !BLI_edgehashIterator_isDone(ehi); - BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) { + + for (ehi = BLI_edgehashIterator_new(eh), i = 0; + BLI_edgehashIterator_isDone(ehi) == FALSE; + BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) + { BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2); j = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi)); diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 90a3e617477..56724b6ada9 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2323,7 +2323,8 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest, /* if we found a matching layer, copy the data */ if (dest->layers[dest_i].type == source->layers[src_i].type && - strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) { + strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) + { char *src_data = (char *)src_block + source->layers[src_i].offset; char *dest_data = (char *)*dest_block + dest->layers[dest_i].offset; diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 9274d7aefcb..2493507dca4 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -901,7 +901,8 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba continue; if (mti->type == eModifierTypeType_OnlyDeform || - (mti->type == eModifierTypeType_DeformOrConstruct && !dm)) { + (mti->type == eModifierTypeType_DeformOrConstruct && !dm)) + { if (editmode) appf |= MOD_APPLY_USECACHE; if (dm) { diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index f8b8efdf7eb..eb5e4e4f8b5 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2035,7 +2035,8 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh int v4 = (mface[i].v4) ? mface[i].v4 : -1; if ((e1_index == mface[i].v1 || e1_index == mface[i].v2 || e1_index == mface[i].v3 || e1_index == v4) && - (e2_index == mface[i].v1 || e2_index == mface[i].v2 || e2_index == mface[i].v3 || e2_index == v4)) { + (e2_index == mface[i].v1 || e2_index == mface[i].v2 || e2_index == mface[i].v3 || e2_index == v4)) + { if (i == cPoint->face_index) continue; target_face = i; @@ -3511,7 +3512,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, } /* get final object space depth */ else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || - surface->type == MOD_DPAINT_SURFACE_T_WAVE) { + surface->type == MOD_DPAINT_SURFACE_T_WAVE) + { depth /= bData->bNormal[index].normal_scale * total_sample; } @@ -3803,8 +3805,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po /* Smooth range or color ramp */ if (brush->proximity_falloff == MOD_DPAINT_PRFALL_SMOOTH || - brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP) { - + brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP) + { strength = 1.0f - distance / brush_radius; CLAMP(strength, 0.0f, 1.0f); } @@ -3855,7 +3857,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) { if (brush->proximity_falloff == MOD_DPAINT_PRFALL_RAMP && - !(brush->flags & MOD_DPAINT_RAMP_ALPHA)) { + !(brush->flags & MOD_DPAINT_RAMP_ALPHA)) + { paintColor[0] = colorband[0]; paintColor[1] = colorband[1]; paintColor[2] = colorband[2]; @@ -4400,7 +4403,8 @@ void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale) avg_dist = (numOfN) ? avg_dist / numOfN : 0.0f; if (surface->flags & MOD_DPAINT_WAVE_OPEN_BORDERS && - sData->adj_data->flags[index] & ADJ_ON_MESH_EDGE) { + sData->adj_data->flags[index] & ADJ_ON_MESH_EDGE) + { /* if open borders, apply a fake height to keep waves going on */ avg_height = (numOfRN) ? avg_height / numOfRN : 0.0f; wPoint->height = (dt * wave_speed * avg_height + wPoint->height * avg_dist) / (avg_dist + dt * wave_speed); @@ -4507,7 +4511,8 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time /* dissolve for float types */ else if (surface->flags & MOD_DPAINT_DISSOLVE && (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || - surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)) { + surface->type == MOD_DPAINT_SURFACE_T_WEIGHT)) + { float *point = &((float *)sData->type_data)[index]; /* log or linear */ @@ -4727,7 +4732,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc /* Prepare surface normal directional scale to easily convert * brush intersection amount between global and local space */ if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE || - surface->type == MOD_DPAINT_SURFACE_T_WAVE) { + surface->type == MOD_DPAINT_SURFACE_T_WAVE) + { float temp_nor[3]; if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) { normal_short_to_float_v3(temp_nor, mvert[index].no); @@ -4856,7 +4862,8 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* Particle brush: */ if (brush->collision == MOD_DPAINT_COL_PSYS) { if (brush && brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER && - psys_check_enabled(brushObj, brush->psys)) { + psys_check_enabled(brushObj, brush->psys)) + { /* Paint a particle system */ BKE_animsys_evaluate_animdata(scene, &brush->psys->part->id, brush->psys->part->adt, BKE_scene_frame_get(scene), ADT_RECALC_ANIM); diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 87e35bc2747..061530965ef 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -705,9 +705,10 @@ makebreak: linedata3[lnr] = tb->w / cu->fsize; linedata4[lnr] = wsnr; - if ( (tb->h != 0.0f) && - ((-(yof - (tb->y / cu->fsize))) > ((tb->h / cu->fsize) - (linedist * cu->fsize)) - cu->yof) && - (cu->totbox > (curbox + 1)) ) { + if ((tb->h != 0.0f) && + ((-(yof - (tb->y / cu->fsize))) > ((tb->h / cu->fsize) - (linedist * cu->fsize)) - cu->yof) && + (cu->totbox > (curbox + 1)) ) + { maxlen = 0; tb++; curbox++; @@ -802,8 +803,7 @@ makebreak: ct++; } } - else if ((cu->spacemode == CU_FLUSH) && - (cu->tb[0].w != 0.0f)) { + else if ((cu->spacemode == CU_FLUSH) && (cu->tb[0].w != 0.0f)) { for (i = 0; i < lnr; i++) if (linedata2[i] > 1) linedata[i] = (linedata3[i] - linedata[i]) / (linedata2[i] - 1); @@ -829,7 +829,8 @@ makebreak: } if ((mem[j] != '\r') && (mem[j] != '\n') && - ((chartransdata[j].dobreak != 0))) { + ((chartransdata[j].dobreak != 0))) + { if (mem[i] == ' ') curofs += (linedata3[ct->linenr] - linedata[ct->linenr]) / linedata4[ct->linenr]; ct->xof += curofs; } @@ -1029,9 +1030,9 @@ makebreak: if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) { float ulwidth, uloverlap = 0.0f; - if ( (i < (slen - 1)) && (mem[i + 1] != '\n') && (mem[i + 1] != '\r') && - ((mem[i + 1] != ' ') || (custrinfo[i + 1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i + 1].flag & CU_CHINFO_WRAP) == 0) - ) { + if ((i < (slen - 1)) && (mem[i + 1] != '\n') && (mem[i + 1] != '\r') && + ((mem[i + 1] != ' ') || (custrinfo[i + 1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i + 1].flag & CU_CHINFO_WRAP) == 0)) + { uloverlap = xtrax + 0.1f; } // Find the character, the characters has to be in the memory already diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c index 4579e6f92aa..f135bebb8ce 100644 --- a/source/blender/blenkernel/intern/image_gen.c +++ b/source/blender/blenkernel/intern/image_gen.c @@ -123,11 +123,11 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt h = 0.125f * floorf(x / checkerwidth); if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 4) && - (fabs((y % checkerwidth) - (checkerwidth / 2)) < 4)) { - + (fabs((y % checkerwidth) - (checkerwidth / 2)) < 4)) + { if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 1) || - (fabs((y % checkerwidth) - (checkerwidth / 2)) < 1)) { - + (fabs((y % checkerwidth) - (checkerwidth / 2)) < 1)) + { hue = fmodf(fabs(h - hoffs), 1.0f); hsv_to_rgb(hue, s, v, &r, &g, &b); @@ -250,7 +250,7 @@ static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int int x, y; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { - if (((y % 32) == 0) || ((x % 32) == 0) || x == 0) { + if (((y % 32) == 0) || ((x % 32) == 0) || x == 0) { if (rect) { rect[0] = BLEND_CHAR(rect[0], blend); rect[1] = BLEND_CHAR(rect[1], blend); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index f4ec223a2fe..d776b05dce5 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1260,7 +1260,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int float t[4]; int flag; - if (key->slurph && key->type != KEY_RELATIVE) { + if (key->slurph && key->type != KEY_RELATIVE) { const float ctime_scaled = key->ctime / 100.0f; float delta = (float)key->slurph / tot; float cfra = (float)scene->r.cfra; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 7a5c43b28f8..abc31bb25ed 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -812,8 +812,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) mface->v4 == mface->v1 || /* across the face */ mface->v1 == mface->v3 || - mface->v2 == mface->v4 - ) { + mface->v2 == mface->v4) + { return 0; } } diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 1645a8c9c9b..a60bb98ac18 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -667,11 +667,11 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update) memset(&edata, 0, sizeof(edata)); CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge); - ehi = BLI_edgehashIterator_new(eh); med = CustomData_get_layer(&edata, CD_MEDGE); - for (i = 0; !BLI_edgehashIterator_isDone(ehi); - BLI_edgehashIterator_step(ehi), ++i, ++med) { - + for (ehi = BLI_edgehashIterator_new(eh), i = 0; + BLI_edgehashIterator_isDone(ehi) == FALSE; + BLI_edgehashIterator_step(ehi), ++i, ++med) + { if (update && (med_orig = BLI_edgehashIterator_getValue(ehi))) { *med = *med_orig; /* copy from the original */ } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 9000019ca2a..658a050d4d1 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2763,11 +2763,11 @@ int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, int BKE_boundbox_ray_hit_check(struct BoundBox *bb, float ray_start[3], float ray_normal[3]) { static int triangle_indexes[12][3] = {{0, 1, 2}, {0, 2, 3}, - {3, 2, 6}, {3, 6, 7}, - {1, 2, 6}, {1, 6, 5}, - {5, 6, 7}, {4, 5, 7}, - {0, 3, 7}, {0, 4, 7}, - {0, 1, 5}, {0, 4, 5}}; + {3, 2, 6}, {3, 6, 7}, + {1, 2, 6}, {1, 6, 5}, + {5, 6, 7}, {4, 5, 7}, + {0, 3, 7}, {0, 4, 7}, + {0, 1, 5}, {0, 4, 5}}; int result = 0; int i; diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index e76cde652c8..3d3a5ed7556 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -500,10 +500,10 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount // compute a new htilda #pragma omp parallel for private(i, j) - for (i = 0; i < o->_M; ++i) { + for (i = 0; i < o->_M; ++i) { // note the <= _N/2 here, see the fftw doco about // the mechanics of the complex->real fft storage - for (j = 0; j <= o->_N / 2; ++j) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex exp_param1; fftw_complex exp_param2; fftw_complex conj_param; @@ -538,8 +538,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount { if (o->_do_chop) { // x displacement - for (i = 0; i < o->_M; ++i) { - for (j = 0; j <= o->_N / 2; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex mul_param; fftw_complex minus_i; @@ -560,8 +560,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount { if (o->_do_chop) { // z displacement - for (i = 0; i < o->_M; ++i) { - for (j = 0; j <= o->_N / 2; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex mul_param; fftw_complex minus_i; @@ -582,8 +582,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount { if (o->_do_jacobian) { // Jxx - for (i = 0; i < o->_M; ++i) { - for (j = 0; j <= o->_N / 2; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex mul_param; //init_complex(mul_param, -scale, 0); @@ -597,8 +597,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount } fftw_execute(o->_Jxx_plan); - for (i = 0; i < o->_M; ++i) { - for (j = 0; j < o->_N; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j < o->_N; ++j) { o->_Jxx[i * o->_N + j] += 1.0; } } @@ -609,8 +609,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount { if (o->_do_jacobian) { // Jzz - for (i = 0; i < o->_M; ++i) { - for (j = 0; j <= o->_N / 2; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex mul_param; //init_complex(mul_param, -scale, 0); @@ -623,8 +623,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount } } fftw_execute(o->_Jzz_plan); - for (i = 0; i < o->_M; ++i) { - for (j = 0; j < o->_N; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j < o->_N; ++j) { o->_Jzz[i * o->_N + j] += 1.0; } } @@ -635,8 +635,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount { if (o->_do_jacobian) { // Jxz - for (i = 0; i < o->_M; ++i) { - for (j = 0; j <= o->_N / 2; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex mul_param; //init_complex(mul_param, -scale, 0); @@ -656,8 +656,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount { // fft normals if (o->_do_normals) { - for (i = 0; i < o->_M; ++i) { - for (j = 0; j <= o->_N / 2; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex mul_param; init_complex(mul_param, 0.0, -1.0); @@ -674,8 +674,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount #pragma omp section { if (o->_do_normals) { - for (i = 0; i < o->_M; ++i) { - for (j = 0; j <= o->_N / 2; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j <= o->_N / 2; ++j) { fftw_complex mul_param; init_complex(mul_param, 0.0, -1.0); @@ -687,8 +687,8 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount fftw_execute(o->_N_z_plan); #if 0 - for (i = 0; i < o->_M; ++i) { - for (j = 0; j < o->_N; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j < o->_N; ++j) { o->_N_y[i * o->_N + j] = 1.0f / scale; } } @@ -802,21 +802,21 @@ void BKE_init_ocean(struct Ocean *o, int M, int N, float Lx, float Lz, float V, o->_kz[i] = -2.0f * (float)M_PI * ii / o->_Lz; // pre-calculate the k matrix - for (i = 0; i < o->_M; ++i) - for (j = 0; j <= o->_N / 2; ++j) + for (i = 0; i < o->_M; ++i) + for (j = 0; j <= o->_N / 2; ++j) o->_k[i * (1 + o->_N / 2) + j] = sqrt(o->_kx[i] * o->_kx[i] + o->_kz[j] * o->_kz[j]); /*srand(seed);*/ BLI_srand(seed); - for (i = 0; i < o->_M; ++i) { - for (j = 0; j < o->_N; ++j) { + for (i = 0; i < o->_M; ++i) { + for (j = 0; j < o->_N; ++j) { float r1 = gaussRand(); float r2 = gaussRand(); fftw_complex r1r2; init_complex(r1r2, r1, r2); - mul_complex_f(o->_h0[i * o->_N + j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f))); + mul_complex_f(o->_h0[i * o->_N + j], r1r2, (float)(sqrt(Ph(o, o->_kx[i], o->_kz[j]) / 2.0f))); mul_complex_f(o->_h0_minus[i * o->_N + j], r1r2, (float)(sqrt(Ph(o, -o->_kx[i], -o->_kz[j]) / 2.0f))); } } @@ -1253,13 +1253,13 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v printf("Cannot save Displacement File Output to %s\n", string); if (o->_do_jacobian) { - cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM); + cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM); if (0 == BKE_imbuf_write(ibuf_foam, string, &imf)) printf("Cannot save Foam File Output to %s\n", string); } if (o->_do_normals) { - cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL); + cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL); if (0 == BKE_imbuf_write(ibuf_normal, string, &imf)) printf("Cannot save Normal File Output to %s\n", string); } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 5397b1729f9..941e2990a4b 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -206,7 +206,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) int totpart, totsaved = 0; if (new_totpart<0) { - if (part->distr==PART_DISTR_GRID && part->from != PART_FROM_VERT) { + if ((part->distr == PART_DISTR_GRID) && (part->from != PART_FROM_VERT)) { totpart= part->grid_res; totpart*=totpart*totpart; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index a762af960a5..8fbb3ee9800 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1448,7 +1448,8 @@ void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_upd 100); for (cfra = seq->startdisp + seq->startstill; - cfra < seq->enddisp - seq->endstill; cfra++) { + cfra < seq->enddisp - seq->endstill; cfra++) + { if (context->size_flags & IMB_PROXY_25) { seq_proxy_build_frame(render_context, seq, cfra, 25); } @@ -1675,7 +1676,8 @@ int input_have_to_preprocess( float mul; if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | - SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL)) { + SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL)) + { return TRUE; } @@ -1762,8 +1764,10 @@ static ImBuf *input_preprocess( } } - if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x || - t.xofs >= dx || t.yofs >= dy) { + if (c.top + c.bottom >= ibuf->y || + c.left + c.right >= ibuf->x || + t.xofs >= dx || t.yofs >= dy) + { make_black_ibuf(ibuf); } else { @@ -3168,7 +3172,7 @@ void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag) } if (rightflag) { - if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_final_left(seq, 0)) { + if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_final_left(seq, 0)) { seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0) + 1); } @@ -3508,7 +3512,8 @@ Sequence *seq_metastrip(ListBase *seqbase, Sequence *meta, Sequence *seq) return meta; } else if (iseq->seqbase.first && - (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) { + (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) + { return rval; } } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index fe7ec83407b..85027efa246 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -697,7 +697,7 @@ static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *count if (bpo) {/* so now we have a 2nd order humpdidump */ for (c=bpo->nofsprings;c>0;c--) { bs2 = sb->bspring + bpo->springs[c-1]; - if ((bs2->v1 != notthis) && (bs2->v1 > v0)) { + if ((bs2->v1 != notthis) && (bs2->v1 > v0)) { (*counter)++;/*hit */ if (addsprings) { bs3->v1= v0; @@ -2228,7 +2228,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo attached = 0; for (b=obp->nofsprings;b>0;b--) { bs = sb->bspring + obp->springs[b-1]; - if (( ilast-bb == bs->v2) || ( ilast-bb == bs->v1)) { + if (( ilast-bb == bs->v2) || ( ilast-bb == bs->v1)) { attached=1; continue;} } @@ -2600,7 +2600,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa attached = 0; for (b=obp->nofsprings;b>0;b--) { bs = sb->bspring + obp->springs[b-1]; - if (( sb->totpoint-a == bs->v2) || ( sb->totpoint-a == bs->v1)) { + if (( sb->totpoint-a == bs->v2) || ( sb->totpoint-a == bs->v1)) { attached=1; continue;} } @@ -4078,7 +4078,8 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i /* verify if we need to create the softbody data */ if (sb->bpoint == NULL || - ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) { + ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) + { switch (ob->type) { case OB_MESH: diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index ad5bb24e541..22e702d5930 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -610,7 +610,8 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm, * other parts of code significantly to handle missing faces. * since this really shouldn't even be possible we just bail.*/ if (ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop, - fVerts, &f) == eCCGError_InvalidValue) { + fVerts, &f) == eCCGError_InvalidValue) + { static int hasGivenError = 0; if (!hasGivenError) { diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 32cf966b7fd..7bfd4189cc3 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -1124,7 +1124,8 @@ static void txt_pop_first(Text *text) { if (txt_get_span(text->curl, text->sell) < 0 || - (text->curl == text->sell && text->curc > text->selc)) { + (text->curl == text->sell && text->curc > text->selc)) + { txt_curs_swap(text); } @@ -1140,7 +1141,8 @@ static void txt_pop_first(Text *text) static void txt_pop_last(Text *text) { if (txt_get_span(text->curl, text->sell) > 0 || - (text->curl == text->sell && text->curc < text->selc)) { + (text->curl == text->sell && text->curc < text->selc)) + { txt_curs_swap(text); } @@ -3214,7 +3216,8 @@ short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, in else if (marker->lineno > lineno) break; if ((marker->start == marker->end && start <= marker->start && marker->start <= end) || - (marker->start < end && marker->end > start)) { + (marker->start < end && marker->end > start)) + { BLI_freelinkN(&text->markers, marker); cleared = 1; } @@ -3234,7 +3237,8 @@ short txt_clear_markers(Text *text, int group, int flags) next = marker->next; if ((!group || marker->group == group) && - (marker->flags & flags) == flags) { + (marker->flags & flags) == flags) + { BLI_freelinkN(&text->markers, marker); cleared = 1; } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 2c868ca2601..2ec42b47e5c 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -233,7 +233,8 @@ void init_tex_mapping(TexMapping *texmap) float smat[3][3], rmat[3][3], mat[3][3], proj[3][3]; if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z && - is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) { + is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) + { unit_m4(texmap->mat); texmap->flag |= TEXMAP_UNIT_MATRIX; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index a3fdb41fe37..91e93bbd05d 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -472,7 +472,8 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex c->time_base.num = 100; } else if ((double) ((int) rd->frs_sec_base) == - rd->frs_sec_base) { + rd->frs_sec_base) + { c->time_base.den = rd->frs_sec; c->time_base.num = (int) rd->frs_sec_base; } @@ -523,7 +524,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex if (codec_id == CODEC_ID_FFV1) { #ifdef FFMPEG_FFV1_ALPHA_SUPPORTED - if (rd->im_format.planes == R_IMF_PLANES_RGBA) { + if (rd->im_format.planes == R_IMF_PLANES_RGBA) { c->pix_fmt = PIX_FMT_RGB32; } else { @@ -535,7 +536,7 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex } if (codec_id == CODEC_ID_QTRLE) { - if (rd->im_format.planes == R_IMF_PLANES_RGBA) { + if (rd->im_format.planes == R_IMF_PLANES_RGBA) { c->pix_fmt = PIX_FMT_ARGB; } } @@ -544,7 +545,8 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex // || !strcmp(of->oformat->name, "mp4") // || !strcmp(of->oformat->name, "mov") // || !strcmp(of->oformat->name, "3gp") - ) { + ) + { fprintf(stderr, "Using global header\n"); c->flags |= CODEC_FLAG_GLOBAL_HEADER; } @@ -903,7 +905,8 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd) while (*fe) { if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), - *fe) == 0) { + *fe) == 0) + { break; } fe++; @@ -955,7 +958,8 @@ static void write_audio_frames(double to_pts) while (audio_stream && !finished) { if ((audio_time >= to_pts) || - (write_audio_frame())) { + (write_audio_frame())) + { finished = 1; } } @@ -1406,8 +1410,8 @@ void BKE_ffmpeg_image_type_verify(RenderData *rd, ImageFormatData *imf) if (rd->ffcodecdata.type <= 0 || rd->ffcodecdata.codec <= 0 || rd->ffcodecdata.audio_codec <= 0 || - rd->ffcodecdata.video_bitrate <= 1) { - + rd->ffcodecdata.video_bitrate <= 1) + { rd->ffcodecdata.codec = CODEC_ID_MPEG2VIDEO; BKE_ffmpeg_preset_set(rd, FFMPEG_PRESET_DVD); -- cgit v1.2.3