diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-12-21 15:42:08 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-12-22 11:28:31 +0300 |
commit | 2ce2bffc4d8fd153494dad28d71511b7429e9a73 (patch) | |
tree | a6ee5b9ec027aa3df39bb0f0bfca775902011a97 /release | |
parent | d2bf60cc17a961789d7c415fc3d2af14afa50f62 (diff) |
Fix T94295: VSE fades error when no suitable sequences selected
This errored out in two scenarios:
- current frame not in strips framerange (this was reported)
- no strips selected at all
Now handle these cases properly in the operator and give appropriate
report info.
Maniphest Tasks: T94295
Differential Revision: https://developer.blender.org/D13642
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/sequencer.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py index 26f1c12d2b8..1a56e77b7b7 100644 --- a/release/scripts/startup/bl_operators/sequencer.py +++ b/release/scripts/startup/bl_operators/sequencer.py @@ -216,11 +216,19 @@ class SequencerFadesAdd(Operator): scene.animation_data.action = action sequences = context.selected_sequences + + if not sequences: + self.report({'ERROR'}, "No sequences selected") + return {'CANCELLED'} + if self.type in {'CURSOR_TO', 'CURSOR_FROM'}: sequences = [ strip for strip in sequences if strip.frame_final_start < scene.frame_current < strip.frame_final_end ] + if not sequences: + self.report({'ERROR'}, "Current frame not within strip framerange") + return {'CANCELLED'} max_duration = min(sequences, key=lambda strip: strip.frame_final_duration).frame_final_duration max_duration = floor(max_duration / 2.0) if self.type == 'IN_OUT' else max_duration |