From c96c63ad3afe66e04d7a2f7c351abbc53242f03a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 8 Jun 2012 22:07:57 +0000 Subject: add a utility function to get an exact match for a grease pencil frame. --- source/blender/editors/gpencil/editaction_gpencil.c | 13 +++++-------- source/blender/editors/mask/mask_editaction.c | 11 ++++------- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 262ae13ece3..a7beaa74eb7 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -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); } } diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index a629883a446..3836b393bf8 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -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); } } -- cgit v1.2.3