Enhance tracking marker navigation in VideoEditor
This commit improves the navigation logic in the VideoEditor class for jumping to previous and next tracking markers. It ensures that when at the beginning of the tracking frames, the user jumps to the first marker, and when at the end, they jump to the last marker. Debug statements have been updated to reflect these changes, providing clearer insights during navigation. The specification has also been updated to document the new behavior.
This commit is contained in:
@@ -1076,9 +1076,14 @@ class VideoEditor:
|
||||
return
|
||||
current = self.current_frame
|
||||
candidates = [f for f in tracking_frames if f < current]
|
||||
target = candidates[-1] if candidates else tracking_frames[-1]
|
||||
if candidates:
|
||||
target = candidates[-1]
|
||||
print(f"DEBUG: Jump prev tracking from {current} -> {target}; tracking_frames={tracking_frames}")
|
||||
self.seek_to_frame(target)
|
||||
else:
|
||||
target = tracking_frames[0]
|
||||
print(f"DEBUG: Jump prev tracking to first marker from {current} -> {target}; tracking_frames={tracking_frames}")
|
||||
self.seek_to_frame(target)
|
||||
|
||||
def jump_to_next_marker(self):
|
||||
"""Jump to the next tracking marker (frame with tracking points)."""
|
||||
@@ -1095,8 +1100,9 @@ class VideoEditor:
|
||||
print(f"DEBUG: Jump next tracking from {current} -> {f}; tracking_frames={tracking_frames}")
|
||||
self.seek_to_frame(f)
|
||||
return
|
||||
print(f"DEBUG: Jump next tracking wrap from {current} -> {tracking_frames[0]}; tracking_frames={tracking_frames}")
|
||||
self.seek_to_frame(tracking_frames[0])
|
||||
target = tracking_frames[-1]
|
||||
print(f"DEBUG: Jump next tracking to last marker from {current} -> {target}; tracking_frames={tracking_frames}")
|
||||
self.seek_to_frame(target)
|
||||
|
||||
def _get_previous_tracking_point(self):
|
||||
"""Get the tracking point from the previous frame that has tracking points."""
|
||||
|
@@ -68,8 +68,8 @@ Be careful to save and load settings when navigating this way
|
||||
- **Display** Points are rendered as blue dots per frame, in addition the previous tracking point (red) and next tracking point (magenta) are shown with yellow arrows indicating motion direction
|
||||
|
||||
#### Motion Tracking Navigation
|
||||
- **,**: Jump to previous tracking marker (previous frame that has one or more tracking points). Wrap-around supported.
|
||||
- **.**: Jump to next tracking marker (next frame that has one or more tracking points). Wrap-around supported.
|
||||
- **,**: Jump to previous tracking marker (previous frame that has one or more tracking points). Goes to first marker if at beginning.
|
||||
- **.**: Jump to next tracking marker (next frame that has one or more tracking points). Goes to last marker if at end.
|
||||
|
||||
### Markers and Looping
|
||||
- **1**: Set cut start marker at current frame
|
||||
|
Reference in New Issue
Block a user