1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
22 from bpy.types import Operator
24 from bpy.props import IntProperty
27 class SequencerCrossfadeSounds(Operator):
28 '''Do crossfading volume animation of two selected sound strips.'''
30 bl_idname = "sequencer.crossfade_sounds"
31 bl_label = "Crossfade sounds"
32 bl_options = {'REGISTER', 'UNDO'}
35 def poll(cls, context):
36 if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
37 return context.scene.sequence_editor.active_strip.type == 'SOUND'
41 def execute(self, context):
44 for s in context.scene.sequence_editor.sequences:
45 if s.select and s.type == 'SOUND':
54 self.report({'ERROR'}, "Select 2 sound strips.")
56 if seq1.frame_final_start > seq2.frame_final_start:
60 if seq1.frame_final_end > seq2.frame_final_start:
61 tempcfra = context.scene.frame_current
62 context.scene.frame_current = seq2.frame_final_start
63 seq1.keyframe_insert('volume')
64 context.scene.frame_current = seq1.frame_final_end
66 seq1.keyframe_insert('volume')
67 seq2.keyframe_insert('volume')
68 context.scene.frame_current = seq2.frame_final_start
70 seq2.keyframe_insert('volume')
71 context.scene.frame_current = tempcfra
74 self.report({'ERROR'}, "The selected strips don't overlap.")
78 class SequencerCutMulticam(Operator):
79 '''Cut multicam strip and select camera.'''
81 bl_idname = "sequencer.cut_multicam"
82 bl_label = "Cut multicam"
83 bl_options = {'REGISTER', 'UNDO'}
85 camera = IntProperty(name="Camera",
86 default=1, min=1, max=32, soft_min=1, soft_max=32)
89 def poll(cls, context):
90 if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
91 return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
95 def execute(self, context):
98 s = context.scene.sequence_editor.active_strip
100 if s.multicam_source == camera or camera >= s.channel:
106 cfra = context.scene.frame_current
107 bpy.ops.sequencer.cut(frame=cfra, type='SOFT', side='RIGHT')
108 for s in context.scene.sequence_editor.sequences_all:
109 if s.select and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
110 context.scene.sequence_editor.active_strip = s
112 context.scene.sequence_editor.active_strip.multicam_source = camera
116 class SequencerDeinterlaceSelectedMovies(Operator):
117 '''Deinterlace all selected movie sources.'''
119 bl_idname = "sequencer.deinterlace_selected_movies"
120 bl_label = "Deinterlace Movies"
121 bl_options = {'REGISTER', 'UNDO'}
124 def poll(cls, context):
125 if context.scene and context.scene.sequence_editor:
130 def execute(self, context):
131 for s in context.scene.sequence_editor.sequences_all:
132 if s.select and s.type == 'MOVIE':
133 s.use_deinterlace = True