Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_graph/space_graph.c
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "BLO_read_write.h" | #include "BLO_read_write.h" | ||||
| #include "graph_intern.h" /* own include */ | #include "graph_intern.h" /* own include */ | ||||
| /* ******************** default callbacks for ipo space ***************** */ | /* ******************** default callbacks for ipo space ***************** */ | ||||
| static SpaceLink *graph_create(const ScrArea *UNUSED(area), const Scene *scene) | static SpaceLink *graph_create(const wmWindow *win, const ScrArea *UNUSED(area)) | ||||
| { | { | ||||
| const Scene *scene = WM_window_get_active_scene(win); | |||||
| ARegion *region; | ARegion *region; | ||||
| SpaceGraph *sipo; | SpaceGraph *sipo; | ||||
| /* Graph Editor - general stuff */ | /* Graph Editor - general stuff */ | ||||
| sipo = MEM_callocN(sizeof(SpaceGraph), "init graphedit"); | sipo = MEM_callocN(sizeof(SpaceGraph), "init graphedit"); | ||||
| sipo->spacetype = SPACE_GRAPH; | sipo->spacetype = SPACE_GRAPH; | ||||
| sipo->autosnap = SACTSNAP_FRAME; | sipo->autosnap = SACTSNAP_FRAME; | ||||
| ▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | static void graph_main_region_draw(const bContext *C, ARegion *region) | ||||
| /* 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); | ||||
| /* grid */ | /* grid */ | ||||
| bool display_seconds = (sipo->mode == SIPO_MODE_ANIMATION) && (sipo->flag & SIPO_DRAWTIME); | bool display_seconds = (sipo->mode == SIPO_MODE_ANIMATION) && (sipo->flag & SIPO_DRAWTIME); | ||||
| UI_view2d_draw_lines_x__frames_or_seconds(v2d, scene, display_seconds); | UI_view2d_draw_lines_x__frames_or_seconds(v2d, FPS, display_seconds); | ||||
| UI_view2d_draw_lines_y__values(v2d); | UI_view2d_draw_lines_y__values(v2d); | ||||
| 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 (in F-Curve mode only) */ | /* start and end frame (in F-Curve mode only) */ | ||||
| if (sipo->mode != SIPO_MODE_DRIVERS) { | if (sipo->mode != SIPO_MODE_DRIVERS) { | ||||
| ANIM_draw_framerange(scene, v2d); | ANIM_draw_framerange(scene, v2d); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | static void graph_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); | ||||
| /* time-scrubbing */ | /* time-scrubbing */ | ||||
| ED_time_scrub_draw(region, scene, display_seconds, false); | ED_time_scrub_draw(region, FPS, display_seconds, false); | ||||
| } | } | ||||
| static void graph_main_region_draw_overlay(const bContext *C, ARegion *region) | static void graph_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 SpaceGraph *sipo = CTX_wm_space_graph(C); | const SpaceGraph *sipo = CTX_wm_space_graph(C); | ||||
| const Scene *scene = CTX_data_scene(C); | const Scene *scene = CTX_data_scene(C); | ||||
| View2D *v2d = ®ion->v2d; | View2D *v2d = ®ion->v2d; | ||||
| /* Driver Editor's X axis is not time. */ | /* Driver Editor's X axis is not time. */ | ||||
| if (sipo->mode != SIPO_MODE_DRIVERS) { | if (sipo->mode != SIPO_MODE_DRIVERS) { | ||||
| /* scrubbing region */ | /* scrubbing region */ | ||||
| ED_time_scrub_draw_current_frame(region, scene, sipo->flag & SIPO_DRAWTIME); | ED_time_scrub_draw_current_frame(region, &scene->r, sipo->flag & SIPO_DRAWTIME); | ||||
| } | } | ||||
| /* 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. */ | ||||
| UI_view2d_scrollers_draw(v2d, NULL); | UI_view2d_scrollers_draw(v2d, NULL); | ||||
| /* scale numbers */ | /* scale numbers */ | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 609 Lines • Show Last 20 Lines | |||||