Enhance template selection logic in VideoEditor to handle current frame matches
This commit updates the template selection logic in the VideoEditor to correctly identify and utilize templates that start at the current frame. The changes include additional checks to remove or use templates based on their start frames, improving the efficiency and accuracy of template management during video editing sessions.
This commit is contained in:
@@ -2419,6 +2419,11 @@ class VideoEditor:
|
|||||||
if i > 0:
|
if i > 0:
|
||||||
template_to_remove = i - 1
|
template_to_remove = i - 1
|
||||||
break
|
break
|
||||||
|
elif start_frame == current_frame:
|
||||||
|
# Found template with start_frame == current_frame
|
||||||
|
# Remove THIS template
|
||||||
|
template_to_remove = i
|
||||||
|
break
|
||||||
|
|
||||||
if template_to_remove is not None:
|
if template_to_remove is not None:
|
||||||
removed_template = self.templates.pop(template_to_remove)
|
removed_template = self.templates.pop(template_to_remove)
|
||||||
@@ -2442,6 +2447,10 @@ class VideoEditor:
|
|||||||
return i - 1
|
return i - 1
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
elif start_frame == frame_number:
|
||||||
|
# Found template with start_frame == current_frame
|
||||||
|
# Use THIS template
|
||||||
|
return i
|
||||||
|
|
||||||
# If no template found with start_frame > current_frame, use the last one
|
# If no template found with start_frame > current_frame, use the last one
|
||||||
return len(self.templates) - 1 if self.templates else None
|
return len(self.templates) - 1 if self.templates else None
|
||||||
|
Reference in New Issue
Block a user