diff options
Diffstat (limited to 'source/blender/editors/space_clip/space_clip.c')
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 367 |
1 files changed, 184 insertions, 183 deletions
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index a0ac832522d..3256ee3eb73 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -73,101 +73,101 @@ static void init_preview_region(const Scene *scene, const ScrArea *sa, const SpaceClip *sc, - ARegion *ar) + ARegion *region) { - ar->regiontype = RGN_TYPE_PREVIEW; - ar->alignment = RGN_ALIGN_TOP; - ar->flag |= RGN_FLAG_HIDDEN; + region->regiontype = RGN_TYPE_PREVIEW; + region->alignment = RGN_ALIGN_TOP; + region->flag |= RGN_FLAG_HIDDEN; if (sc->view == SC_VIEW_DOPESHEET) { - ar->v2d.tot.xmin = -10.0f; - ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; - ar->v2d.tot.xmax = (float)(sa->winx); - ar->v2d.tot.ymax = 0.0f; - - ar->v2d.cur = ar->v2d.tot; - - ar->v2d.min[0] = 0.0f; - ar->v2d.min[1] = 0.0f; - - ar->v2d.max[0] = MAXFRAMEF; - ar->v2d.max[1] = FLT_MAX; - - ar->v2d.minzoom = 0.01f; - ar->v2d.maxzoom = 50; - ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES); - ar->v2d.scroll |= (V2D_SCROLL_RIGHT); - ar->v2d.keepzoom = V2D_LOCKZOOM_Y; - ar->v2d.keepofs = V2D_KEEPOFS_Y; - ar->v2d.align = V2D_ALIGN_NO_POS_Y; - ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; + region->v2d.tot.xmin = -10.0f; + region->v2d.tot.ymin = (float)(-sa->winy) / 3.0f; + region->v2d.tot.xmax = (float)(sa->winx); + region->v2d.tot.ymax = 0.0f; + + region->v2d.cur = region->v2d.tot; + + region->v2d.min[0] = 0.0f; + region->v2d.min[1] = 0.0f; + + region->v2d.max[0] = MAXFRAMEF; + region->v2d.max[1] = FLT_MAX; + + 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.keepzoom = V2D_LOCKZOOM_Y; + region->v2d.keepofs = V2D_KEEPOFS_Y; + region->v2d.align = V2D_ALIGN_NO_POS_Y; + region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; } else { - ar->v2d.tot.xmin = 0.0f; - ar->v2d.tot.ymin = -10.0f; - ar->v2d.tot.xmax = (float)scene->r.efra; - ar->v2d.tot.ymax = 10.0f; + region->v2d.tot.xmin = 0.0f; + region->v2d.tot.ymin = -10.0f; + region->v2d.tot.xmax = (float)scene->r.efra; + region->v2d.tot.ymax = 10.0f; - ar->v2d.cur = ar->v2d.tot; + region->v2d.cur = region->v2d.tot; - ar->v2d.min[0] = FLT_MIN; - ar->v2d.min[1] = FLT_MIN; + region->v2d.min[0] = FLT_MIN; + region->v2d.min[1] = FLT_MIN; - ar->v2d.max[0] = MAXFRAMEF; - ar->v2d.max[1] = FLT_MAX; + region->v2d.max[0] = MAXFRAMEF; + region->v2d.max[1] = FLT_MAX; - ar->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES); - ar->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES); + region->v2d.scroll = (V2D_SCROLL_BOTTOM | V2D_SCROLL_HORIZONTAL_HANDLES); + region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HANDLES); - ar->v2d.minzoom = 0.0f; - ar->v2d.maxzoom = 0.0f; - ar->v2d.keepzoom = 0; - ar->v2d.keepofs = 0; - ar->v2d.align = 0; - ar->v2d.flag = 0; + region->v2d.minzoom = 0.0f; + region->v2d.maxzoom = 0.0f; + region->v2d.keepzoom = 0; + region->v2d.keepofs = 0; + region->v2d.align = 0; + region->v2d.flag = 0; - ar->v2d.keeptot = 0; + region->v2d.keeptot = 0; } } -static void reinit_preview_region(const bContext *C, ARegion *ar) +static void reinit_preview_region(const bContext *C, ARegion *region) { Scene *scene = CTX_data_scene(C); ScrArea *sa = CTX_wm_area(C); SpaceClip *sc = CTX_wm_space_clip(C); if (sc->view == SC_VIEW_DOPESHEET) { - if ((ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) == 0) { - init_preview_region(scene, sa, sc, ar); + if ((region->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) == 0) { + init_preview_region(scene, sa, sc, region); } } else { - if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) { - init_preview_region(scene, sa, sc, ar); + if (region->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) { + init_preview_region(scene, sa, sc, region); } } } static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa) { - ARegion *ar, *arnew; + ARegion *region, *arnew; - ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); - if (ar) { - return ar; + region = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); + if (region) { + return region; } /* add subdiv level; after header */ - ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + region = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); /* is error! */ - if (ar == NULL) { + if (region == NULL) { return NULL; } arnew = MEM_callocN(sizeof(ARegion), "clip preview region"); - BLI_insertlinkbefore(&sa->regionbase, ar, arnew); + BLI_insertlinkbefore(&sa->regionbase, region, arnew); init_preview_region(CTX_data_scene(C), sa, CTX_wm_space_clip(C), arnew); return arnew; @@ -175,24 +175,24 @@ static ARegion *ED_clip_has_preview_region(const bContext *C, ScrArea *sa) static ARegion *ED_clip_has_channels_region(ScrArea *sa) { - ARegion *ar, *arnew; + ARegion *region, *arnew; - ar = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS); - if (ar) { - return ar; + region = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS); + if (region) { + return region; } /* add subdiv level; after header */ - ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); + region = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW); /* is error! */ - if (ar == NULL) { + if (region == NULL) { return NULL; } arnew = MEM_callocN(sizeof(ARegion), "clip channels region"); - BLI_insertlinkbefore(&sa->regionbase, ar, arnew); + BLI_insertlinkbefore(&sa->regionbase, region, arnew); arnew->regiontype = RGN_TYPE_CHANNELS; arnew->alignment = RGN_ALIGN_LEFT; @@ -205,15 +205,15 @@ static ARegion *ED_clip_has_channels_region(ScrArea *sa) static void clip_scopes_tag_refresh(ScrArea *sa) { SpaceClip *sc = (SpaceClip *)sa->spacedata.first; - ARegion *ar; + ARegion *region; if (sc->mode != SC_MODE_TRACKING) { return; } /* only while properties are visible */ - for (ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_UI && ar->flag & RGN_FLAG_HIDDEN) { + for (region = sa->regionbase.first; region; region = region->next) { + if (region->regiontype == RGN_TYPE_UI && region->flag & RGN_FLAG_HIDDEN) { return; } } @@ -240,7 +240,7 @@ static void clip_area_sync_frame_from_scene(ScrArea *sa, Scene *scene) static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene) { - ARegion *ar; + ARegion *region; SpaceClip *sc; sc = MEM_callocN(sizeof(SpaceClip), "initclip"); @@ -253,47 +253,47 @@ static SpaceLink *clip_new(const ScrArea *sa, const Scene *scene) sc->around = V3D_AROUND_CENTER_MEDIAN; /* header */ - ar = MEM_callocN(sizeof(ARegion), "header for clip"); + region = MEM_callocN(sizeof(ARegion), "header for clip"); - BLI_addtail(&sc->regionbase, ar); - ar->regiontype = RGN_TYPE_HEADER; - ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + BLI_addtail(&sc->regionbase, region); + region->regiontype = RGN_TYPE_HEADER; + region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* tools view */ - ar = MEM_callocN(sizeof(ARegion), "tools for clip"); + region = MEM_callocN(sizeof(ARegion), "tools for clip"); - BLI_addtail(&sc->regionbase, ar); - ar->regiontype = RGN_TYPE_TOOLS; - ar->alignment = RGN_ALIGN_LEFT; + BLI_addtail(&sc->regionbase, region); + region->regiontype = RGN_TYPE_TOOLS; + region->alignment = RGN_ALIGN_LEFT; /* properties view */ - ar = MEM_callocN(sizeof(ARegion), "properties for clip"); + region = MEM_callocN(sizeof(ARegion), "properties for clip"); - BLI_addtail(&sc->regionbase, ar); - ar->regiontype = RGN_TYPE_UI; - ar->alignment = RGN_ALIGN_RIGHT; + BLI_addtail(&sc->regionbase, region); + region->regiontype = RGN_TYPE_UI; + region->alignment = RGN_ALIGN_RIGHT; /* channels view */ - ar = MEM_callocN(sizeof(ARegion), "channels for clip"); + region = MEM_callocN(sizeof(ARegion), "channels for clip"); - BLI_addtail(&sc->regionbase, ar); - ar->regiontype = RGN_TYPE_CHANNELS; - ar->alignment = RGN_ALIGN_LEFT; + BLI_addtail(&sc->regionbase, region); + region->regiontype = RGN_TYPE_CHANNELS; + region->alignment = RGN_ALIGN_LEFT; - ar->v2d.scroll = V2D_SCROLL_BOTTOM; - ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; + region->v2d.scroll = V2D_SCROLL_BOTTOM; + region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL; /* preview view */ - ar = MEM_callocN(sizeof(ARegion), "preview for clip"); + region = MEM_callocN(sizeof(ARegion), "preview for clip"); - BLI_addtail(&sc->regionbase, ar); - init_preview_region(scene, sa, sc, ar); + BLI_addtail(&sc->regionbase, region); + init_preview_region(scene, sa, sc, region); /* main region */ - ar = MEM_callocN(sizeof(ARegion), "main region for clip"); + region = MEM_callocN(sizeof(ARegion), "main region for clip"); - BLI_addtail(&sc->regionbase, ar); - ar->regiontype = RGN_TYPE_WINDOW; + BLI_addtail(&sc->regionbase, region); + region->regiontype = RGN_TYPE_WINDOW; return (SpaceLink *)sc; } @@ -828,7 +828,7 @@ static void clip_gizmos(void) /********************* main region ********************/ /* sets up the fields of the View2D from zoom and offset */ -static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar) +static void movieclip_main_area_set_view2d(const bContext *C, ARegion *region) { SpaceClip *sc = CTX_wm_space_clip(C); float x1, y1, w, h, aspx, aspy; @@ -840,60 +840,60 @@ static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar) w = width * aspx; h = height * aspy; - winx = BLI_rcti_size_x(&ar->winrct) + 1; - winy = BLI_rcti_size_y(&ar->winrct) + 1; + winx = BLI_rcti_size_x(®ion->winrct) + 1; + winy = BLI_rcti_size_y(®ion->winrct) + 1; - ar->v2d.tot.xmin = 0; - ar->v2d.tot.ymin = 0; - ar->v2d.tot.xmax = w; - ar->v2d.tot.ymax = h; + region->v2d.tot.xmin = 0; + region->v2d.tot.ymin = 0; + region->v2d.tot.xmax = w; + region->v2d.tot.ymax = h; - ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0; - ar->v2d.mask.xmax = winx; - ar->v2d.mask.ymax = winy; + region->v2d.mask.xmin = region->v2d.mask.ymin = 0; + region->v2d.mask.xmax = winx; + region->v2d.mask.ymax = winy; /* which part of the image space do we see? */ - x1 = ar->winrct.xmin + (winx - sc->zoom * w) / 2.0f; - y1 = ar->winrct.ymin + (winy - sc->zoom * h) / 2.0f; + x1 = region->winrct.xmin + (winx - sc->zoom * w) / 2.0f; + y1 = region->winrct.ymin + (winy - sc->zoom * h) / 2.0f; x1 -= sc->zoom * sc->xof; y1 -= sc->zoom * sc->yof; /* relative display right */ - ar->v2d.cur.xmin = (ar->winrct.xmin - (float)x1) / sc->zoom; - ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx / sc->zoom); + region->v2d.cur.xmin = (region->winrct.xmin - (float)x1) / sc->zoom; + region->v2d.cur.xmax = region->v2d.cur.xmin + ((float)winx / sc->zoom); /* relative display left */ - ar->v2d.cur.ymin = (ar->winrct.ymin - (float)y1) / sc->zoom; - ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy / sc->zoom); + region->v2d.cur.ymin = (region->winrct.ymin - (float)y1) / sc->zoom; + region->v2d.cur.ymax = region->v2d.cur.ymin + ((float)winy / sc->zoom); /* normalize 0.0..1.0 */ - ar->v2d.cur.xmin /= w; - ar->v2d.cur.xmax /= w; - ar->v2d.cur.ymin /= h; - ar->v2d.cur.ymax /= h; + region->v2d.cur.xmin /= w; + region->v2d.cur.xmax /= w; + region->v2d.cur.ymin /= h; + region->v2d.cur.ymax /= h; } /* add handlers, stuff you only do once or on area/region changes */ -static void clip_main_region_init(wmWindowManager *wm, ARegion *ar) +static void clip_main_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy); + UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_STANDARD, region->winx, region->winy); /* mask polls mode */ keymap = WM_keymap_ensure(wm->defaultconf, "Mask Editing", 0, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); /* own keymap */ keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); keymap = WM_keymap_ensure(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); } -static void clip_main_region_draw(const bContext *C, ARegion *ar) +static void clip_main_region_draw(const bContext *C, ARegion *region) { /* draw entirely, view changes should be handled here */ SpaceClip *sc = CTX_wm_space_clip(C); @@ -915,7 +915,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar) tmpibuf = ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL); } - if (ED_clip_view_selection(C, ar, 0)) { + if (ED_clip_view_selection(C, region, 0)) { sc->xof += sc->xlockof; sc->yof += sc->ylockof; } @@ -930,17 +930,17 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar) GPU_clear(GPU_COLOR_BIT); /* data... */ - movieclip_main_area_set_view2d(C, ar); + movieclip_main_area_set_view2d(C, region); /* callback */ - ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); + ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); - clip_draw_main(C, sc, ar); + clip_draw_main(C, sc, region); /* TODO(sergey): would be nice to find a way to de-duplicate all this space conversions */ - UI_view2d_view_to_region_fl(&ar->v2d, 0.0f, 0.0f, &x, &y); + UI_view2d_view_to_region_fl(®ion->v2d, 0.0f, 0.0f, &x, &y); ED_space_clip_get_size(sc, &width, &height); - ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy); + ED_space_clip_get_zoom(sc, region, &zoomx, &zoomy); ED_space_clip_get_aspect(sc, &aspx, &aspy); if (sc->mode == SC_MODE_MASKEDIT) { @@ -951,7 +951,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar) ED_mask_get_size(sa, &mask_width, &mask_height); ED_mask_draw_region(CTX_data_expect_evaluated_depsgraph(C), mask, - ar, + region, sc->mask_info.draw_flag, sc->mask_info.draw_type, sc->mask_info.overlay_mode, @@ -975,11 +975,11 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar) GPU_matrix_scale_2f(zoomx, zoomy); GPU_matrix_mul(sc->stabmat); GPU_matrix_scale_2f(width, height); - ED_image_draw_cursor(ar, sc->cursor); + ED_image_draw_cursor(region, sc->cursor); GPU_matrix_pop(); } - clip_draw_cache_and_notes(C, sc, ar); + clip_draw_cache_and_notes(C, sc, region); if (sc->flag & SC_SHOW_ANNOTATION) { /* Grease Pencil */ @@ -987,7 +987,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar) } /* callback */ - ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); + ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); /* reset view matrix */ UI_view2d_view_restore(C); @@ -997,12 +997,12 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar) clip_draw_grease_pencil((bContext *)C, false); } - WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D); + WM_gizmomap_draw(region->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D); } static void clip_main_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { @@ -1010,10 +1010,10 @@ static void clip_main_region_listener(wmWindow *UNUSED(win), switch (wmn->category) { case NC_GPENCIL: if (wmn->action == NA_EDITED) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } else if (wmn->data & ND_GPENCIL_EDITMODE) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } @@ -1021,37 +1021,37 @@ static void clip_main_region_listener(wmWindow *UNUSED(win), /****************** preview region ******************/ -static void clip_preview_region_init(wmWindowManager *wm, ARegion *ar) +static void clip_preview_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy); + UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_CUSTOM, region->winx, region->winy); /* own keymap */ keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); keymap = WM_keymap_ensure(wm->defaultconf, "Clip Time Scrub", SPACE_CLIP, RGN_TYPE_PREVIEW); - WM_event_add_keymap_handler_poll(&ar->handlers, keymap, ED_time_scrub_event_in_region); + WM_event_add_keymap_handler_poll(®ion->handlers, keymap, ED_time_scrub_event_in_region); keymap = WM_keymap_ensure(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); keymap = WM_keymap_ensure(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); } -static void graph_region_draw(const bContext *C, ARegion *ar) +static void graph_region_draw(const bContext *C, ARegion *region) { - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; View2DScrollers *scrollers; SpaceClip *sc = CTX_wm_space_clip(C); Scene *scene = CTX_data_scene(C); short cfra_flag = 0; if (sc->flag & SC_LOCK_TIMECURSOR) { - ED_clip_graph_center_current_frame(scene, ar); + ED_clip_graph_center_current_frame(scene, region); } /* clear and setup matrix */ @@ -1061,7 +1061,7 @@ static void graph_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(v2d); /* data... */ - clip_draw_graph(sc, ar, scene); + clip_draw_graph(sc, region, scene); /* current frame indicator line */ if (sc->flag & SC_SHOW_SECONDS) { @@ -1073,7 +1073,7 @@ static void graph_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* time-scrubbing */ - ED_time_scrub_draw(ar, scene, sc->flag & SC_SHOW_SECONDS, true); + ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true); /* scrollers */ scrollers = UI_view2d_scrollers_calc(v2d, NULL); @@ -1083,17 +1083,18 @@ static void graph_region_draw(const bContext *C, ARegion *ar) /* scale indicators */ { rcti rect; - BLI_rcti_init(&rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, ar->winy - UI_TIME_SCRUB_MARGIN_Y); - UI_view2d_draw_scale_y__values(ar, v2d, &rect, TH_TEXT); + BLI_rcti_init( + &rect, 0, 15 * UI_DPI_FAC, 15 * UI_DPI_FAC, region->winy - UI_TIME_SCRUB_MARGIN_Y); + UI_view2d_draw_scale_y__values(region, v2d, &rect, TH_TEXT); } } -static void dopesheet_region_draw(const bContext *C, ARegion *ar) +static void dopesheet_region_draw(const bContext *C, ARegion *region) { Scene *scene = CTX_data_scene(C); SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; View2DScrollers *scrollers; short cfra_flag = 0; @@ -1111,7 +1112,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar) UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, sc->flag & SC_SHOW_SECONDS); /* data... */ - clip_draw_dopesheet_main(sc, ar, scene); + clip_draw_dopesheet_main(sc, region, scene); /* current frame indicator line */ if (sc->flag & SC_SHOW_SECONDS) { @@ -1123,7 +1124,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_restore(C); /* time-scrubbing */ - ED_time_scrub_draw(ar, scene, sc->flag & SC_SHOW_SECONDS, true); + ED_time_scrub_draw(region, scene, sc->flag & SC_SHOW_SECONDS, true); /* scrollers */ scrollers = UI_view2d_scrollers_calc(v2d, NULL); @@ -1131,21 +1132,21 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar) UI_view2d_scrollers_free(scrollers); } -static void clip_preview_region_draw(const bContext *C, ARegion *ar) +static void clip_preview_region_draw(const bContext *C, ARegion *region) { SpaceClip *sc = CTX_wm_space_clip(C); if (sc->view == SC_VIEW_GRAPH) { - graph_region_draw(C, ar); + graph_region_draw(C, region); } else if (sc->view == SC_VIEW_DOPESHEET) { - dopesheet_region_draw(C, ar); + dopesheet_region_draw(C, region); } } static void clip_preview_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *UNUSED(ar), + ARegion *UNUSED(region), wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene)) { @@ -1153,24 +1154,24 @@ static void clip_preview_region_listener(wmWindow *UNUSED(win), /****************** channels region ******************/ -static void clip_channels_region_init(wmWindowManager *wm, ARegion *ar) +static void clip_channels_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; /* ensure the 2d view sync works - main region has bottom scroller */ - ar->v2d.scroll = V2D_SCROLL_BOTTOM; + region->v2d.scroll = V2D_SCROLL_BOTTOM; - UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy); + UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy); keymap = WM_keymap_ensure(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0); - WM_event_add_keymap_handler_v2d_mask(&ar->handlers, keymap); + WM_event_add_keymap_handler_v2d_mask(®ion->handlers, keymap); } -static void clip_channels_region_draw(const bContext *C, ARegion *ar) +static void clip_channels_region_draw(const bContext *C, ARegion *region) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip_get_clip(sc); - View2D *v2d = &ar->v2d; + View2D *v2d = ®ion->v2d; if (clip) { BKE_tracking_dopesheet_update(&clip->tracking); @@ -1183,7 +1184,7 @@ static void clip_channels_region_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(v2d); /* data... */ - clip_draw_dopesheet_channels(C, ar); + clip_draw_dopesheet_channels(C, region); /* reset view matrix */ UI_view2d_view_restore(C); @@ -1191,7 +1192,7 @@ static void clip_channels_region_draw(const bContext *C, ARegion *ar) static void clip_channels_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *UNUSED(ar), + ARegion *UNUSED(region), wmNotifier *UNUSED(wmn), const Scene *UNUSED(scene)) { @@ -1200,19 +1201,19 @@ static void clip_channels_region_listener(wmWindow *UNUSED(win), /****************** header region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void clip_header_region_init(wmWindowManager *UNUSED(wm), ARegion *ar) +static void clip_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) { - ED_region_header_init(ar); + ED_region_header_init(region); } -static void clip_header_region_draw(const bContext *C, ARegion *ar) +static void clip_header_region_draw(const bContext *C, ARegion *region) { - ED_region_header(C, ar); + ED_region_header(C, region); } static void clip_header_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { @@ -1225,7 +1226,7 @@ static void clip_header_region_listener(wmWindow *UNUSED(win), /* TODO - should do this when in mask mode only but no data available */ // if (sc->mode == SC_MODE_MASKEDIT) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); break; } } @@ -1236,26 +1237,26 @@ static void clip_header_region_listener(wmWindow *UNUSED(win), /****************** tools region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void clip_tools_region_init(wmWindowManager *wm, ARegion *ar) +static void clip_tools_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; - ED_region_panels_init(wm, ar); + ED_region_panels_init(wm, region); keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); + WM_event_add_keymap_handler(®ion->handlers, keymap); } -static void clip_tools_region_draw(const bContext *C, ARegion *ar) +static void clip_tools_region_draw(const bContext *C, ARegion *region) { - ED_region_panels(C, ar); + ED_region_panels(C, region); } /****************** tool properties region ******************/ static void clip_props_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { @@ -1263,22 +1264,22 @@ static void clip_props_region_listener(wmWindow *UNUSED(win), switch (wmn->category) { case NC_WM: if (wmn->data == ND_HISTORY) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_SCENE: if (wmn->data == ND_MODE) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_SPACE: if (wmn->data == ND_SPACE_CLIP) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_GPENCIL: if (wmn->action == NA_EDITED) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } @@ -1287,28 +1288,28 @@ static void clip_props_region_listener(wmWindow *UNUSED(win), /****************** properties region ******************/ /* add handlers, stuff you only do once or on area/region changes */ -static void clip_properties_region_init(wmWindowManager *wm, ARegion *ar) +static void clip_properties_region_init(wmWindowManager *wm, ARegion *region) { wmKeyMap *keymap; - ED_region_panels_init(wm, ar); + ED_region_panels_init(wm, region); keymap = WM_keymap_ensure(wm->defaultconf, "Clip", SPACE_CLIP, 0); - WM_event_add_keymap_handler(&ar->handlers, keymap); + WM_event_add_keymap_handler(®ion->handlers, keymap); } -static void clip_properties_region_draw(const bContext *C, ARegion *ar) +static void clip_properties_region_draw(const bContext *C, ARegion *region) { SpaceClip *sc = CTX_wm_space_clip(C); BKE_movieclip_update_scopes(sc->clip, &sc->user, &sc->scopes); - ED_region_panels(C, ar); + ED_region_panels(C, region); } static void clip_properties_region_listener(wmWindow *UNUSED(win), ScrArea *UNUSED(sa), - ARegion *ar, + ARegion *region, wmNotifier *wmn, const Scene *UNUSED(scene)) { @@ -1316,12 +1317,12 @@ static void clip_properties_region_listener(wmWindow *UNUSED(win), switch (wmn->category) { case NC_GPENCIL: if (ELEM(wmn->data, ND_DATA, ND_GPENCIL_EDITMODE)) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; case NC_BRUSH: if (wmn->action == NA_EDITED) { - ED_region_tag_redraw(ar); + ED_region_tag_redraw(region); } break; } |