Enhance template management in VideoEditor by removing future templates and ending current ones
This commit updates the template handling logic in the VideoEditor to remove any templates that start after the current frame and properly end templates that start at the current frame. This change improves the clarity and efficiency of template management during video editing sessions, ensuring that only relevant templates are active. Debug messages have been added to provide insights into the template removal and ending process.
This commit is contained in:
@@ -2410,10 +2410,16 @@ class VideoEditor:
|
||||
if end_frame is None:
|
||||
end_frame = self.total_frames - 1
|
||||
|
||||
# End the previous template at the current frame (if there is one)
|
||||
if self.current_template_id is not None and self.current_template_id in self.templates:
|
||||
self.templates[self.current_template_id]['end_frame'] = self.current_frame - 1
|
||||
print(f"DEBUG: Ended previous template {self.current_template_id} at frame {self.current_frame - 1}")
|
||||
# End any templates that start after the current frame
|
||||
for template_id, template_data in list(self.templates.items()):
|
||||
if template_data['start_frame'] > self.current_frame:
|
||||
# This template starts after the current frame, so remove it
|
||||
del self.templates[template_id]
|
||||
print(f"DEBUG: Removed future template {template_id} that started at frame {template_data['start_frame']}")
|
||||
elif template_data['start_frame'] == self.current_frame:
|
||||
# This template starts at the same frame, end it at the previous frame
|
||||
self.templates[template_id]['end_frame'] = self.current_frame - 1
|
||||
print(f"DEBUG: Ended template {template_id} at frame {self.current_frame - 1}")
|
||||
|
||||
self.templates[template_id] = {
|
||||
'template': template.copy(),
|
||||
|
Reference in New Issue
Block a user