diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-12 20:04:14 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-05-12 20:04:14 +0400 |
commit | d9ca50ff6443afd79e4d1af13bc71d358d74a132 (patch) | |
tree | 29a2a20996d7423c5546518faa22ec63b8f96c03 /source/blender/editors/space_clip | |
parent | beb73831f6c66d7f01c50c6c8b37f23cc67b9914 (diff) |
Refine markers position operator
This operator will run a tracker from previous
keyframe to current frame for all selected markers.
Current markers positions are considering initial
position guess which could be updated by a tracker
for better match.
Useful in cases when feature disappears from the
frame and then appears again. Usage in this case
is the following:
- When feature point re-appeared on frame, manully
place marker on it.
- Use Refine Markers operation (which is in Track
panel) to allow tracker to find a better match.
Depending on direction of tracking use either
Forwards or Backwards refining. It's easy: if
trackign happens forwards, use Refine Frowards,
otherwise use Refine Backwards :)
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 44 |
3 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 1568ecf010e..e0ecdd2ba54 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -149,6 +149,7 @@ void CLIP_OT_delete_track(struct wmOperatorType *ot); void CLIP_OT_delete_marker(struct wmOperatorType *ot); void CLIP_OT_track_markers(struct wmOperatorType *ot); +void CLIP_OT_refine_markers(struct wmOperatorType *ot); void CLIP_OT_solve_camera(struct wmOperatorType *ot); void CLIP_OT_clear_solution(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index c4d92bc78eb..d4d2a1af380 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -471,6 +471,7 @@ static void clip_operatortypes(void) /* track */ WM_operatortype_append(CLIP_OT_track_markers); + WM_operatortype_append(CLIP_OT_refine_markers); /* solving */ WM_operatortype_append(CLIP_OT_solve_camera); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 602e2ba71aa..366d0d6e822 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1323,6 +1323,50 @@ void CLIP_OT_track_markers(wmOperatorType *ot) RNA_def_boolean(ot->srna, "sequence", 0, "Track Sequence", "Track marker during image sequence rather than single image"); } +/********************** refine track position operator *********************/ + +static int refine_marker_exec(bContext *C, wmOperator *op) +{ + SpaceClip *sc = CTX_wm_space_clip(C); + MovieClip *clip = ED_space_clip_get_clip(sc); + MovieTracking *tracking = &clip->tracking; + ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking); + MovieTrackingTrack *track; + bool backwards = RNA_boolean_get(op->ptr, "backwards"); + int framenr = ED_space_clip_get_clip_frame_number(sc); + + for (track = tracksbase->first; track; track = track->next) { + if (TRACK_VIEW_SELECTED(sc, track)) { + MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr); + + BKE_tracking_refine_marker(clip, track, marker, backwards); + } + } + + WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip); + + return OPERATOR_FINISHED; +} + +void CLIP_OT_refine_markers(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Refine Markers"; + ot->description = "Refine selected markers positions " + "by running the tracker from track's reference to current frame"; + ot->idname = "CLIP_OT_refine_markers"; + + /* api callbacks */ + ot->exec = refine_marker_exec; + ot->poll = ED_space_clip_tracking_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + RNA_def_boolean(ot->srna, "backwards", 0, "Backwards", "Do backwards tracking"); +} + /********************** solve camera operator *********************/ typedef struct { |