Add complete reset functionality to VideoEditor for all transformations
This commit introduces a new method, complete_reset, in the VideoEditor class, allowing users to reset all transformations and settings, including crop, zoom, rotation, brightness, contrast, and motion tracking. The method ensures a clean slate for editing by clearing the transformation cache and saving the state. Additionally, the specification has been updated to include this new functionality, enhancing user control over the editing environment.
This commit is contained in:
@@ -1957,10 +1957,13 @@ class VideoEditor:
|
||||
motion_text = (
|
||||
f" | Motion: {self.tracking_enabled}" if self.tracking_enabled else ""
|
||||
)
|
||||
autorepeat_text = (
|
||||
f" | Loop: ON" if self.looping_between_markers else ""
|
||||
)
|
||||
if self.is_image_mode:
|
||||
info_text = f"Image | Zoom: {self.zoom_factor:.1f}x{rotation_text}{brightness_text}{contrast_text}{motion_text}"
|
||||
else:
|
||||
info_text = f"Frame: {self.current_frame}/{self.total_frames} | Speed: {self.playback_speed:.1f}x | Zoom: {self.zoom_factor:.1f}x{seek_multiplier_text}{rotation_text}{brightness_text}{contrast_text}{motion_text} | {'Playing' if self.is_playing else 'Paused'}"
|
||||
info_text = f"Frame: {self.current_frame}/{self.total_frames} | Speed: {self.playback_speed:.1f}x | Zoom: {self.zoom_factor:.1f}x{seek_multiplier_text}{rotation_text}{brightness_text}{contrast_text}{motion_text}{autorepeat_text} | {'Playing' if self.is_playing else 'Paused'}"
|
||||
cv2.putText(
|
||||
canvas,
|
||||
info_text,
|
||||
@@ -2273,6 +2276,44 @@ class VideoEditor:
|
||||
self.clear_transformation_cache()
|
||||
self.save_state() # Save state when crop is undone
|
||||
|
||||
def complete_reset(self):
|
||||
"""Complete reset of all transformations and settings"""
|
||||
# Reset crop
|
||||
if self.crop_rect:
|
||||
self.crop_history.append(self.crop_rect)
|
||||
self.crop_rect = None
|
||||
|
||||
# Reset zoom
|
||||
self.zoom_factor = 1.0
|
||||
self.zoom_center = None
|
||||
|
||||
# Reset rotation
|
||||
self.rotation_angle = 0
|
||||
|
||||
# Reset brightness and contrast
|
||||
self.brightness = 0
|
||||
self.contrast = 1.0
|
||||
|
||||
# Reset motion tracking
|
||||
self.tracking_enabled = False
|
||||
self.tracking_points = {}
|
||||
|
||||
# Reset cut markers
|
||||
self.cut_start_frame = None
|
||||
self.cut_end_frame = None
|
||||
self.looping_between_markers = False
|
||||
|
||||
# Reset display offset
|
||||
self.display_offset = [0, 0]
|
||||
|
||||
# Clear transformation cache
|
||||
self.clear_transformation_cache()
|
||||
|
||||
# Save state
|
||||
self.save_state()
|
||||
|
||||
print("Complete reset applied - all transformations and markers cleared")
|
||||
|
||||
def toggle_marker_looping(self):
|
||||
"""Toggle looping between cut markers"""
|
||||
# Check if both markers are set
|
||||
@@ -2818,7 +2859,8 @@ class VideoEditor:
|
||||
print(" h/j/k/l: Contract crop (left/down/up/right)")
|
||||
print(" H/J/K/L: Expand crop (left/down/up/right)")
|
||||
print(" U: Undo crop")
|
||||
print(" C: Clear crop")
|
||||
print(" c: Clear crop")
|
||||
print(" C: Complete reset (crop, zoom, rotation, brightness, contrast, tracking)")
|
||||
print()
|
||||
print("Motion Tracking:")
|
||||
print(" Right-click: Add/remove tracking point (at current frame)")
|
||||
@@ -2854,7 +2896,8 @@ class VideoEditor:
|
||||
print(" h/j/k/l: Contract crop (left/down/up/right)")
|
||||
print(" H/J/K/L: Expand crop (left/down/up/right)")
|
||||
print(" U: Undo crop")
|
||||
print(" C: Clear crop")
|
||||
print(" c: Clear crop")
|
||||
print(" C: Complete reset (crop, zoom, rotation, brightness, contrast, tracking)")
|
||||
print()
|
||||
print("Other Controls:")
|
||||
print(" Ctrl+Scroll: Zoom in/out")
|
||||
@@ -3045,6 +3088,8 @@ class VideoEditor:
|
||||
self.zoom_factor = 1.0
|
||||
self.clear_transformation_cache()
|
||||
self.save_state() # Save state when crop is cleared
|
||||
elif key == ord("C"):
|
||||
self.complete_reset()
|
||||
elif key == ord("1"):
|
||||
# Cut markers only for videos
|
||||
if not self.is_image_mode:
|
||||
|
@@ -53,6 +53,7 @@ Be careful to save and load settings when navigating this way
|
||||
- **H/J/K/L**: Contract crop to left/down/up/right edges (15 pixels per keypress)
|
||||
- **u**: Undo last crop
|
||||
- **c**: Clear all cropping
|
||||
- **C**: Complete reset (crop, zoom, rotation, brightness, contrast, tracking points, cut markers)
|
||||
|
||||
### Motion Tracking
|
||||
- **Right-click**: Add tracking point (green circle with white border)
|
||||
|
Reference in New Issue
Block a user