diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-04 01:35:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-04 01:35:04 +0400 |
commit | 5da2135eef39ac042a8c4babcac7be375e6903d2 (patch) | |
tree | 520282b4cae162503de17481cfbfbe43a93ed073 /source | |
parent | b075765edd9e8f18b088faf1a55358d0f8a289cd (diff) |
code cleanup: double promotion & some style cleanup
Diffstat (limited to 'source')
39 files changed, 142 insertions, 139 deletions
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index a6666bf4fae..bd079238b12 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -586,7 +586,7 @@ static int layerEqual_mloopcol(void *data1, void *data2) b = m1->b - m2->b; a = m1->a - m2->a; - return r*r + g*g + b*b + a*a < 0.001; + return r * r + g * g + b * b + a * a < 0.001f; } static void layerMultiply_mloopcol(void *data, float fac) diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index fdeb212b561..40c04a170ca 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -2014,7 +2014,7 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex, for (i=0; i<tot; i++, disps += side*side, ld++) { ld->totdisp = side*side; - ld->level = (int)(logf(side - 1.0f) / M_LN2) + 1; + ld->level = (int)(logf(side - 1.0f) / (float)M_LN2) + 1; if (ld->disps) MEM_freeN(ld->disps); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index eb821ffc147..a2e95622bcf 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4096,7 +4096,7 @@ static void select_similar_direction(bArmature *arm, EditBone *ebone_act, const float dir[3]; sub_v3_v3v3(dir, ebone->head, ebone->tail); - if (angle_v3v3(dir_act, dir) / M_PI < thresh) { + if (angle_v3v3(dir_act, dir) / (float)M_PI < thresh) { ED_armature_edit_bone_select(ebone); } } diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index c2a97b3ea70..60c0ebbc7b3 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -475,7 +475,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &view_aligned); if (!view_aligned) - rot[0] += M_PI / 2.0f; + rot[0] += (float)M_PI / 2.0f; make_prim_init(C, "Monkey", &dia, mat, &state, loc, rot, layer); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 2208d96ca46..b215f0ac345 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1412,7 +1412,7 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->ethresh); if (kcd->ignore_vert_snapping) - maxdist *= 0.5; + maxdist *= 0.5f; f = knife_find_closest_face(kcd, co, cageco, NULL); *is_space = !f; @@ -1502,7 +1502,7 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->vthresh); if (kcd->ignore_vert_snapping) - maxdist *= 0.5; + maxdist *= 0.5f; f = knife_find_closest_face(kcd, co, cageco, is_space); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 32e70e798fe..d38ec6436b9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1129,7 +1129,7 @@ static float edgetag_cut_cost(BMEditMesh *UNUSED(em), BMEdge *e1, BMEdge *e2, BM /* but is biased to give higher values to sharp turns, so that it will take * paths with fewer "turns" when selecting between equal-weighted paths between * the two edges */ - cost = cost + 0.5f * cost * (2.0f - sqrt(fabs(dot_v3v3(d1, d2)))); + cost = cost + 0.5f * cost * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2)))); return cost; } @@ -2294,7 +2294,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op) float sharp = RNA_float_get(op->ptr, "sharpness"); int i; - sharp = (sharp * M_PI) / 180.0; + sharp = (sharp * (float)M_PI) / 180.0f; BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) { BM_elem_flag_disable(f, BM_ELEM_TAG); diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c index 36ce610c64b..a86a274eb70 100644 --- a/source/blender/editors/mesh/editmesh_slide.c +++ b/source/blender/editors/mesh/editmesh_slide.c @@ -279,7 +279,7 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) /* Get 3d view */ View3D *view3d = CTX_wm_view3d(C); const float outline_w = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.8f; - const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5; + const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f; int i = 0; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index c6b899bfd37..524ee029339 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2346,7 +2346,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) if (!BM_elem_flag_test(ev, BM_ELEM_HIDDEN)) { switch (mode) { case -1: /* aligned */ - if (fabs(ev->co[axis] - value) < limit) + if (fabsf(ev->co[axis] - value) < limit) BM_vert_select_set(em->bm, ev, TRUE); break; case 0: /* neg */ @@ -2593,21 +2593,21 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode, m1 = MAXSLOPE; b1 = x12; } - x2max = MAX2(x21, x22) + 0.001; /* prevent missed edges */ - x2min = MIN2(x21, x22) - 0.001; /* due to round off error */ - y2max = MAX2(y21, y22) + 0.001; - y2min = MIN2(y21, y22) - 0.001; + x2max = MAX2(x21, x22) + 0.001f; /* prevent missed edges */ + x2min = MIN2(x21, x22) - 0.001f; /* due to round off error */ + y2max = MAX2(y21, y22) + 0.001f; + y2min = MIN2(y21, y22) - 0.001f; /* Found an intersect, calc intersect point */ if (m1 == m2) { /* co-incident lines */ /* cut at 50% of overlap area */ x1max = MAX2(x11, x12); x1min = MIN2(x11, x12); - xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0; + xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0f; y1max = MAX2(y11, y12); y1min = MIN2(y11, y12); - yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0; + yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0f; } else if (m2 == MAXSLOPE) { xi = x22; @@ -4034,7 +4034,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op) if (tex->type == TEX_STUCCI) { float b2, vec[3]; - float ofs = tex->turbul / 200.0; + float ofs = tex->turbul / 200.0f; BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { b2 = BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]); @@ -4121,7 +4121,7 @@ static int edbm_bevel_exec(bContext *C, wmOperator *op) w[i] = s; ftot += s; - df *= 2.0; + df *= 2.0f; } mul_vn_fl(w, recursion, 1.0f / (float)ftot); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 2ebeb9ca224..a17f335091b 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -671,7 +671,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx sub_v2_v2v2(uvdiff, uv2, uv); - if (fabs(uvdiff[0]) < limit[0] && fabs(uvdiff[1]) < limit[1]) { + if (fabsf(uvdiff[0]) < limit[0] && fabsf(uvdiff[1]) < limit[1]) { if (lastv) lastv->next = next; else vlist = next; iterv->next = newvlist; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index fb9b012a31a..f611a985797 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -275,11 +275,11 @@ int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int laye else if (len > 2) { float fac = 0.0f, dfac = 1.0f / (float)len; - dfac *= M_PI * 2; + dfac *= (float)M_PI * 2.0f; for (i = 0; i < len; i++) { - fuvs[i][0] = 0.5f * sin(fac) + 0.5f; - fuvs[i][1] = 0.5f * cos(fac) + 0.5f; + fuvs[i][0] = 0.5f * sinf(fac) + 0.5f; + fuvs[i][1] = 0.5f * cosf(fac) + 0.5f; fac += dfac; } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index b4d5d2c1c79..acafe62150f 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -1257,7 +1257,7 @@ static void vgroup_blend(Object *ob, const float fac) int i, dvert_tot = 0; const int def_nr = ob->actdef - 1; - BLI_assert(fac >= 0.0 && fac <= 1.0f); + BLI_assert(fac >= 0.0f && fac <= 1.0f); if (ob->type != OB_MESH) { return; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 772c114e6d6..2fa1e759e21 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -172,8 +172,8 @@ static void area_draw_azone(short x1, short y1, short x2, short y2) int dx = x2 - x1; int dy = y2 - y1; - dx= copysign(ceil(0.3f*fabs(dx)), dx); - dy= copysign(ceil(0.3f*fabs(dy)), dy); + dx = copysign(ceilf(0.3f * fabsf(dx)), dx); + dy = copysign(ceilf(0.3f * fabsf(dy)), dy); glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 4545c498fed..707d5b2aa7c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -207,8 +207,8 @@ void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, float float strength; strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root); - sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter)); - sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter)); + sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter)); + sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter)); for (element = sculptdata->uv[i].element; element; element = element->next) { MLoopUV *luv; @@ -271,8 +271,8 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul float strength; strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root); - sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0]; - sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1]; + sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0]; + sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1]; for (element = sculptdata->uv[i].element; element; element = element->next) { MLoopUV *luv; @@ -347,8 +347,8 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event, strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root); normalize_v2(diff); - sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001; - sculptdata->uv[i].uv[1] -= strength * diff[1] * 0.001; + sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f; + sculptdata->uv[i].uv[1] -= strength * diff[1] * 0.001f; for (element = sculptdata->uv[i].element; element; element = element->next) { MLoopUV *luv; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index ec383e1dbdb..e1828bbef32 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -313,15 +313,15 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** double scalar = bUnit_GetScaler(usys, i); dx_scalar = dx * scalar / unit->scale_length; - if (dx_scalar < (GRID_MIN_PX * 2)) + if (dx_scalar < (GRID_MIN_PX * 2.0)) continue; /* Store the smallest drawn grid size units name so users know how big each grid cell is */ if (*grid_unit == NULL) { *grid_unit = bUnit_GetNameDisplay(usys, i); - rv3d->gridview = (scalar * v3d->grid) / unit->scale_length; + rv3d->gridview = (float)((scalar * v3d->grid) / (double)unit->scale_length); } - blend_fac = 1 - ((GRID_MIN_PX * 2) / dx_scalar); + blend_fac = 1.0f - ((GRID_MIN_PX * 2.0f) / (float)dx_scalar); /* tweak to have the fade a bit nicer */ blend_fac = (blend_fac * blend_fac) * 2.0f; @@ -355,7 +355,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** } } else { // start blending out - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6)); + UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6.0f)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); @@ -363,7 +363,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char ** } } else { // start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10)) - UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6)); + UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6.0f)); drawgrid_draw(ar, wx, wy, x, y, dx); UI_ThemeColor(TH_GRID); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 44fee7d663d..39cda3efd93 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -696,7 +696,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) if (dot_v3v3(xaxis, m_inv[0]) < 0) { negate_v3(xaxis); } - fac = angle_normalized_v3v3(zvec_global, m_inv[2]) / M_PI; + fac = angle_normalized_v3v3(zvec_global, m_inv[2]) / (float)M_PI; fac = fabsf(fac - 0.5f) * 2; fac = fac * fac; interp_v3_v3v3(xaxis, xaxis, m_inv[0], fac); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 8a211c6a22e..f106fcc268e 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2199,7 +2199,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f int bbsel; CircleSelectUserData data; - bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0)); + bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */ vc->em = BMEdit_FromObject(vc->obedit); @@ -2250,7 +2250,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, const int m if (me) { bm_vertoffs = me->totpoly + 1; /* max index array */ - /* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0)); + /* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f)); edbm_backbuf_check_and_select_tfaces(me, select == LEFTMOUSE); EDBM_backbuf_free(); } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5ee3e4bb96d..599d4a559ed 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3694,9 +3694,9 @@ void flushTransGraphData(TransInfo *t) switch (sipo->autosnap) { case SACTSNAP_FRAME: /* snap to nearest frame (or second if drawing seconds) */ if (sipo->flag & SIPO_DRAWTIME) - td2d->loc[0]= (float)(floor((td2d->loc[0]/secf) + 0.5f) * secf); + td2d->loc[0] = (float)(floorf((td2d->loc[0]/secf) + 0.5f) * secf); else - td2d->loc[0]= (float)(floor(td2d->loc[0]+0.5f)); + td2d->loc[0] = (float)(floorf(td2d->loc[0]+0.5f)); break; case SACTSNAP_MARKER: /* snap to nearest marker */ diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 0bf02d1a2bf..bea1002b5c6 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -204,16 +204,16 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) } if (axis & 2) { - if (fabs(iloc[1])<=tolerance[1] || - loc[1]*iloc[1]<0.0f) + if (fabsf(iloc[1]) <= tolerance[1] || + loc[1] * iloc[1]<0.0f) { loc[1]= 0.0f; clip = 1; } } if (axis & 4) { - if (fabs(iloc[2])<=tolerance[2] || - loc[2]*iloc[2]<0.0f) + if (fabsf(iloc[2]) <= tolerance[2] || + loc[2] * iloc[2] < 0.0f) { loc[2]= 0.0f; clip = 1; @@ -541,12 +541,12 @@ static void recalcData_nla(TransInfo *t) switch (snla->autosnap) { case SACTSNAP_FRAME: /* snap to nearest frame/time */ if (snla->flag & SNLA_DRAWTIME) { - tdn->h1[0]= (float)( floor((tdn->h1[0]/secf) + 0.5f) * secf ); - tdn->h2[0]= (float)( floor((tdn->h2[0]/secf) + 0.5f) * secf ); + tdn->h1[0] = (float)(floor(((double)tdn->h1[0] / secf) + 0.5) * secf); + tdn->h2[0] = (float)(floor(((double)tdn->h2[0] / secf) + 0.5) * secf); } else { - tdn->h1[0]= (float)( floor(tdn->h1[0]+0.5f) ); - tdn->h2[0]= (float)( floor(tdn->h2[0]+0.5f) ); + tdn->h1[0] = floorf(tdn->h1[0] + 0.5f); + tdn->h2[0] = floorf(tdn->h2[0] + 0.5f); } break; diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 467e3dc600e..0f0d1cc8344 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -199,17 +199,17 @@ static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const int mva mdx = (mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f) - data[2]; mdy = (mi->precision_mval[1] + (float)(mval[1] - mi->precision_mval[1]) / 10.0f) - data[3]; - distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; + distance = (length != 0.0) ? (mdx * dx + mdy * dy) / length: 0.0; } else { int mdx, mdy; mdx = mval[0] - data[2]; mdy = mval[1] - data[3]; - distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; + distance = (length != 0.0) ? (mdx * dx + mdy * dy) / length: 0.0; } - output[0] = (float)((length != 0.0f)? distance / length: 0.0f); + output[0] = (length != 0.0) ? (double)(distance / length) : 0.0f; } } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index fb7e2254e45..a90f8253654 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -855,7 +855,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) glDisable(GL_BLEND); /* draw vert preview */ - glPointSize(pointsize * 2.0); + glPointSize(pointsize * 2.0f); UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE); glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_stitchable); glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 1073369a36d..b515f30e150 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -799,9 +799,9 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em, luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); if (penalty && uvedit_uv_select_test(em, scene, l)) - dist = fabs(co[0] - luv->uv[0]) + penalty[0] + fabs(co[1] - luv->uv[1]) + penalty[1]; + dist = fabsf(co[0] - luv->uv[0]) + penalty[0] + fabsf(co[1] - luv->uv[1]) + penalty[1]; else - dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]); + dist = fabsf(co[0] - luv->uv[0]) + fabsf(co[1] - luv->uv[1]); if (dist <= mindist) { if (dist == mindist) diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 9474ae95c34..b30821dc56a 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -257,8 +257,8 @@ static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2]) uv[0] -= medianPoint[0]; uv[1] -= medianPoint[1]; - uv_rotation_result[0] = cos(rotation) * uv[0] - sin(rotation) * uv[1]; - uv_rotation_result[1] = sin(rotation) * uv[0] + cos(rotation) * uv[1]; + uv_rotation_result[0] = cosf(rotation) * uv[0] - sinf(rotation) * uv[1]; + uv_rotation_result[1] = sinf(rotation) * uv[0] + cosf(rotation) * uv[1]; uv[0] = uv_rotation_result[0] + medianPoint[0]; uv[1] = uv_rotation_result[1] + medianPoint[1]; @@ -286,8 +286,8 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it l_iter = element_iter->l; luv_iter = CustomData_bmesh_get(&state->em->bm->ldata, l_iter->head.data, CD_MLOOPUV); - if (fabs(luv_orig->uv[0] - luv_iter->uv[0]) < limit && - fabs(luv_orig->uv[1] - luv_iter->uv[1]) < limit) + if (fabsf(luv_orig->uv[0] - luv_iter->uv[0]) < limit && + fabsf(luv_orig->uv[1] - luv_iter->uv[1]) < limit) { return 1; } @@ -403,7 +403,7 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta edgecos = uv1[0] * uv2[0] + uv1[1] * uv2[1]; edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1]; - rotation = (edgesin > 0) ? acos(MAX2(-1.0, MIN2(1.0, edgecos))) : -acos(MAX2(-1.0, MIN2(1.0, edgecos))); + rotation = (edgesin > 0.0f) ? acosf(MAX2(-1.0f, MIN2(1.0f, edgecos))) : -acosf(MAX2(-1.0f, MIN2(1.0f, edgecos))); island_stitch_data[element1->island].num_rot_elements++; island_stitch_data[element1->island].rotation += rotation; @@ -412,7 +412,7 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta static void stitch_island_calculate_vert_rotation(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data) { - float edgecos = 1, edgesin = 0; + float edgecos = 1.0f, edgesin = 0.0f; int index; UvElement *element_iter; float rotation = 0; @@ -441,12 +441,12 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat negate_v2_v2(normal, state->normals + index_tmp2 * 2); edgecos = dot_v2v2(normal, state->normals + index_tmp1 * 2); edgesin = cross_v2v2(normal, state->normals + index_tmp1 * 2); - rotation += (edgesin > 0) ? acos(edgecos) : -acos(edgecos); + rotation += (edgesin > 0.0f) ? acosf(edgecos) : -acosf(edgecos); } } if (state->midpoints) - rotation /= 2.0; + rotation /= 2.0f; island_stitch_data[element->island].num_rot_elements++; island_stitch_data[element->island].rotation += rotation; } @@ -1364,7 +1364,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event) case PADPLUSKEY: case WHEELUPMOUSE: if (event->alt) { - stitch_state->limit_dist += 0.01; + stitch_state->limit_dist += 0.01f; if (!stitch_process_data(stitch_state, scene, 0)) { return stitch_cancel(C, op); } @@ -1377,8 +1377,8 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event) case PADMINUS: case WHEELDOWNMOUSE: if (event->alt) { - stitch_state->limit_dist -= 0.01; - stitch_state->limit_dist = MAX2(0.01, stitch_state->limit_dist); + stitch_state->limit_dist -= 0.01f; + stitch_state->limit_dist = MAX2(0.01f, stitch_state->limit_dist); if (!stitch_process_data(stitch_state, scene, 0)) { return stitch_cancel(C, op); } diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 743869e82cc..b2c7dd59f1d 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1027,7 +1027,7 @@ static void correct_uv_aspect(BMEditMesh *em) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - luv->uv[0] = ((luv->uv[0] - 0.5) * scale) + 0.5; + luv->uv[0] = ((luv->uv[0] - 0.5f) * scale) + 0.5f; } } } @@ -1040,7 +1040,7 @@ static void correct_uv_aspect(BMEditMesh *em) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - luv->uv[1] = ((luv->uv[1] - 0.5) * scale) + 0.5; + luv->uv[1] = ((luv->uv[1] - 0.5f) * scale) + 0.5f; } } } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 1737f3b79e6..06eefc36723 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -133,9 +133,8 @@ typedef struct Library { * some cases its useful to access the absolute one, * This is set on file read. * Use BKE_library_filepath_set() rather than - * setting 'name' directly and it will be kepk in + * setting 'name' directly and it will be kept in * sync - campbell */ - int tot, pad; /* tot, idblock and filedata are only fo read and write */ struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */ } Library; @@ -151,7 +150,7 @@ typedef struct PreviewImage { unsigned int h[2]; short changed[2]; short changed_timestamp[2]; - unsigned int * rect[2]; + unsigned int *rect[2]; } PreviewImage; /** @@ -255,4 +254,3 @@ typedef struct PreviewImage { #endif #endif - diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index de2c9919df0..dfc70e5bd66 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -92,8 +92,8 @@ typedef struct Image { unsigned int bindcode; /* only for current image... */ unsigned int *repbind; /* for repeat of parts of images */ - struct PackedFile * packedfile; - struct PreviewImage * preview; + struct PackedFile *packedfile; + struct PreviewImage *preview; /* game engine tile animation */ float lastupdate; @@ -141,4 +141,3 @@ typedef struct Image { #define IMA_GEN_FLOAT 1 #endif - diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index 85adf524717..5eb4e2190e4 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -265,7 +265,7 @@ static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value) if (clip->lastsize[0]) value = clip->lastsize[0]*value/camera->sensor_width; - if (value >= 0.0001) + if (value >= 0.0001f) camera->focal = value; } diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 711c7e6e4ff..8d6295ee6d4 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -113,7 +113,7 @@ static void VertexIt_Fill(CSG_IteratorPtr it, CSG_IVertex *vert) static void VertexIt_Step(CSG_IteratorPtr it) { VertexIt * iterator = (VertexIt *)it; - iterator->pos ++; + iterator->pos++; } static void VertexIt_Reset(CSG_IteratorPtr it) @@ -207,7 +207,7 @@ static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face) static void FaceIt_Step(CSG_IteratorPtr it) { FaceIt * face_it = (FaceIt *)it; - face_it->pos ++; + face_it->pos++; } static void FaceIt_Reset(CSG_IteratorPtr it) @@ -441,7 +441,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh( mat_nr = 0; for (a = 0; a < ob1->totcol; a++) { - if (give_current_material(ob1, a+1) == orig_mat) { + if (give_current_material(ob1, a + 1) == orig_mat) { mat_nr = a; break; } @@ -601,7 +601,7 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type) dm_select = mesh_create_derived_view(scene, ob_select, 0); // no modifiers in editmode ?? maxmat= ob->totcol + ob_select->totcol; - mat= (Material**)MEM_mallocN(sizeof(Material*)*maxmat, "NewBooleanMeshMat"); + mat = (Material **)MEM_mallocN(sizeof(Material *) * maxmat, "NewBooleanMeshMat"); /* put some checks in for nice user feedback */ if (dm == NULL || dm_select == NULL) { @@ -632,7 +632,7 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type) /* add materials to object */ for (a = 0; a < totmat; a++) - assign_material(ob_new, mat[a], a+1); + assign_material(ob_new, mat[a], a + 1); MEM_freeN(mat); diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index d5d8439c749..1bc23ab5040 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -113,7 +113,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *scene, Ob CollisionModifierData *coll_clmd = (CollisionModifierData *)modifiers_findByType(ob1, eModifierType_Collision); if (coll_clmd) { DagNode *curNode = dag_get_node(forest, ob1); - dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Cloth Collision"); + dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Cloth Collision"); } } } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 83a366815de..9636104cb06 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -117,7 +117,7 @@ static void deformVerts(ModifierData *md, Object *ob, /* if possible use/create DerivedMesh */ if (derivedData) dm = CDDM_copy(derivedData); - else if (ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob); + else if (ob->type == OB_MESH) dm = CDDM_from_mesh(ob->data, ob); if (!ob->pd) { printf("CollisionModifier deformVerts: Should not happen!\n"); @@ -138,7 +138,7 @@ static void deformVerts(ModifierData *md, Object *ob, numverts = dm->getNumVerts (dm); - if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) { + if ((current_time > collmd->time_xnew) || (BKE_ptcache_get_continue_physics())) { unsigned int i; // check if mesh has changed @@ -148,7 +148,7 @@ static void deformVerts(ModifierData *md, Object *ob, if (collmd->time_xnew == -1000) { /* first time */ collmd->x = dm->dupVertArray(dm); // frame start position - for ( i = 0; i < numverts; i++ ) { + for (i = 0; i < numverts; i++) { // we save global positions mul_m4_v3(ob->obmat, collmd->x[i].co); } diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index f55faf9c183..e1a8e221476 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -140,7 +140,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), /* we assume the decim_faces tells how much to reduce */ while (lod.face_num > numTris*dmd->percent) { - if ( LOD_CollapseEdge(&lod)==0) break; + if ( LOD_CollapseEdge(&lod) == 0) break; } if (lod.vertex_num>2) { @@ -160,7 +160,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), if (lod.vertex_num>2) { mface = CDDM_get_tessfaces(result); - for (a=0; a<lod.face_num; a++) { + for (a = 0; a < lod.face_num; a++) { MFace *mf = &mface[a]; int *tri = &lod.triangle_index_buffer[a*3]; mf->v1 = tri[0]; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index 70294588fd4..4d9b8de061e 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -189,7 +189,7 @@ static void displaceModifier_do( modifier_init_texture(dmd->modifier.scene, dmd->texture); - for (i = 0; i < numVerts; ++i) { + for (i = 0; i < numVerts; i++) { TexResult texres; float delta = 0, strength = dmd->strength; diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index def02081be8..3e399707040 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -64,7 +64,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj BMEditMesh *em; BMIter iter; BMEdge *e; - float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0); + float threshold = cosf((emd->split_angle + 0.00001f) * (float)M_PI / 180.0f); em = DM_to_editbmesh(dm, NULL, FALSE); bm = em->bm; diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index b115e5bb244..ef3a6d8217e 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -122,7 +122,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, DagNode *curNode = dag_get_node(forest, hmd->object); if (hmd->subtarget[0]) - dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, "Hook Modifier"); + dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA | DAG_RL_DATA_DATA, "Hook Modifier"); else dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA, "Hook Modifier"); } @@ -195,9 +195,9 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, for (j = 0; j < numVerts; j++) { if (origindex_ar[j] == *index_pt) { float *co = vertexCos[j]; - if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if ((fac = hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { if (dvert) - fac *= defvert_find_weight(dvert+j, defgrp_index); + fac *= defvert_find_weight(dvert + j, defgrp_index); if (fac) { mul_v3_m4v3(vec, mat, co); @@ -210,12 +210,12 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, } } else { /* missing dm or ORIGINDEX */ - for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) { + for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) { if (*index_pt < numVerts) { float *co = vertexCos[*index_pt]; - if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if ((fac = hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { if (dvert) - fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index); + fac *= defvert_find_weight(dvert + (*index_pt), defgrp_index); if (fac) { mul_v3_m4v3(vec, mat, co); @@ -227,13 +227,13 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, } } else if (dvert) { /* vertex group hook */ - const float fac_orig= hmd->force; + const float fac_orig = hmd->force; for (i = 0; i < max_dvert; i++, dvert++) { float fac; float *co = vertexCos[i]; - if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { + if ((fac = hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) { fac *= defvert_find_weight(dvert, defgrp_index); if (fac) { mul_v3_m4v3(vec, mat, co); diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 32376acc553..a8f5f008e0c 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -407,7 +407,9 @@ ModifierTypeInfo modifierType_Mask = { /* structName */ "MaskModifierData", /* structSize */ sizeof(MaskModifierData), /* type */ eModifierTypeType_Nonconstructive, - /* flags */ eModifierTypeFlag_AcceptsMesh|eModifierTypeFlag_SupportsMapping|eModifierTypeFlag_SupportsEditmode, + /* flags */ eModifierTypeFlag_AcceptsMesh | + eModifierTypeFlag_SupportsMapping | + eModifierTypeFlag_SupportsEditmode, /* copyData */ copyData, /* deformVerts */ NULL, diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index aee8dd21903..1bcafc2918e 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -142,24 +142,24 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3 size= mmd->dyngridsize; for (i=0; i<3; i++) { - gridvec[i]= (vec[i] - mmd->dyncellmin[i] - mmd->dyncellwidth*0.5f)/mmd->dyncellwidth; - ivec[i]= (int)gridvec[i]; - dvec[i]= gridvec[i] - ivec[i]; + gridvec[i] = (vec[i] - mmd->dyncellmin[i] - mmd->dyncellwidth*0.5f)/mmd->dyncellwidth; + ivec[i] = (int)gridvec[i]; + dvec[i] = gridvec[i] - ivec[i]; } for (i=0; i<8; i++) { - if (i & 1) { x= ivec[0]+1; wx= dvec[0]; } - else { x= ivec[0]; wx= 1.0f-dvec[0]; } + if (i & 1) { x = ivec[0] + 1; wx = dvec[0]; } + else { x = ivec[0]; wx = 1.0f - dvec[0]; } - if (i & 2) { y= ivec[1]+1; wy= dvec[1]; } - else { y= ivec[1]; wy= 1.0f-dvec[1]; } + if (i & 2) { y = ivec[1] + 1; wy = dvec[1]; } + else { y = ivec[1]; wy = 1.0f - dvec[1]; } - if (i & 4) { z= ivec[2]+1; wz= dvec[2]; } - else { z= ivec[2]; wz= 1.0f-dvec[2]; } + if (i & 4) { z = ivec[2] + 1; wz = dvec[2]; } + else { z = ivec[2]; wz = 1.0f - dvec[2]; } - CLAMP(x, 0, size-1); - CLAMP(y, 0, size-1); - CLAMP(z, 0, size-1); + CLAMP(x, 0, size - 1); + CLAMP(y, 0, size - 1); + CLAMP(z, 0, size - 1); a= x + y*size + z*size*size; weight= wx*wy*wz; @@ -314,7 +314,7 @@ static void meshdeformModifier_do( totweight= 0.0f; zero_v3(co); - for (a=offsets[b]; a<offsets[b+1]; a++) { + for (a = offsets[b]; a < offsets[b + 1]; a++) { weight= influences[a].weight; madd_v3_v3fl(co, dco[influences[a].vertex], weight); totweight += weight; @@ -322,7 +322,7 @@ static void meshdeformModifier_do( } if (totweight > 0.0f) { - mul_v3_fl(co, fac/totweight); + mul_v3_fl(co, fac / totweight); mul_m3_v3(icagemat, co); if (G.rt != 527) add_v3_v3(vertexCos[b], co); @@ -394,8 +394,8 @@ void modifier_mdef_compact_influences(ModifierData *md) } /* allocate bind influences */ - mmd->bindinfluences= MEM_callocN(sizeof(MDefInfluence)*mmd->totinfluence, "MDefBindInfluence"); - mmd->bindoffsets= MEM_callocN(sizeof(int)*(totvert+1), "MDefBindOffset"); + mmd->bindinfluences = MEM_callocN(sizeof(MDefInfluence) * mmd->totinfluence, "MDefBindInfluence"); + mmd->bindoffsets = MEM_callocN(sizeof(int) * (totvert + 1), "MDefBindOffset"); /* write influences */ totinfluence= 0; @@ -417,8 +417,8 @@ void modifier_mdef_compact_influences(ModifierData *md) weight= weights[a + b*totcagevert]; if (weight > MESHDEFORM_MIN_INFLUENCE) { - mmd->bindinfluences[totinfluence].weight= weight/totweight; - mmd->bindinfluences[totinfluence].vertex= a; + mmd->bindinfluences[totinfluence].weight = weight / totweight; + mmd->bindinfluences[totinfluence].vertex = a; totinfluence++; } } diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 09924b5b0a4..2df0bd17eaf 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -231,10 +231,10 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd, ml2 = ml + mp->loopstart + maxLoops; e = ml2[0].e; - for (j = 0; j < mp->totloop-1; j++) { - ml2[j].e = ml2[j+1].e; + for (j = 0; j < mp->totloop - 1; j++) { + ml2[j].e = ml2[j + 1].e; } - ml2[mp->totloop-1].e = e; + ml2[mp->totloop - 1].e = e; mp->loopstart += maxLoops; } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index d3e54651eea..71839312cf5 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -478,7 +478,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, sub_v3_v3v3(e1, mvert[ml_next->v].co, mvert[ml->v].co); sub_v3_v3v3(e2, mvert[ml_prev->v].co, mvert[ml->v].co); - angle = M_PI - angle_normalized_v3v3(e1, e2); + angle = (float)M_PI - angle_normalized_v3v3(e1, e2); BLI_array_append(face_angles, angle); } @@ -644,13 +644,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, ml[j].v = ed->v1+numVerts; ml[j++].e = eidx+numEdges; - ml[j].v = ed->v2+numVerts; - ml[j++].e = numEdges*2 + old_vert_arr[ed->v2]; + ml[j].v = ed->v2 + numVerts; + ml[j++].e = numEdges * 2 + old_vert_arr[ed->v2]; } if (edge_origIndex) { - edge_origIndex[ml[j-3].e] = ORIGINDEX_NONE; - edge_origIndex[ml[j-1].e] = ORIGINDEX_NONE; + edge_origIndex[ml[j - 3].e] = ORIGINDEX_NONE; + edge_origIndex[ml[j - 1].e] = ORIGINDEX_NONE; } /* use the next material index if option enabled */ @@ -667,13 +667,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (crease_inner) { /* crease += crease_inner; without wrapping */ - unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease); - int tcr= *cr + crease_inner; - *cr= tcr > 255 ? 255 : tcr; + unsigned char *cr = (unsigned char *)&(medge[numEdges + eidx].crease); + int tcr = *cr + crease_inner; + *cr = tcr > 255 ? 255 : tcr; } #ifdef SOLIDIFY_SIDE_NORMALS - normal_quad_v3(nor, mvert[ml[j-4].v].co, mvert[ml[j-3].v].co, mvert[ml[j-2].v].co, mvert[ml[j-1].v].co); + normal_quad_v3(nor, mvert[ml[j - 4].v].co, + mvert[ml[j - 3].v].co, + mvert[ml[j - 2].v].co, + mvert[ml[j - 1].v].co); add_v3_v3(edge_vert_nos[ed->v1], nor); add_v3_v3(edge_vert_nos[ed->v2], nor); diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index 38a93091700..5ee8103630d 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -192,7 +192,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index); - if (wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */ + if (wmd->curfalloff == NULL) /* should never happen, but bad lib linking could cause it */ wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); invert_m4_m4(obinv, ob->obmat); @@ -229,9 +229,10 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, for (i = 0; i < numVerts; i++) { float *co = vertexCos[i]; - if (wmd->falloff_type==eWarp_Falloff_None || - ((fac=len_v3v3(co, mat_from[3])) < wmd->falloff_radius && (fac=(wmd->falloff_radius-fac)/wmd->falloff_radius)) ) { - + if (wmd->falloff_type == eWarp_Falloff_None || + ((fac = len_v3v3(co, mat_from[3])) < wmd->falloff_radius && + (fac = (wmd->falloff_radius-fac) / wmd->falloff_radius))) + { /* skip if no vert group found */ if (dvert && defgrp_index >= 0) { dv = &dvert[i]; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index bcfdced4ffd..31cd20e7f97 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -112,7 +112,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3], dist_f,loc2trgt) \ schedule(static) #endif - for (i = 0; i < numVerts; ++i) { + for (i = 0; i < numVerts; i++) { float tmp_co[3]; /* Convert the vertex to tree coordinates. */ @@ -319,12 +319,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) { curNode = dag_get_node(forest, wmd->mask_tex_map_obj); - dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, + dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "WeightVGProximity Modifier"); } if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) - dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, + dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "WeightVGProximity Modifier"); } @@ -546,10 +546,10 @@ ModifierTypeInfo modifierType_WeightVGProximity = { /* structName */ "WeightVGProximityModifierData", /* structSize */ sizeof(WeightVGProximityModifierData), /* type */ eModifierTypeType_NonGeometrical, - /* flags */ eModifierTypeFlag_AcceptsMesh - |eModifierTypeFlag_SupportsMapping - |eModifierTypeFlag_SupportsEditmode - |eModifierTypeFlag_UsesPreview, + /* flags */ eModifierTypeFlag_AcceptsMesh | + eModifierTypeFlag_SupportsMapping | + eModifierTypeFlag_SupportsEditmode | + eModifierTypeFlag_UsesPreview, /* copyData */ copyData, /* deformVerts */ NULL, |