diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-07 11:28:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-07 11:28:55 +0400 |
commit | e261d5ca3b57b5e2f1e58ce84fd1dc9290978101 (patch) | |
tree | 421ed74398cad5dc5f8e6d978d1b9b49671e3a3f /source | |
parent | ffd75901f32e2270406e43855c7b2dee065f948e (diff) |
improvement to handle recalculation, only do this on auto-handles when they are in a spline.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 29 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_mask_types.h | 7 |
2 files changed, 20 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index f7679d473b9..0a6063a6b21 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1399,14 +1399,6 @@ void BKE_mask_calc_handles(Mask *mask) } } -void BKE_mask_calc_handles_deform(Mask *mask) -{ - MaskLayer *masklay; - for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { - BKE_mask_layer_calc_handles_deform(masklay); - } -} - void BKE_mask_update_deform(Mask *mask) { MaskLayer *masklay; @@ -1516,9 +1508,10 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe) for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { MaskSpline *spline; - int i; for (spline = masklay->splines.first; spline; spline = spline->next) { + int i; + int has_auto = FALSE; BKE_mask_spline_ensure_deform(spline); @@ -1537,12 +1530,24 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe) add_v2_v2(point_deform->bezt.vec[1], delta); add_v2_v2(point_deform->bezt.vec[2], delta); } + + if (point->bezt.h1 == HD_AUTO) { + has_auto = TRUE; + } + } + + /* if the spline has auto handles, these need to be recalculated after deformation */ + if (has_auto) { + for (i = 0; i < spline->tot_point; i++) { + MaskSplinePoint *point_deform = &spline->points_deform[i]; + if (point_deform->bezt.h1 == HD_AUTO) { + BKE_mask_calc_handle_point(spline, point_deform); + } + } } + /* end extra calc handles loop */ } } - - /* TODO, move into loop above and only run if there are auto-handles */ - BKE_mask_calc_handles_deform(mask); } /* the purpose of this function is to ensure spline->points_deform is never out of date. diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h index c036369c692..23f33729f69 100644 --- a/source/blender/makesdna/DNA_mask_types.h +++ b/source/blender/makesdna/DNA_mask_types.h @@ -43,9 +43,9 @@ typedef struct Mask { ID id; struct AnimData *adt; - ListBase masklayers; /* mask layers */ - int masklay_act; /* index of active mask layer (-1 == None) */ - int masklay_tot; /* total number of mask layers */ + ListBase masklayers; /* mask layers */ + int masklay_act; /* index of active mask layer (-1 == None) */ + int masklay_tot; /* total number of mask layers */ } Mask; typedef struct MaskParent { @@ -166,5 +166,4 @@ enum { MASK_BLENDFLAG_INVERT = (1 << 0) }; - #endif // __DNA_MASK_TYPES_H__ |