diff options
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r-- | source/blender/editors/space_action/action_edit.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_select.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_action/space_action.c | 30 |
3 files changed, 44 insertions, 26 deletions
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index b390e4b56d6..aa784800be0 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -800,10 +800,17 @@ static void insert_gpencil_keys(bAnimContext *ac, short mode) add_frame_mode = GP_GETFRAME_ADD_NEW; } - /* insert gp frames */ + /* Insert gp frames. */ + bGPdata *gpd_old = NULL; for (ale = anim_data.first; ale; ale = ale->next) { + bGPdata *gpd = (bGPdata *)ale->id; bGPDlayer *gpl = (bGPDlayer *)ale->data; BKE_gpencil_layer_frame_get(gpl, CFRA, add_frame_mode); + /* Check if the gpd changes to tag only once. */ + if (gpd != gpd_old) { + BKE_gpencil_tag(gpd); + gpd_old = gpd; + } } ANIM_animdata_update(ac, &anim_data); @@ -839,6 +846,9 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op) } /* set notifier that keyframes have changed */ + if (ac.datatype == ANIMCONT_GPENCIL) { + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + } WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL); return OPERATOR_FINISHED; @@ -888,7 +898,7 @@ static void duplicate_action_keys(bAnimContext *ac) duplicate_fcurve_keys((FCurve *)ale->key_data); } else if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_duplicate((bGPDlayer *)ale->data); + ED_gpencil_layer_frames_duplicate((bGPDlayer *)ale->data); } else if (ale->type == ANIMTYPE_MASKLAYER) { ED_masklayer_frames_duplicate((MaskLayer *)ale->data); @@ -964,7 +974,7 @@ static bool delete_action_keys(bAnimContext *ac) bool changed = false; if (ale->type == ANIMTYPE_GPLAYER) { - changed = ED_gplayer_frames_delete((bGPDlayer *)ale->data); + changed = ED_gpencil_layer_frames_delete((bGPDlayer *)ale->data); } else if (ale->type == ANIMTYPE_MASKLAYER) { changed = ED_masklayer_frames_delete((MaskLayer *)ale->data); @@ -1539,7 +1549,7 @@ static void setkeytype_gpencil_keys(bAnimContext *ac, short mode) /* loop through each layer */ for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_keytype_set(ale->data, mode); + ED_gpencil_layer_frames_keytype_set(ale->data, mode); ale->update |= ANIM_UPDATE_DEPS; } } @@ -1740,7 +1750,7 @@ static void snap_action_keys(bAnimContext *ac, short mode) AnimData *adt = ANIM_nla_mapping_get(ac, ale); if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_snap_frames(ale->data, ac->scene, mode); + ED_gpencil_layer_snap_frames(ale->data, ac->scene, mode); } else if (ale->type == ANIMTYPE_MASKLAYER) { ED_masklayer_snap_frames(ale->data, ac->scene, mode); @@ -1870,7 +1880,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode) AnimData *adt = ANIM_nla_mapping_get(ac, ale); if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_mirror_frames(ale->data, ac->scene, mode); + ED_gpencil_layer_mirror_frames(ale->data, ac->scene, mode); } else if (ale->type == ANIMTYPE_MASKLAYER) { /* TODO */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index bbb68f632fb..f40b792269b 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -270,7 +270,7 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel) if (test) { for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - if (ED_gplayer_frame_select_check(ale->data)) { + if (ED_gpencil_layer_frame_select_check(ale->data)) { sel = SELECT_SUBTRACT; break; } @@ -296,7 +296,7 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel) /* Now set the flags */ for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frame_select_set(ale->data, sel); + ED_gpencil_layer_frame_select_set(ale->data, sel); ale->update |= ANIM_UPDATE_DEPS; } else if (ale->type == ANIMTYPE_MASKLAYER) { @@ -405,14 +405,14 @@ static void box_select_elem( bGPdata *gpd = ale->data; bGPDlayer *gpl; for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { - ED_gplayer_frames_select_box(gpl, xmin, xmax, data->selectmode); + ED_gpencil_layer_frames_select_box(gpl, xmin, xmax, data->selectmode); } ale->update |= ANIM_UPDATE_DEPS; break; } #endif case ANIMTYPE_GPLAYER: { - ED_gplayer_frames_select_box(ale->data, xmin, xmax, sel_data->selectmode); + ED_gpencil_layer_frames_select_box(ale->data, xmin, xmax, sel_data->selectmode); ale->update |= ANIM_UPDATE_DEPS; break; } @@ -641,13 +641,13 @@ static void region_select_elem(RegionSelectData *sel_data, bAnimListElem *ale, b bGPdata *gpd = ale->data; bGPDlayer *gpl; for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { - ED_gplayer_frames_select_region(&rdata->ked, ale->data, rdata->mode, rdata->selectmode); + ED_gpencil_layer_frames_select_region(&rdata->ked, ale->data, rdata->mode, rdata->selectmode); } break; } #endif case ANIMTYPE_GPLAYER: { - ED_gplayer_frames_select_region( + ED_gpencil_layer_frames_select_region( &sel_data->ked, ale->data, sel_data->mode, sel_data->selectmode); ale->update |= ANIM_UPDATE_DEPS; break; @@ -972,7 +972,7 @@ static void markers_selectkeys_between(bAnimContext *ac) ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_select_box(ale->data, min, max, SELECT_ADD); + ED_gpencil_layer_frames_select_box(ale->data, min, max, SELECT_ADD); ale->update |= ANIM_UPDATE_DEPS; } else if (ale->type == ANIMTYPE_MASKLAYER) { @@ -1008,7 +1008,7 @@ static void columnselect_action_keys(bAnimContext *ac, short mode) ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale = anim_data.first; ale; ale = ale->next) { - ED_gplayer_make_cfra_list(ale->data, &ked.list, 1); + ED_gpencil_layer_make_cfra_list(ale->data, &ked.list, 1); } } else { @@ -1385,7 +1385,7 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_select_box(ale->data, ked.f1, ked.f2, select_mode); + ED_gpencil_layer_frames_select_box(ale->data, ked.f1, ked.f2, select_mode); ale->update |= ANIM_UPDATE_DEPS; } else if (ale->type == ANIMTYPE_MASKLAYER) { diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index e92ea906237..079cee290ae 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -128,7 +128,7 @@ static SpaceLink *action_new(const ScrArea *area, const Scene *scene) region->v2d.minzoom = 0.01f; region->v2d.maxzoom = 50; region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES); - region->v2d.scroll |= (V2D_SCROLL_RIGHT); + region->v2d.scroll |= V2D_SCROLL_RIGHT; region->v2d.keepzoom = V2D_LOCKZOOM_Y; region->v2d.keepofs = V2D_KEEPOFS_Y; region->v2d.align = V2D_ALIGN_NO_POS_Y; @@ -181,10 +181,14 @@ static void action_main_region_draw(const bContext *C, ARegion *region) Object *obact = CTX_data_active_object(C); bAnimContext ac; View2D *v2d = ®ion->v2d; - View2DScrollers *scrollers; short marker_flag = 0; short cfra_flag = 0; + UI_view2d_view_ortho(v2d); + if (saction->flag & SACTION_DRAWTIME) { + cfra_flag |= DRAWCFRA_UNIT_SECONDS; + } + /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); GPU_clear(GPU_COLOR_BIT); @@ -204,12 +208,6 @@ static void action_main_region_draw(const bContext *C, ARegion *region) draw_channel_strips(&ac, saction, region); } - /* current frame */ - if (saction->flag & SACTION_DRAWTIME) { - cfra_flag |= DRAWCFRA_UNIT_SECONDS; - } - ANIM_draw_cfra(C, v2d, cfra_flag); - /* markers */ UI_view2d_view_orthoSpecial(region, v2d, 1); @@ -238,11 +236,20 @@ static void action_main_region_draw(const bContext *C, ARegion *region) /* scrubbing region */ ED_time_scrub_draw(region, scene, saction->flag & SACTION_DRAWTIME, true); +} + +static void action_main_region_draw_overlay(const bContext *C, ARegion *region) +{ + /* draw entirely, view changes should be handled here */ + const SpaceAction *saction = CTX_wm_space_action(C); + const Scene *scene = CTX_data_scene(C); + View2D *v2d = ®ion->v2d; + + /* scrubbing region */ + ED_time_scrub_draw_current_frame(region, scene, saction->flag & SACTION_DRAWTIME, true); /* scrollers */ - scrollers = UI_view2d_scrollers_calc(v2d, NULL); - UI_view2d_scrollers_draw(v2d, scrollers); - UI_view2d_scrollers_free(scrollers); + UI_view2d_scrollers_draw(v2d, NULL); } /* add handlers, stuff you only do once or on area/region changes */ @@ -874,6 +881,7 @@ void ED_spacetype_action(void) art->regionid = RGN_TYPE_WINDOW; art->init = action_main_region_init; art->draw = action_main_region_draw; + art->draw_overlay = action_main_region_draw_overlay; art->listener = action_main_region_listener; art->message_subscribe = saction_main_region_message_subscribe; art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES; |