Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_graph/space_graph.c
| Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | |||||
| static void graph_main_region_draw(const bContext *C, ARegion *region) | static void graph_main_region_draw(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| /* draw entirely, view changes should be handled here */ | /* draw entirely, view changes should be handled here */ | ||||
| SpaceGraph *sipo = CTX_wm_space_graph(C); | SpaceGraph *sipo = CTX_wm_space_graph(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| bAnimContext ac; | bAnimContext ac; | ||||
| View2D *v2d = ®ion->v2d; | View2D *v2d = ®ion->v2d; | ||||
| View2DScrollers *scrollers; | |||||
| float col[3]; | float col[3]; | ||||
| short cfra_flag = 0; | |||||
| /* clear and setup matrix */ | /* clear and setup matrix */ | ||||
| UI_GetThemeColor3fv(TH_BACK, col); | UI_GetThemeColor3fv(TH_BACK, col); | ||||
| GPU_clear_color(col[0], col[1], col[2], 0.0); | GPU_clear_color(col[0], col[1], col[2], 0.0); | ||||
| GPU_clear(GPU_COLOR_BIT); | GPU_clear(GPU_COLOR_BIT); | ||||
| UI_view2d_view_ortho(v2d); | UI_view2d_view_ortho(v2d); | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | if (sipo->mode == SIPO_MODE_DRIVERS) { | ||||
| immEnd(); | immEnd(); | ||||
| GPU_blend(false); | GPU_blend(false); | ||||
| } | } | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| } | } | ||||
| if (sipo->mode != SIPO_MODE_DRIVERS) { | |||||
| /* current frame */ | |||||
| if (sipo->flag & SIPO_DRAWTIME) { | |||||
| cfra_flag |= DRAWCFRA_UNIT_SECONDS; | |||||
| } | |||||
| ANIM_draw_cfra(C, v2d, cfra_flag); | |||||
| } | |||||
| /* markers */ | /* markers */ | ||||
| if (sipo->mode != SIPO_MODE_DRIVERS) { | if (sipo->mode != SIPO_MODE_DRIVERS) { | ||||
| UI_view2d_view_orthoSpecial(region, v2d, 1); | UI_view2d_view_orthoSpecial(region, v2d, 1); | ||||
| int marker_draw_flag = DRAW_MARKERS_MARGIN; | int marker_draw_flag = DRAW_MARKERS_MARGIN; | ||||
| if (sipo->flag & SIPO_SHOW_MARKERS) { | if (sipo->flag & SIPO_SHOW_MARKERS) { | ||||
| ED_markers_draw(C, marker_draw_flag); | ED_markers_draw(C, marker_draw_flag); | ||||
| } | } | ||||
| } | } | ||||
| /* preview range */ | /* preview range */ | ||||
| if (sipo->mode != SIPO_MODE_DRIVERS) { | if (sipo->mode != SIPO_MODE_DRIVERS) { | ||||
| UI_view2d_view_ortho(v2d); | UI_view2d_view_ortho(v2d); | ||||
| ANIM_draw_previewrange(C, v2d, 0); | ANIM_draw_previewrange(C, v2d, 0); | ||||
| } | } | ||||
| /* 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); | ||||
| /* time-scrubbing */ | /* time-scrubbing */ | ||||
| ED_time_scrub_draw(region, scene, display_seconds, false); | ED_time_scrub_draw(region, scene, display_seconds, false); | ||||
| } | |||||
| static void graph_main_region_draw_display(const bContext *C, ARegion *region) | |||||
| { | |||||
| /* draw entirely, view changes should be handled here */ | |||||
| const SpaceGraph *sipo = CTX_wm_space_graph(C); | |||||
| const Scene *scene = CTX_data_scene(C); | |||||
| const bool draw_vert_line = sipo->mode != SIPO_MODE_DRIVERS; | |||||
| View2D *v2d = ®ion->v2d; | |||||
| View2DScrollers *scrollers; | |||||
| /* scrubbing region */ | |||||
| ED_time_scrub_draw_current_frame(region, scene, sipo->flag & SIPO_DRAWTIME, draw_vert_line); | |||||
| /* scrollers */ | /* scrollers */ | ||||
| // FIXME: args for scrollers depend on the type of data being shown... | // FIXME: args for scrollers depend on the type of data being shown... | ||||
| 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); | ||||
| /* scale numbers */ | /* scale numbers */ | ||||
| ▲ Show 20 Lines • Show All 527 Lines • ▼ Show 20 Lines | void ED_spacetype_ipo(void) | ||||
| st->space_subtype_get = graph_space_subtype_get; | st->space_subtype_get = graph_space_subtype_get; | ||||
| st->space_subtype_set = graph_space_subtype_set; | st->space_subtype_set = graph_space_subtype_set; | ||||
| /* regions: main window */ | /* regions: main window */ | ||||
| art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); | ||||
| art->regionid = RGN_TYPE_WINDOW; | art->regionid = RGN_TYPE_WINDOW; | ||||
| art->init = graph_main_region_init; | art->init = graph_main_region_init; | ||||
| art->draw = graph_main_region_draw; | art->draw = graph_main_region_draw; | ||||
| art->draw_display = graph_main_region_draw_display; | |||||
| art->listener = graph_region_listener; | art->listener = graph_region_listener; | ||||
| art->message_subscribe = graph_region_message_subscribe; | art->message_subscribe = graph_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 graphedit region"); | art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region"); | ||||
| Show All 40 Lines | |||||