Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_nla/space_nla.c
| Show All 36 Lines | |||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "BLO_read_write.h" | #include "BLO_read_write.h" | ||||
| #include "nla_intern.h" /* own include */ | #include "nla_intern.h" /* own include */ | ||||
| /* ******************** default callbacks for nla space ***************** */ | /* ******************** default callbacks for nla space ***************** */ | ||||
| static SpaceLink *nla_create(const ScrArea *area, const Scene *scene) | static SpaceLink *nla_create(const wmWindow *win, const ScrArea *area) | ||||
| { | { | ||||
| const Scene *scene = WM_window_get_active_scene(win); | |||||
| ARegion *region; | ARegion *region; | ||||
| SpaceNla *snla; | SpaceNla *snla; | ||||
| snla = MEM_callocN(sizeof(SpaceNla), "initnla"); | snla = MEM_callocN(sizeof(SpaceNla), "initnla"); | ||||
| snla->spacetype = SPACE_NLA; | snla->spacetype = SPACE_NLA; | ||||
| /* allocate DopeSheet data for NLA Editor */ | /* allocate DopeSheet data for NLA Editor */ | ||||
| snla->ads = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet"); | snla->ads = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet"); | ||||
| ▲ Show 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | static void nla_main_region_draw(const bContext *C, ARegion *region) | ||||
| View2D *v2d = ®ion->v2d; | View2D *v2d = ®ion->v2d; | ||||
| /* clear and setup matrix */ | /* clear and setup matrix */ | ||||
| UI_ThemeClearColor(TH_BACK); | UI_ThemeClearColor(TH_BACK); | ||||
| UI_view2d_view_ortho(v2d); | UI_view2d_view_ortho(v2d); | ||||
| /* time grid */ | /* time grid */ | ||||
| UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, snla->flag & SNLA_DRAWTIME, true); | UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, FPS, snla->flag & SNLA_DRAWTIME, true); | ||||
| ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); | ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); | ||||
| /* start and end frame */ | /* start and end frame */ | ||||
| ANIM_draw_framerange(scene, v2d); | ANIM_draw_framerange(scene, v2d); | ||||
| /* data */ | /* data */ | ||||
| if (ANIM_animdata_get_context(C, &ac)) { | if (ANIM_animdata_get_context(C, &ac)) { | ||||
| Show All 17 Lines | static void nla_main_region_draw(const bContext *C, ARegion *region) | ||||
| /* callback */ | /* callback */ | ||||
| UI_view2d_view_ortho(v2d); | UI_view2d_view_ortho(v2d); | ||||
| ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); | ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); | ||||
| /* reset view matrix */ | /* reset view matrix */ | ||||
| UI_view2d_view_restore(C); | UI_view2d_view_restore(C); | ||||
| ED_time_scrub_draw(region, scene, snla->flag & SNLA_DRAWTIME, true); | ED_time_scrub_draw(region, FPS, snla->flag & SNLA_DRAWTIME, true); | ||||
| } | } | ||||
| static void nla_main_region_draw_overlay(const bContext *C, ARegion *region) | static void nla_main_region_draw_overlay(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| /* draw entirely, view changes should be handled here */ | /* draw entirely, view changes should be handled here */ | ||||
| const SpaceNla *snla = CTX_wm_space_nla(C); | const SpaceNla *snla = CTX_wm_space_nla(C); | ||||
| const Scene *scene = CTX_data_scene(C); | const Scene *scene = CTX_data_scene(C); | ||||
| View2D *v2d = ®ion->v2d; | View2D *v2d = ®ion->v2d; | ||||
| /* scrubbing region */ | /* scrubbing region */ | ||||
| ED_time_scrub_draw_current_frame(region, scene, snla->flag & SNLA_DRAWTIME); | ED_time_scrub_draw_current_frame(region, &scene->r, snla->flag & SNLA_DRAWTIME); | ||||
| /* scrollers */ | /* scrollers */ | ||||
| UI_view2d_scrollers_draw(v2d, NULL); | UI_view2d_scrollers_draw(v2d, NULL); | ||||
| } | } | ||||
| /* add handlers, stuff you only do once or on area/region changes */ | /* add handlers, stuff you only do once or on area/region changes */ | ||||
| static void nla_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | static void nla_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 387 Lines • Show Last 20 Lines | |||||