Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeline.py: Fix: Preserve Visuals When Removing Gaps with Fully Over… #5694

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/windows/views/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,10 @@ def RemoveAllGaps_Triggered(self, found_start, layer_number):

# Variable to track the end of the last clip/transition
last_end = found_start
moved_start = None
moved_gap_size = None
moved_end = None
last_end_max = None

# List to track modified clips for saving
modified_clips = []
Expand All @@ -1658,14 +1662,31 @@ def RemoveAllGaps_Triggered(self, found_start, layer_number):
for clip in clips_and_transitions:
left_edge = clip.data.get("position", 0.0)
right_edge = left_edge + (clip.data.get("end", 0.0) - clip.data.get("start", 0.0))
if moved_start is not None and moved_start == left_edge:
clip.data["position"] -= moved_gap_size
modified_clips.append(clip)
log.info(f"Removing additional gap from {moved_end} to {left_edge} on layer {layer_number}")
last_end_max = max(right_edge - moved_gap_size, last_end)
continue
else:
moved_start = None
moved_gap_size = None
moved_end = None
if last_end_max is not None:
last_end = last_end_max
last_end_max = None

# Check if there is a gap between the end of the last clip/transition and the start of the current one
if left_edge > last_end:
gap_size = left_edge - last_end
moved_start = left_edge
moved_end = last_end
moved_gap_size = gap_size
clip.data["position"] -= gap_size
modified_clips.append(clip)
log.info(f"Removing gap from {last_end} to {left_edge} on layer {layer_number}")
last_end = right_edge - gap_size
last_end_max = last_end
else:
last_end = max(last_end, right_edge)

Expand Down