Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_operators/sequencer.py
| Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | def execute(self, context): | ||||
| } | } | ||||
| for sequence in context.selected_sequences: | for sequence in context.selected_sequences: | ||||
| animated_property = "volume" if hasattr(sequence, "volume") else "blend_alpha" | animated_property = "volume" if hasattr(sequence, "volume") else "blend_alpha" | ||||
| data_path = sequence.path_from_id() + "." + animated_property | data_path = sequence.path_from_id() + "." + animated_property | ||||
| curve = fcurve_map.get(data_path) | curve = fcurve_map.get(data_path) | ||||
| if curve: | if curve: | ||||
| fcurves.remove(curve) | fcurves.remove(curve) | ||||
| setattr(sequence, animated_property, 1.0) | setattr(sequence, animated_property, 1.0) | ||||
| sequence.invalidate('COMPOSITE') | |||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| class SequencerFadesAdd(Operator): | class SequencerFadesAdd(Operator): | ||||
| """Adds or updates a fade animation for either visual or audio strips""" | """Adds or updates a fade animation for either visual or audio strips""" | ||||
| bl_idname = "sequencer.fades_add" | bl_idname = "sequencer.fades_add" | ||||
| bl_label = "Add Fades" | bl_label = "Add Fades" | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | def execute(self, context): | ||||
| continue | continue | ||||
| animated_property = 'volume' if hasattr(sequence, 'volume') else 'blend_alpha' | animated_property = 'volume' if hasattr(sequence, 'volume') else 'blend_alpha' | ||||
| fade_fcurve = self.fade_find_or_create_fcurve(context, sequence, animated_property) | fade_fcurve = self.fade_find_or_create_fcurve(context, sequence, animated_property) | ||||
| fades = self.calculate_fades(sequence, fade_fcurve, animated_property, duration) | fades = self.calculate_fades(sequence, fade_fcurve, animated_property, duration) | ||||
| self.fade_animation_clear(fade_fcurve, fades) | self.fade_animation_clear(fade_fcurve, fades) | ||||
| self.fade_animation_create(fade_fcurve, fades) | self.fade_animation_create(fade_fcurve, fades) | ||||
| faded_sequences.append(sequence) | faded_sequences.append(sequence) | ||||
| sequence.invalidate('COMPOSITE') | |||||
| sequence_string = "sequence" if len(faded_sequences) == 1 else "sequences" | sequence_string = "sequence" if len(faded_sequences) == 1 else "sequences" | ||||
| self.report({'INFO'}, "Added fade animation to {} {}.".format(len(faded_sequences), sequence_string)) | self.report({'INFO'}, "Added fade animation to {} {}.".format(len(faded_sequences), sequence_string)) | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| def calculate_fade_duration(self, context, sequence): | def calculate_fade_duration(self, context, sequence): | ||||
| frame_current = context.scene.frame_current | frame_current = context.scene.frame_current | ||||
| duration = 0.0 | duration = 0.0 | ||||
| ▲ Show 20 Lines • Show All 136 Lines • Show Last 20 Lines | |||||