/* select the frames in this layer that occur within the lasso/circle region specified */ void ED_gplayer_frames_select_region(KeyframeEditData *ked, bGPDlayer *gpl, short tool, short select_mode) { bGPDframe *gpf; if (gpl == NULL) return; /* only select frames which are within the region */ for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { /* construct a dummy point coordinate to do this testing with */ float pt[2] = {0}; pt[0] = gpf->framenum; pt[1] = ked->channel_y; /* check the necessary regions */ if (tool == BEZT_OK_CHANNEL_LASSO) { /* Lasso */ if (keyframe_region_lasso_test(ked->data, pt)) gpframe_select(gpf, select_mode); } else if (tool == BEZT_OK_CHANNEL_CIRCLE) { /* Circle */ if (keyframe_region_circle_test(ked->data, pt)) gpframe_select(gpf, select_mode); } } }
/* select the frames in this layer that occur within the bounds specified */ void borderselect_gplayer_frames (bGPDlayer *gpl, float min, float max, short select_mode) { bGPDframe *gpf; /* only select those frames which are in bounds */ for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { if (IN_RANGE(gpf->framenum, min, max)) gpframe_select(gpf, select_mode); } }
/* select the frame in this layer that occurs on this frame (there should only be one at most) */ void ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode) { bGPDframe *gpf; if (gpl == NULL) return; gpf = BKE_gpencil_layer_find_frame(gpl, selx); if (gpf) { gpframe_select(gpf, select_mode); } }
/* set all/none/invert select (like above, but with SELECT_* modes) */ void ED_gpencil_select_frames(bGPDlayer *gpl, short select_mode) { bGPDframe *gpf; /* error checking */ if (gpl == NULL) return; /* handle according to mode */ for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { gpframe_select(gpf, select_mode); } }
/* select the frame in this layer that occurs on this frame (there should only be one at most) */ void select_gpencil_frame (bGPDlayer *gpl, int selx, short select_mode) { bGPDframe *gpf; /* search through frames for a match */ for (gpf= gpl->frames.first; gpf; gpf= gpf->next) { /* there should only be one frame with this frame-number */ if (gpf->framenum == selx) { gpframe_select(gpf, select_mode); break; } } }