diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-09-10 16:46:18 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-09-10 16:46:18 +0400 |
commit | e72c6f191f296ee772562b00b5de72688ca6f4cf (patch) | |
tree | 0c450351feed5bbaeee8550632fab22466bb0f04 /source/blender/editors/space_clip | |
parent | 97e823488ca758348acb96b4a787e2f129443f6f (diff) |
Tweaks to plane track
- Do plane re-evaluation only when transform is actually done.
Before this re-evaluation happened on every mouse move.
- Added a flag "Auto Keyframe" for the plane track, which does:
* If Auto Keyframe is enabled, then every manual edit of the
plane will create a new keyframe at current frame and update
plane motion between current frame and previous/next keyframe.
This now also implies blending detected motion with neighbor
keyframes, so there's no jump happening.
No automatic update on manual point tracks edit will happen.
* If auto Keyframe is disabled, then no keyframes are adding
to the plane and every plane tweak will re-evaluate in on
the whole frame range.
In this case manual tweaks to point tracks and re-tracking
them implies plane re-evaluation.
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 70158c23e25..59101b24ad8 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -812,6 +812,32 @@ static void cancel_mouse_slide(SlideMarkerData *data) } } +static void apply_mouse_slide(bContext *C, SlideMarkerData *data) +{ + if (data->area == TRACK_AREA_POINT) { + SpaceClip *sc = CTX_wm_space_clip(C); + MovieClip *clip = ED_space_clip_get_clip(sc); + MovieTrackingPlaneTrack *plane_track; + ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(&clip->tracking); + int framenr = ED_space_clip_get_clip_frame_number(sc); + + for (plane_track = plane_tracks_base->first; + plane_track; + plane_track = plane_track->next) + { + if ((plane_track->flag & PLANE_TRACK_AUTOKEY) == 0) { + int i; + for (i = 0; i < plane_track->point_tracksnr; i++) { + if (plane_track->point_tracks[i] == data->track) { + BKE_tracking_track_plane_from_existing_motion(plane_track, framenr); + break; + } + } + } + } + } +} + static void free_slide_data(SlideMarkerData *data) { if (data->old_markers) @@ -1007,6 +1033,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) case LEFTMOUSE: if (event->val == KM_RELEASE) { + apply_mouse_slide(C, op->customdata); free_slide_data(op->customdata); show_cursor(C); @@ -1267,7 +1294,7 @@ static void track_markers_updatejob(void *tmv) BKE_tracking_context_sync(tmj->context); } -static void track_markers_freejob(void *tmv) +static void track_markers_endjob(void *tmv) { TrackMarkersJob *tmj = (TrackMarkersJob *)tmv; @@ -1276,10 +1303,15 @@ static void track_markers_freejob(void *tmv) ED_update_for_newframe(tmj->main, tmj->scene, 0); BKE_tracking_context_sync(tmj->context); - BKE_tracking_context_free(tmj->context); + BKE_tracking_context_finish(tmj->context); WM_main_add_notifier(NC_SCENE | ND_FRAME, tmj->scene); +} +static void track_markers_freejob(void *tmv) +{ + TrackMarkersJob *tmj = (TrackMarkersJob *)tmv; + BKE_tracking_context_free(tmj->context); MEM_freeN(tmj); } @@ -1333,6 +1365,7 @@ static int track_markers_exec(bContext *C, wmOperator *op) } BKE_tracking_context_sync(context); + BKE_tracking_context_finish(context); BKE_tracking_context_free(context); /* update scene current frame to the lastes tracked frame */ @@ -1389,7 +1422,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS else WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | NA_EVALUATED, 0); - WM_jobs_callbacks(wm_job, track_markers_startjob, NULL, track_markers_updatejob, NULL); + WM_jobs_callbacks(wm_job, track_markers_startjob, NULL, track_markers_updatejob, track_markers_endjob); G.is_break = FALSE; |