Commit: 9466829eade042a45221b22b69575e1e3d5864a6
Author: Joshua Leung
Date:   Fri Jun 24 02:57:03 2016 +1200
Branches: master
https://developer.blender.org/rB9466829eade042a45221b22b69575e1e3d5864a6

DopeSheet Mask Mode: Circle/Lasso support

Adapted from the code for Grease Pencil (just like the whole mode was)

===================================================================

M       source/blender/editors/include/ED_mask.h
M       source/blender/editors/mask/mask_editaction.c
M       source/blender/editors/space_action/action_select.c

===================================================================

diff --git a/source/blender/editors/include/ED_mask.h 
b/source/blender/editors/include/ED_mask.h
index 1f13b46..2ab788d 100644
--- a/source/blender/editors/include/ED_mask.h
+++ b/source/blender/editors/include/ED_mask.h
@@ -35,6 +35,7 @@ struct bContext;
 struct wmKeyConfig;
 struct MaskLayer;
 struct MaskLayerShape;
+struct KeyframeEditData;
 
 /* mask_edit.c */
 void ED_mask_get_size(struct ScrArea *sa, int *width, int *height);
@@ -80,6 +81,7 @@ void ED_masklayer_make_cfra_list(struct MaskLayer *masklay, 
ListBase *elems, boo
 bool  ED_masklayer_frame_select_check(struct MaskLayer *masklay);
 void  ED_masklayer_frame_select_set(struct MaskLayer *masklay, short mode);
 void  ED_masklayer_frames_select_border(struct MaskLayer *masklay, float min, 
float max, short select_mode);
+void  ED_masklayer_frames_select_region(struct KeyframeEditData *ked, struct 
MaskLayer *masklay, short tool, short select_mode);
 void  ED_mask_select_frames(struct MaskLayer *masklay, short select_mode);
 void  ED_mask_select_frame(struct MaskLayer *masklay, int selx, short 
select_mode);
 
diff --git a/source/blender/editors/mask/mask_editaction.c 
b/source/blender/editors/mask/mask_editaction.c
index bcf9ee5..16147bd 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 */
 
diff --git a/source/blender/editors/space_action/action_select.c 
b/source/blender/editors/space_action/action_select.c
index 62050f1..0b6d3cb 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -482,13 +482,13 @@ static void region_select_action_keys(bAnimContext *ac, 
const rctf *rectf_view,
                                        Mask *mask = ale->data;
                                        MaskLayer *masklay;
                                        for (masklay = mask->masklayers.first; 
masklay; masklay = masklay->next) {
-                                               
//ED_masklayer_frames_select_border(masklay, rectf.xmin, rectf.xmax, 
selectmode);
+                                               
ED_masklayer_frames_select_region(&ked, masklay, mode, selectmode);
                                        }
                                        break;
                                }
                                case ANIMTYPE_MASKLAYER:
                                {
-                                       
//ED_masklayer_frames_select_border(ale->data, rectf.xmin, rectf.xmax, 
selectmode);
+                                       ED_masklayer_frames_select_region(&ked, 
ale->data, mode, selectmode);
                                        break;
                                }
                                default:

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to