add a utility function to get an exact match for a grease pencil frame.
This commit is contained in:
parent
a8e0011c96
commit
c96c63ad3a
|
@ -57,6 +57,7 @@ struct bGPdata *gpencil_data_duplicate(struct bGPdata *gpd);
|
|||
|
||||
void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf);
|
||||
|
||||
struct bGPDframe *BKE_gpencil_layer_find_frame(struct bGPDlayer *gpl, int cframe);
|
||||
struct bGPDframe *gpencil_layer_getframe(struct bGPDlayer *gpl, int cframe, short addnew);
|
||||
void gpencil_layer_delframe(struct bGPDlayer *gpl, struct bGPDframe *gpf);
|
||||
struct bGPDlayer *gpencil_layer_getactive(struct bGPdata *gpd);
|
||||
|
|
|
@ -321,6 +321,19 @@ void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
|
|||
|
||||
/* -------- GP-Layer API ---------- */
|
||||
|
||||
bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe)
|
||||
{
|
||||
bGPDframe *gpf;
|
||||
|
||||
for (gpf = gpl->frames.last; gpf; gpf = gpf->prev) {
|
||||
if (gpf->framenum == cframe) {
|
||||
return gpf;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* get the appropriate gp-frame from a given layer
|
||||
* - this sets the layer's actframe var (if allowed to)
|
||||
* - extension beyond range (if first gp-frame is after all frame in interest and cannot add)
|
||||
|
|
|
@ -181,14 +181,11 @@ void ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode)
|
|||
|
||||
if (gpl == NULL)
|
||||
return;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
gpf = BKE_gpencil_layer_find_frame(gpl, selx);
|
||||
|
||||
if (gpf) {
|
||||
gpframe_select(gpf, select_mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -179,13 +179,10 @@ void ED_mask_select_frame(MaskLayer *masklay, int selx, short select_mode)
|
|||
if (masklay == NULL)
|
||||
return;
|
||||
|
||||
/* search through frames for a match */
|
||||
for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) {
|
||||
/* there should only be one frame with this frame-number */
|
||||
if (masklay_shape->frame == selx) {
|
||||
masklayshape_select(masklay_shape, select_mode);
|
||||
break;
|
||||
}
|
||||
masklay_shape = BKE_mask_layer_shape_find_frame(masklay, selx);
|
||||
|
||||
if (masklay_shape) {
|
||||
masklayshape_select(masklay_shape, select_mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue