diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-04 03:15:01 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-04 03:15:01 +0400 |
commit | 48ead2736643cf0327b9472cfd05042a58f9d9b0 (patch) | |
tree | d966adce993fd14472a4ff2a79372da305273fc7 /source/blender/editors/space_clip | |
parent | 5da2135eef39ac042a8c4babcac7be375e6903d2 (diff) |
Camera tracking: switch dopesheet information to lazy calculation
All operators which changes tracking data now just tags dopsheet as outdated,
actual re-calculaiton of happens only when this information is actually needed
(like on dopesheet draw).
This makes things a bit faster when there's no dopesheet visible in current
screen and also makes it much easier to update dopesheet using dependency
graph.
Also renamed dopesheet_sort_order to dopesheet_sort_method in rna and internal
stuff which makes much more sense and also correlated with naming in
file browser.
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_editor.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_utils.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 33 |
4 files changed, 21 insertions, 28 deletions
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index c5c5628abb9..a5575cd125e 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -552,11 +552,3 @@ int ED_space_clip_show_trackedit(SpaceClip *sc) return FALSE; } - -void ED_space_clip_update_dopesheet(SpaceClip *sc) -{ - MovieClip *clip = sc->clip; - MovieTracking *tracking = &clip->tracking; - - BKE_tracking_update_dopesheet(tracking); -} diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index c8ba8be7eae..d45fe834fac 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -194,11 +194,11 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie if (update_stab) { tracking->stabilization.ok = FALSE; - - DAG_id_tag_update(&clip->id, 0); WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); } + DAG_id_tag_update(&clip->id, 0); + if (has_bundle) WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL); } diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 82f76efacaa..b92b45752ef 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1135,7 +1135,7 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar) View2DScrollers *scrollers; short unit = 0; - BKE_tracking_dopesheet_sort(&clip->tracking, sc->dope_sort, sc->dope_flag & SC_DOPE_SORT_INVERSE); + BKE_tracking_dopesheet_update(&clip->tracking, sc->dope_sort, sc->dope_flag & SC_DOPE_SORT_INVERSE); /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); @@ -1194,7 +1194,7 @@ static void clip_channels_area_draw(const bContext *C, ARegion *ar) View2D *v2d = &ar->v2d; View2DScrollers *scrollers; - BKE_tracking_dopesheet_sort(&clip->tracking, sc->dope_sort, sc->dope_flag & SC_DOPE_SORT_INVERSE); + BKE_tracking_dopesheet_update(&clip->tracking, sc->dope_sort, sc->dope_flag & SC_DOPE_SORT_INVERSE); /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 2c9b61ed1ef..2c1a6ade70a 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -95,8 +95,6 @@ static void add_marker(SpaceClip *sc, float x, float y) BKE_tracking_select_track(tracksbase, track, TRACK_AREA_ALL, 0); clip->tracking.act_track = track; - - ED_space_clip_update_dopesheet(sc); } static int add_marker_exec(bContext *C, wmOperator *op) @@ -176,8 +174,6 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op)) /* nothing selected now, unlock view so it can be scrolled nice again */ sc->flag &= ~SC_LOCK_SELECTION; - ED_space_clip_update_dopesheet(sc); - return OPERATOR_FINISHED; } @@ -229,8 +225,6 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op)) sc->flag &= ~SC_LOCK_SELECTION; } - ED_space_clip_update_dopesheet(sc); - return OPERATOR_FINISHED; } @@ -795,8 +789,9 @@ static int mouse_select(bContext *C, float co[2], int extend) sc->ylockof = 0.0f; } + BKE_tracking_dopesheet_tag_update(tracking); + WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); - ED_space_clip_update_dopesheet(sc); return OPERATOR_FINISHED; } @@ -868,8 +863,9 @@ static int border_select_exec(bContext *C, wmOperator *op) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); + MovieTracking *tracking = &clip->tracking; MovieTrackingTrack *track; - ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking); + ListBase *tracksbase = BKE_tracking_get_tracks(tracking); rcti rect; rctf rectf; int change = FALSE, mode, extend; @@ -908,7 +904,7 @@ static int border_select_exec(bContext *C, wmOperator *op) } if (change) { - ED_space_clip_update_dopesheet(sc); + BKE_tracking_dopesheet_tag_update(tracking); WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); @@ -956,8 +952,9 @@ static int circle_select_exec(bContext *C, wmOperator *op) SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); ARegion *ar = CTX_wm_region(C); + MovieTracking *tracking = &clip->tracking; MovieTrackingTrack *track; - ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking); + ListBase *tracksbase = BKE_tracking_get_tracks(tracking); int x, y, radius, width, height, mode, change = FALSE; float zoomx, zoomy, offset[2], ellipse[2]; @@ -994,7 +991,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) } if (change) { - ED_space_clip_update_dopesheet(sc); + BKE_tracking_dopesheet_tag_update(tracking); WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); @@ -1033,9 +1030,10 @@ static int select_all_exec(bContext *C, wmOperator *op) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); + MovieTracking *tracking = &clip->tracking; MovieTrackingTrack *track = NULL; /* selected track */ MovieTrackingMarker *marker; - ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking); + ListBase *tracksbase = BKE_tracking_get_tracks(tracking); int action = RNA_enum_get(op->ptr, "action"); int framenr = sc->user.framenr; int has_selection = FALSE; @@ -1092,7 +1090,7 @@ static int select_all_exec(bContext *C, wmOperator *op) if (!has_selection) sc->flag &= ~SC_LOCK_SELECTION; - ED_space_clip_update_dopesheet(sc); + BKE_tracking_dopesheet_tag_update(tracking); WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL); @@ -1174,7 +1172,7 @@ static int select_groped_exec(bContext *C, wmOperator *op) track = track->next; } - ED_space_clip_update_dopesheet(sc); + BKE_tracking_dopesheet_tag_update(tracking); WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip); @@ -2745,7 +2743,7 @@ static int hide_tracks_exec(bContext *C, wmOperator *op) sc->flag &= ~SC_LOCK_SELECTION; } - BKE_tracking_update_dopesheet(tracking); + BKE_tracking_dopesheet_tag_update(tracking); WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL); @@ -2776,7 +2774,8 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); - ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking); + MovieTracking *tracking = &clip->tracking; + ListBase *tracksbase = BKE_tracking_get_tracks(tracking); MovieTrackingTrack *track; track = tracksbase->first; @@ -2786,6 +2785,8 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op)) track = track->next; } + BKE_tracking_dopesheet_tag_update(tracking); + WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL); return OPERATOR_FINISHED; |