Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_operators/sequencer.py
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| scene = context.scene | scene = context.scene | ||||
| if not scene.animation_data: | if not scene.animation_data: | ||||
| scene.animation_data_create() | scene.animation_data_create() | ||||
| if not scene.animation_data.action: | if not scene.animation_data.action: | ||||
| action = bpy.data.actions.new(scene.name + "Action") | action = bpy.data.actions.new(scene.name + "Action") | ||||
| scene.animation_data.action = action | scene.animation_data.action = action | ||||
| sequences = context.selected_sequences | sequences = context.selected_sequences | ||||
| if not sequences: | |||||
| self.report({'ERROR'}, "No sequences selected") | |||||
| return {'CANCELLED'} | |||||
| if self.type in {'CURSOR_TO', 'CURSOR_FROM'}: | if self.type in {'CURSOR_TO', 'CURSOR_FROM'}: | ||||
| sequences = [ | sequences = [ | ||||
| strip for strip in sequences | strip for strip in sequences | ||||
| if strip.frame_final_start < scene.frame_current < strip.frame_final_end | 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 = 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 | max_duration = floor(max_duration / 2.0) if self.type == 'IN_OUT' else max_duration | ||||
| faded_sequences = [] | faded_sequences = [] | ||||
| for sequence in sequences: | for sequence in sequences: | ||||
| duration = self.calculate_fade_duration(context, sequence) | duration = self.calculate_fade_duration(context, sequence) | ||||
| duration = min(duration, max_duration) | duration = min(duration, max_duration) | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||