Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_action/space_action.c
| Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | |||||
| static void action_main_region_draw(const bContext *C, ARegion *region) | static void action_main_region_draw(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| /* draw entirely, view changes should be handled here */ | /* draw entirely, view changes should be handled here */ | ||||
| SpaceAction *saction = CTX_wm_space_action(C); | SpaceAction *saction = CTX_wm_space_action(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Object *obact = CTX_data_active_object(C); | Object *obact = CTX_data_active_object(C); | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| View2D *v2d = ®ion->v2d; | View2D *v2d = ®ion->v2d; | ||||
| View2DScrollers *scrollers; | |||||
| short marker_flag = 0; | short marker_flag = 0; | ||||
| short cfra_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 */ | /* clear and setup matrix */ | ||||
| UI_ThemeClearColor(TH_BACK); | UI_ThemeClearColor(TH_BACK); | ||||
| GPU_clear(GPU_COLOR_BIT); | GPU_clear(GPU_COLOR_BIT); | ||||
| 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, saction->flag & SACTION_DRAWTIME); | UI_view2d_draw_lines_x__discrete_frames_or_seconds(v2d, scene, saction->flag & SACTION_DRAWTIME); | ||||
| 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)) { | ||||
| draw_channel_strips(&ac, saction, 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 */ | /* markers */ | ||||
| UI_view2d_view_orthoSpecial(region, v2d, 1); | UI_view2d_view_orthoSpecial(region, v2d, 1); | ||||
| marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) | | marker_flag = ((ac.markers && (ac.markers != &ac.scene->markers)) ? DRAW_MARKERS_LOCAL : 0) | | ||||
| DRAW_MARKERS_MARGIN; | DRAW_MARKERS_MARGIN; | ||||
| if (saction->flag & SACTION_SHOW_MARKERS) { | if (saction->flag & SACTION_SHOW_MARKERS) { | ||||
| ED_markers_draw(C, marker_flag); | ED_markers_draw(C, marker_flag); | ||||
| Show All 12 Lines | static void action_main_region_draw(const bContext *C, ARegion *region) | ||||
| 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); | ||||
| /* scrubbing region */ | /* scrubbing region */ | ||||
| ED_time_scrub_draw(region, scene, saction->flag & SACTION_DRAWTIME, true); | ED_time_scrub_draw(region, scene, saction->flag & SACTION_DRAWTIME, true); | ||||
| } | |||||
| static void action_main_region_draw_display(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; | |||||
| View2DScrollers *scrollers; | |||||
| /* scrubbing region */ | |||||
| ED_time_scrub_draw_current_frame(region, scene, saction->flag & SACTION_DRAWTIME, true); | |||||
| /* scrollers */ | /* scrollers */ | ||||
| scrollers = UI_view2d_scrollers_calc(v2d, NULL); | scrollers = UI_view2d_scrollers_calc(v2d, NULL); | ||||
| UI_view2d_scrollers_draw(v2d, scrollers); | UI_view2d_scrollers_draw(v2d, scrollers); | ||||
| UI_view2d_scrollers_free(scrollers); | UI_view2d_scrollers_free(scrollers); | ||||
| } | } | ||||
| /* add handlers, stuff you only do once or on area/region changes */ | /* add handlers, stuff you only do once or on area/region changes */ | ||||
| ▲ Show 20 Lines • Show All 620 Lines • ▼ Show 20 Lines | void ED_spacetype_action(void) | ||||
| st->space_subtype_get = action_space_subtype_get; | st->space_subtype_get = action_space_subtype_get; | ||||
| st->space_subtype_set = action_space_subtype_set; | st->space_subtype_set = action_space_subtype_set; | ||||
| /* regions: main window */ | /* regions: main window */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype action region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype action region"); | ||||
| art->regionid = RGN_TYPE_WINDOW; | art->regionid = RGN_TYPE_WINDOW; | ||||
| art->init = action_main_region_init; | art->init = action_main_region_init; | ||||
| art->draw = action_main_region_draw; | art->draw = action_main_region_draw; | ||||
| art->draw_display = action_main_region_draw_display; | |||||
| art->listener = action_main_region_listener; | art->listener = action_main_region_listener; | ||||
| art->message_subscribe = saction_main_region_message_subscribe; | art->message_subscribe = saction_main_region_message_subscribe; | ||||
| art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES; | art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_ANIMATION | ED_KEYMAP_FRAMES; | ||||
| BLI_addhead(&st->regiontypes, art); | BLI_addhead(&st->regiontypes, art); | ||||
| /* regions: header */ | /* regions: header */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype action region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype action region"); | ||||
| Show All 38 Lines | |||||