diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-05 11:01:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-05 11:01:43 +0400 |
commit | 0c59218a1d0f673d15dc61e68f018cc895e31fc9 (patch) | |
tree | bb300303e3542259202e9781c3adf26346f42c46 /source/blender | |
parent | a0f5e200cc9f83c4a276c0978e136d4d7c3193a9 (diff) |
mask switch direction now swaps handle direction too
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 9c2955e9118..b904b78ffdd 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -383,16 +383,27 @@ void BKE_mask_point_direction_switch(MaskSplinePoint *point) const int tot_uw_half = tot_uw / 2; int i; - if (tot_uw < 2) { - return; + float co_tmp[2]; + + /* swap handles */ + copy_v2_v2(co_tmp, point->bezt.vec[0]); + copy_v2_v2(point->bezt.vec[0], point->bezt.vec[2]); + copy_v2_v2(point->bezt.vec[2], co_tmp); + /* in this case the flags are unlikely to be different but swap anyway */ + SWAP(char, point->bezt.f1, point->bezt.f3); + SWAP(char, point->bezt.h1, point->bezt.h2); + + + /* swap UW's */ + if (tot_uw > 1) { + /* count */ + for (i = 0; i < tot_uw_half; i++) { + MaskSplinePointUW *uw_a = &point->uw[i]; + MaskSplinePointUW *uw_b = &point->uw[tot_uw - (i + 1)]; + SWAP(MaskSplinePointUW, *uw_a, *uw_b); + } } - /* count */ - for (i = 0; i < tot_uw_half; i++) { - MaskSplinePointUW *uw_a = &point->uw[i]; - MaskSplinePointUW *uw_b = &point->uw[tot_uw - (i + 1)]; - SWAP(MaskSplinePointUW, *uw_a, *uw_b); - } for (i = 0; i < tot_uw; i++) { MaskSplinePointUW *uw = &point->uw[i]; uw->u = 1.0f - uw->u; |