diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-06-23 17:57:03 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-06-23 18:18:36 +0300 |
commit | 9466829eade042a45221b22b69575e1e3d5864a6 (patch) | |
tree | 810ec50843484cd14edd201a0daf4c0eaf6d62a0 /source/blender/editors/mask | |
parent | 833e69ff7ead32f20cce36f3a1dfe90f80020ea1 (diff) |
DopeSheet Mask Mode: Circle/Lasso support
Adapted from the code for Grease Pencil (just like the whole mode was)
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r-- | source/blender/editors/mask/mask_editaction.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index bcf9ee5c88d..16147bdc7f8 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -201,6 +201,36 @@ void ED_masklayer_frames_select_border(MaskLayer *masklay, float min, float max, } } +/* select the frames in this layer that occur within the lasso/circle region specified */ +void ED_masklayer_frames_select_region(KeyframeEditData *ked, MaskLayer *masklay, short tool, short select_mode) +{ + MaskLayerShape *masklay_shape; + + if (masklay == NULL) + return; + + /* only select frames which are within the region */ + for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) { + /* construct a dummy point coordinate to do this testing with */ + float pt[2] = {0}; + + pt[0] = masklay_shape->frame; + pt[1] = ked->channel_y; + + /* check the necessary regions */ + if (tool == BEZT_OK_CHANNEL_LASSO) { + /* Lasso */ + if (keyframe_region_lasso_test(ked->data, pt)) + masklayshape_select(masklay_shape, select_mode); + } + else if (tool == BEZT_OK_CHANNEL_CIRCLE) { + /* Circle */ + if (keyframe_region_circle_test(ked->data, pt)) + masklayshape_select(masklay_shape, select_mode); + } + } +} + /* ***************************************** */ /* Frame Editing Tools */ |