Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_clip/space_clip.c
| Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| SpaceClip *sc = (SpaceClip *)area->spacedata.first; | SpaceClip *sc = (SpaceClip *)area->spacedata.first; | ||||
| if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) { | if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) { | ||||
| clip_scopes_tag_refresh(area); | clip_scopes_tag_refresh(area); | ||||
| } | } | ||||
| } | } | ||||
| static void clip_area_sync_frame_from_scene(ScrArea *area, Scene *scene) | static void clip_area_sync_frame_from_scene(ScrArea *area, const Scene *scene) | ||||
| { | { | ||||
| SpaceClip *space_clip = (SpaceClip *)area->spacedata.first; | SpaceClip *space_clip = (SpaceClip *)area->spacedata.first; | ||||
| BKE_movieclip_user_set_frame(&space_clip->user, scene->r.cfra); | BKE_movieclip_user_set_frame(&space_clip->user, scene->r.cfra); | ||||
| } | } | ||||
| /* ******************** default callbacks for clip space ***************** */ | /* ******************** default callbacks for clip space ***************** */ | ||||
| static SpaceLink *clip_create(const ScrArea *area, const Scene *scene) | static SpaceLink *clip_create(const ScrArea *area, const Scene *scene) | ||||
| ▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | static SpaceLink *clip_duplicate(SpaceLink *sl) | ||||
| /* clear or remove stuff from old */ | /* clear or remove stuff from old */ | ||||
| scn->scopes.track_search = NULL; | scn->scopes.track_search = NULL; | ||||
| scn->scopes.track_preview = NULL; | scn->scopes.track_preview = NULL; | ||||
| scn->scopes.ok = false; | scn->scopes.ok = false; | ||||
| return (SpaceLink *)scn; | return (SpaceLink *)scn; | ||||
| } | } | ||||
| static void clip_listener(wmWindow *UNUSED(win), ScrArea *area, wmNotifier *wmn, Scene *scene) | static void clip_listener(const wmSpaceTypeListenerParams *params) | ||||
| { | { | ||||
| ScrArea *area = params->area; | |||||
| wmNotifier *wmn = params->notifier; | |||||
| const Scene *scene = params->scene; | |||||
| /* context changes */ | /* context changes */ | ||||
| switch (wmn->category) { | switch (wmn->category) { | ||||
| case NC_SCENE: | case NC_SCENE: | ||||
| switch (wmn->data) { | switch (wmn->data) { | ||||
| case ND_FRAME: | case ND_FRAME: | ||||
| clip_scopes_tag_refresh(area); | clip_scopes_tag_refresh(area); | ||||
| ATTR_FALLTHROUGH; | ATTR_FALLTHROUGH; | ||||
| ▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Lines | #endif | ||||
| WM_operatortype_append(CLIP_OT_stabilize_2d_select); | WM_operatortype_append(CLIP_OT_stabilize_2d_select); | ||||
| WM_operatortype_append(CLIP_OT_stabilize_2d_rotation_add); | WM_operatortype_append(CLIP_OT_stabilize_2d_rotation_add); | ||||
| WM_operatortype_append(CLIP_OT_stabilize_2d_rotation_remove); | WM_operatortype_append(CLIP_OT_stabilize_2d_rotation_remove); | ||||
| WM_operatortype_append(CLIP_OT_stabilize_2d_rotation_select); | WM_operatortype_append(CLIP_OT_stabilize_2d_rotation_select); | ||||
| /* clean-up */ | /* clean-up */ | ||||
| WM_operatortype_append(CLIP_OT_clear_track_path); | WM_operatortype_append(CLIP_OT_clear_track_path); | ||||
| WM_operatortype_append(CLIP_OT_join_tracks); | WM_operatortype_append(CLIP_OT_join_tracks); | ||||
| WM_operatortype_append(CLIP_OT_average_tracks); | |||||
| WM_operatortype_append(CLIP_OT_track_copy_color); | WM_operatortype_append(CLIP_OT_track_copy_color); | ||||
| WM_operatortype_append(CLIP_OT_clean_tracks); | WM_operatortype_append(CLIP_OT_clean_tracks); | ||||
| /* object tracking */ | /* object tracking */ | ||||
| WM_operatortype_append(CLIP_OT_tracking_object_new); | WM_operatortype_append(CLIP_OT_tracking_object_new); | ||||
| WM_operatortype_append(CLIP_OT_tracking_object_remove); | WM_operatortype_append(CLIP_OT_tracking_object_remove); | ||||
| ▲ Show 20 Lines • Show All 458 Lines • ▼ Show 20 Lines | static void clip_main_region_draw(const bContext *C, ARegion *region) | ||||
| clip_draw_cache_and_notes(C, sc, region); | clip_draw_cache_and_notes(C, sc, region); | ||||
| if (sc->flag & SC_SHOW_ANNOTATION) { | if (sc->flag & SC_SHOW_ANNOTATION) { | ||||
| /* Grease Pencil */ | /* Grease Pencil */ | ||||
| clip_draw_grease_pencil((bContext *)C, true); | clip_draw_grease_pencil((bContext *)C, true); | ||||
| } | } | ||||
| /* callback */ | /* callback */ | ||||
| /* TODO(sergey): For being consistent with space image the projection needs to be configured | |||||
| * the way how the commented out code does it. This works correct for tracking data, but it | |||||
| * causes wrong aspect correction for mask editor (see T84990). */ | |||||
| // GPU_matrix_push_projection(); | |||||
| // wmOrtho2(region->v2d.cur.xmin, region->v2d.cur.xmax, region->v2d.cur.ymin, | |||||
| // region->v2d.cur.ymax); | |||||
| ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); | ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); | ||||
| // GPU_matrix_pop_projection(); | |||||
| /* reset view matrix */ | /* reset view matrix */ | ||||
| UI_view2d_view_restore(C); | UI_view2d_view_restore(C); | ||||
| if (sc->flag & SC_SHOW_ANNOTATION) { | if (sc->flag & SC_SHOW_ANNOTATION) { | ||||
| /* draw Grease Pencil - screen space only */ | /* draw Grease Pencil - screen space only */ | ||||
| clip_draw_grease_pencil((bContext *)C, false); | clip_draw_grease_pencil((bContext *)C, false); | ||||
| } | } | ||||
| WM_gizmomap_draw(region->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), | static void clip_main_region_listener(const wmRegionListenerParams *params) | ||||
| ScrArea *UNUSED(area), | |||||
| ARegion *region, | |||||
| wmNotifier *wmn, | |||||
| const Scene *UNUSED(scene)) | |||||
| { | { | ||||
| ARegion *region = params->region; | |||||
| wmNotifier *wmn = params->notifier; | |||||
| /* context changes */ | /* context changes */ | ||||
| switch (wmn->category) { | switch (wmn->category) { | ||||
| case NC_GPENCIL: | case NC_GPENCIL: | ||||
| if (wmn->action == NA_EDITED) { | if (wmn->action == NA_EDITED) { | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| } | } | ||||
| else if (wmn->data & ND_GPENCIL_EDITMODE) { | else if (wmn->data & ND_GPENCIL_EDITMODE) { | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| ▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | static void clip_preview_region_draw(const bContext *C, ARegion *region) | ||||
| if (sc->view == SC_VIEW_GRAPH) { | if (sc->view == SC_VIEW_GRAPH) { | ||||
| graph_region_draw(C, region); | graph_region_draw(C, region); | ||||
| } | } | ||||
| else if (sc->view == SC_VIEW_DOPESHEET) { | else if (sc->view == SC_VIEW_DOPESHEET) { | ||||
| dopesheet_region_draw(C, region); | dopesheet_region_draw(C, region); | ||||
| } | } | ||||
| } | } | ||||
| static void clip_preview_region_listener(wmWindow *UNUSED(win), | static void clip_preview_region_listener(const wmRegionListenerParams *UNUSED(params)) | ||||
| ScrArea *UNUSED(area), | |||||
| ARegion *UNUSED(region), | |||||
| wmNotifier *UNUSED(wmn), | |||||
| const Scene *UNUSED(scene)) | |||||
| { | { | ||||
| } | } | ||||
| /****************** channels region ******************/ | /****************** channels region ******************/ | ||||
| static void clip_channels_region_init(wmWindowManager *wm, ARegion *region) | static void clip_channels_region_init(wmWindowManager *wm, ARegion *region) | ||||
| { | { | ||||
| wmKeyMap *keymap; | wmKeyMap *keymap; | ||||
| Show All 24 Lines | static void clip_channels_region_draw(const bContext *C, ARegion *region) | ||||
| /* data... */ | /* data... */ | ||||
| clip_draw_dopesheet_channels(C, region); | clip_draw_dopesheet_channels(C, region); | ||||
| /* reset view matrix */ | /* reset view matrix */ | ||||
| UI_view2d_view_restore(C); | UI_view2d_view_restore(C); | ||||
| } | } | ||||
| static void clip_channels_region_listener(wmWindow *UNUSED(win), | static void clip_channels_region_listener(const wmRegionListenerParams *UNUSED(params)) | ||||
| ScrArea *UNUSED(area), | |||||
| ARegion *UNUSED(region), | |||||
| wmNotifier *UNUSED(wmn), | |||||
| const Scene *UNUSED(scene)) | |||||
| { | { | ||||
| } | } | ||||
| /****************** header region ******************/ | /****************** header region ******************/ | ||||
| /* 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 clip_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | static void clip_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region) | ||||
| { | { | ||||
| ED_region_header_init(region); | ED_region_header_init(region); | ||||
| } | } | ||||
| static void clip_header_region_draw(const bContext *C, ARegion *region) | static void clip_header_region_draw(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| ED_region_header(C, region); | ED_region_header(C, region); | ||||
| } | } | ||||
| static void clip_header_region_listener(wmWindow *UNUSED(win), | static void clip_header_region_listener(const wmRegionListenerParams *params) | ||||
| ScrArea *UNUSED(area), | |||||
| ARegion *region, | |||||
| wmNotifier *wmn, | |||||
| const Scene *UNUSED(scene)) | |||||
| { | { | ||||
| ARegion *region = params->region; | |||||
| wmNotifier *wmn = params->notifier; | |||||
| /* context changes */ | /* context changes */ | ||||
| switch (wmn->category) { | switch (wmn->category) { | ||||
| case NC_SCENE: | case NC_SCENE: | ||||
| switch (wmn->data) { | switch (wmn->data) { | ||||
| /* for proportional editmode only */ | /* for proportional editmode only */ | ||||
| case ND_TOOLSETTINGS: | case ND_TOOLSETTINGS: | ||||
| /* TODO - should do this when in mask mode only but no data available */ | /* TODO - should do this when in mask mode only but no data available */ | ||||
| // if (sc->mode == SC_MODE_MASKEDIT) | // if (sc->mode == SC_MODE_MASKEDIT) | ||||
| Show All 21 Lines | |||||
| static void clip_tools_region_draw(const bContext *C, ARegion *region) | static void clip_tools_region_draw(const bContext *C, ARegion *region) | ||||
| { | { | ||||
| ED_region_panels(C, region); | ED_region_panels(C, region); | ||||
| } | } | ||||
| /****************** tool properties region ******************/ | /****************** tool properties region ******************/ | ||||
| static void clip_props_region_listener(wmWindow *UNUSED(win), | static void clip_props_region_listener(const wmRegionListenerParams *params) | ||||
| ScrArea *UNUSED(area), | |||||
| ARegion *region, | |||||
| wmNotifier *wmn, | |||||
| const Scene *UNUSED(scene)) | |||||
| { | { | ||||
| ARegion *region = params->region; | |||||
| wmNotifier *wmn = params->notifier; | |||||
| /* context changes */ | /* context changes */ | ||||
| switch (wmn->category) { | switch (wmn->category) { | ||||
| case NC_WM: | case NC_WM: | ||||
| if (wmn->data == ND_HISTORY) { | if (wmn->data == ND_HISTORY) { | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| } | } | ||||
| break; | break; | ||||
| case NC_SCENE: | case NC_SCENE: | ||||
| Show All 31 Lines | |||||
| { | { | ||||
| SpaceClip *sc = CTX_wm_space_clip(C); | SpaceClip *sc = CTX_wm_space_clip(C); | ||||
| BKE_movieclip_update_scopes(sc->clip, &sc->user, &sc->scopes); | BKE_movieclip_update_scopes(sc->clip, &sc->user, &sc->scopes); | ||||
| ED_region_panels(C, region); | ED_region_panels(C, region); | ||||
| } | } | ||||
| static void clip_properties_region_listener(wmWindow *UNUSED(win), | static void clip_properties_region_listener(const wmRegionListenerParams *params) | ||||
| ScrArea *UNUSED(area), | |||||
| ARegion *region, | |||||
| wmNotifier *wmn, | |||||
| const Scene *UNUSED(scene)) | |||||
| { | { | ||||
| ARegion *region = params->region; | |||||
| wmNotifier *wmn = params->notifier; | |||||
| /* context changes */ | /* context changes */ | ||||
| switch (wmn->category) { | switch (wmn->category) { | ||||
| case NC_GPENCIL: | case NC_GPENCIL: | ||||
| if (ELEM(wmn->data, ND_DATA, ND_GPENCIL_EDITMODE)) { | if (ELEM(wmn->data, ND_DATA, ND_GPENCIL_EDITMODE)) { | ||||
| ED_region_tag_redraw(region); | ED_region_tag_redraw(region); | ||||
| } | } | ||||
| break; | break; | ||||
| case NC_BRUSH: | case NC_BRUSH: | ||||
| ▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines | |||||