Cleanup: use swap math funcs

This commit is contained in:
Campbell Barton
2015-07-01 16:02:30 +10:00
parent 45b2218341
commit 1779452eb4
3 changed files with 5 additions and 12 deletions

View File

@@ -986,15 +986,12 @@ void sort_time_fcurve(FCurve *fcu)
/* if either one of both of the points exceeds crosses over the keyframe time... */
if ( (bezt->vec[0][0] > bezt->vec[1][0]) && (bezt->vec[2][0] < bezt->vec[1][0]) ) {
/* swap handles if they have switched sides for some reason */
SWAP(float, bezt->vec[0][0], bezt->vec[2][0]);
SWAP(float, bezt->vec[0][1], bezt->vec[2][1]);
swap_v2_v2(bezt->vec[0], bezt->vec[2]);
}
else {
/* clamp handles */
if (bezt->vec[0][0] > bezt->vec[1][0])
bezt->vec[0][0] = bezt->vec[1][0];
if (bezt->vec[2][0] < bezt->vec[1][0])
bezt->vec[2][0] = bezt->vec[1][0];
CLAMP_MAX(bezt->vec[0][0], bezt->vec[1][0]);
CLAMP_MIN(bezt->vec[2][0], bezt->vec[1][0]);
}
}
}

View File

@@ -988,9 +988,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
/* only if selected and editable */
if (EBONE_VISIBLE(arm, ebo) && EBONE_EDITABLE(ebo)) {
/* swap head and tail coordinates */
SWAP(float, ebo->head[0], ebo->tail[0]);
SWAP(float, ebo->head[1], ebo->tail[1]);
SWAP(float, ebo->head[2], ebo->tail[2]);
swap_v3_v3(ebo->head, ebo->tail);
/* do parent swapping:
* - use 'child' as new parent

View File

@@ -474,9 +474,7 @@ static void occ_build_split(OcclusionTree *tree, int begin, int end, int *split)
if (tree->co[a][axis] > mid) {
enda--;
SWAP(OccFace, tree->face[a], tree->face[enda]);
SWAP(float, tree->co[a][0], tree->co[enda][0]);
SWAP(float, tree->co[a][1], tree->co[enda][1]);
SWAP(float, tree->co[a][2], tree->co[enda][2]);
swap_v3_v3(tree->co[a], tree->co[enda]);
}
else
a++;