diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-06-19 07:53:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-19 07:53:43 +0400 |
commit | 22a961317a1c0405f41966205e22f70fb3769799 (patch) | |
tree | 63f43c2d2c4c9e3bfec53b9369f20462fd24495f /source | |
parent | b49e6d04ccb672029478d681133efae9842ba330 (diff) |
Fix T40546: Duplicate spline breaks shape keys
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 5e84d9e6916..a882284f5e3 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -2077,6 +2077,8 @@ static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) point++; } if (end >= start) { + int tot_point; + int tot_point_shape_start; MaskSpline *new_spline = BKE_mask_spline_add(mask_layer); MaskSplinePoint *new_point; int b; @@ -2100,15 +2102,29 @@ static int mask_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) memcpy(new_spline->points, spline->points + start, new_spline->tot_point * sizeof(MaskSplinePoint)); + tot_point = new_spline->tot_point; + + /* animation requires points added one by one */ + if (mask_layer->splines_shapes.first) { + new_spline->tot_point = 0; + tot_point_shape_start = BKE_mask_layer_shape_spline_to_index(mask_layer, new_spline); + } + /* Select points and duplicate their UWs (if needed). */ for (b = 0, new_point = new_spline->points; - b < new_spline->tot_point; + b < tot_point; b++, new_point++) { if (new_point->uw) { new_point->uw = MEM_dupallocN(new_point->uw); } BKE_mask_point_select_set(new_point, true); + + + if (mask_layer->splines_shapes.first) { + new_spline->tot_point++; + BKE_mask_layer_shape_changed_add(mask_layer, tot_point_shape_start + b, true, false); + } } /* Clear cyclic flag if we didn't copy the whole spline. */ |