diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-08-03 16:57:07 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-08-04 13:52:40 +0300 |
commit | f921ae46658348121c3408b01171e0e21667438c (patch) | |
tree | 0c72391b4722504e8ace0f899c45068cff3a5d79 | |
parent | a9e0aeaf653d6a10113bc0636b8f16a9358212e0 (diff) |
Fix T79453: Motion Tracking: marker does not remember 'enabled' state
Caused by rB63ee3db96107.
While above commit corrected the clip offset, it also removed logic to
ensure a marker on a particular frame. This is needed though, otherwise
changes on a particular frame are applied to the marker being returned
by 'BKE_tracking_marker_get' which can be a completely different marker
if none exist for that frame yet.
This patch partly reverts rB63ee3db96107 and reintroduces the framenr
for the MarkerUpdateCb and uses that to ensure a marker on that frame.
Candidate for backporting to 2.83 LTS?
Reviewers: sergey, jacqueslucke
Subscribers:
-rw-r--r-- | source/blender/editors/space_clip/clip_buttons.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 3b1cc6fcab0..71f75d96cb1 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -259,6 +259,8 @@ typedef struct { MovieTrackingTrack *track; MovieTrackingMarker *marker; + /** current frame number */ + int framenr; /** position of marker in pixel coords */ float marker_pos[2]; /** position and dimensions of marker pattern in pixel coords */ @@ -286,7 +288,8 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) return; } - MovieTrackingMarker *marker = cb->marker; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(cb->clip, cb->framenr); + MovieTrackingMarker *marker = BKE_tracking_marker_ensure(cb->track, clip_framenr); marker->flag = cb->marker_flag; WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); @@ -300,7 +303,9 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) BKE_movieclip_get_size(cb->clip, cb->user, &width, &height); - MovieTrackingMarker *marker = cb->marker; + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(cb->clip, cb->framenr); + MovieTrackingMarker *marker = BKE_tracking_marker_ensure(cb->track, clip_framenr); + if (event == B_MARKER_POS) { marker->pos[0] = cb->marker_pos[0] / width; marker->pos[1] = cb->marker_pos[1] / height; @@ -456,6 +461,7 @@ void uiTemplateMarker(uiLayout *layout, cb->track = track; cb->marker = marker; cb->marker_flag = marker->flag; + cb->framenr = user->framenr; if (compact) { block = uiLayoutGetBlock(layout); |