2010-02-08 14:43:44 +00:00
|
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-02-08 14:43:44 +00:00
|
|
|
#
|
|
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
|
|
|
|
|
|
# <pep8 compliant>
|
|
|
|
|
|
|
|
import bpy
|
2011-08-12 06:57:00 +00:00
|
|
|
from bpy.types import Operator
|
2010-02-08 14:43:44 +00:00
|
|
|
|
2011-02-27 15:25:24 +00:00
|
|
|
from bpy.props import IntProperty
|
2010-03-06 01:40:29 +00:00
|
|
|
|
2010-05-16 12:15:04 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class SequencerCrossfadeSounds(Operator):
|
2012-07-03 09:02:41 +00:00
|
|
|
"""Do cross-fading volume animation of two selected sound strips"""
|
2010-02-08 14:43:44 +00:00
|
|
|
|
|
|
|
bl_idname = "sequencer.crossfade_sounds"
|
|
|
|
bl_label = "Crossfade sounds"
|
2010-03-01 00:03:51 +00:00
|
|
|
bl_options = {'REGISTER', 'UNDO'}
|
2010-02-08 14:43:44 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2012-02-29 12:11:06 +00:00
|
|
|
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
|
|
|
|
return context.scene.sequence_editor.active_strip.type == 'SOUND'
|
2012-02-29 11:23:27 +00:00
|
|
|
else:
|
2012-02-29 12:11:06 +00:00
|
|
|
return False
|
2010-02-08 14:43:44 +00:00
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
seq1 = None
|
|
|
|
seq2 = None
|
|
|
|
for s in context.scene.sequence_editor.sequences:
|
2010-07-15 16:56:04 +00:00
|
|
|
if s.select and s.type == 'SOUND':
|
2010-09-18 10:43:32 +00:00
|
|
|
if seq1 is None:
|
2010-02-08 14:43:44 +00:00
|
|
|
seq1 = s
|
2010-09-18 10:43:32 +00:00
|
|
|
elif seq2 is None:
|
2010-02-08 14:43:44 +00:00
|
|
|
seq2 = s
|
|
|
|
else:
|
|
|
|
seq2 = None
|
|
|
|
break
|
2010-09-18 10:43:32 +00:00
|
|
|
if seq2 is None:
|
2011-09-19 14:00:42 +00:00
|
|
|
self.report({'ERROR'}, "Select 2 sound strips")
|
2010-02-08 14:43:44 +00:00
|
|
|
return {'CANCELLED'}
|
2010-04-01 21:44:56 +00:00
|
|
|
if seq1.frame_final_start > seq2.frame_final_start:
|
2010-02-08 14:43:44 +00:00
|
|
|
s = seq1
|
|
|
|
seq1 = seq2
|
|
|
|
seq2 = s
|
2010-04-01 21:44:56 +00:00
|
|
|
if seq1.frame_final_end > seq2.frame_final_start:
|
|
|
|
tempcfra = context.scene.frame_current
|
|
|
|
context.scene.frame_current = seq2.frame_final_start
|
2011-12-22 03:56:21 +00:00
|
|
|
seq1.keyframe_insert("volume")
|
2010-04-01 21:44:56 +00:00
|
|
|
context.scene.frame_current = seq1.frame_final_end
|
2010-02-08 14:43:44 +00:00
|
|
|
seq1.volume = 0
|
2011-12-22 03:56:21 +00:00
|
|
|
seq1.keyframe_insert("volume")
|
|
|
|
seq2.keyframe_insert("volume")
|
2010-04-01 21:44:56 +00:00
|
|
|
context.scene.frame_current = seq2.frame_final_start
|
2010-02-08 14:43:44 +00:00
|
|
|
seq2.volume = 0
|
2011-12-22 03:56:21 +00:00
|
|
|
seq2.keyframe_insert("volume")
|
2010-04-01 21:44:56 +00:00
|
|
|
context.scene.frame_current = tempcfra
|
2010-02-08 14:43:44 +00:00
|
|
|
return {'FINISHED'}
|
|
|
|
else:
|
2011-09-19 14:00:42 +00:00
|
|
|
self.report({'ERROR'}, "The selected strips don't overlap")
|
2010-02-08 14:43:44 +00:00
|
|
|
return {'CANCELLED'}
|
|
|
|
|
2010-02-14 11:21:21 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class SequencerCutMulticam(Operator):
|
2012-07-03 09:02:41 +00:00
|
|
|
"""Cut multi-cam strip and select camera"""
|
2010-05-02 17:36:38 +00:00
|
|
|
|
|
|
|
bl_idname = "sequencer.cut_multicam"
|
|
|
|
bl_label = "Cut multicam"
|
|
|
|
bl_options = {'REGISTER', 'UNDO'}
|
|
|
|
|
2011-08-19 19:25:20 +00:00
|
|
|
camera = IntProperty(
|
|
|
|
name="Camera",
|
|
|
|
min=1, max=32,
|
|
|
|
soft_min=1, soft_max=32,
|
|
|
|
default=1,
|
|
|
|
)
|
2010-05-02 17:36:38 +00:00
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2010-05-02 17:36:38 +00:00
|
|
|
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
|
|
|
|
return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
|
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def execute(self, context):
|
2010-09-09 18:03:57 +00:00
|
|
|
camera = self.camera
|
2010-05-02 17:36:38 +00:00
|
|
|
|
|
|
|
s = context.scene.sequence_editor.active_strip
|
|
|
|
|
2010-07-19 17:39:25 +00:00
|
|
|
if s.multicam_source == camera or camera >= s.channel:
|
2010-05-30 19:29:58 +00:00
|
|
|
return {'FINISHED'}
|
|
|
|
|
2010-07-15 16:56:04 +00:00
|
|
|
if not s.select:
|
|
|
|
s.select = True
|
2010-05-16 12:15:04 +00:00
|
|
|
|
2010-05-02 17:36:38 +00:00
|
|
|
cfra = context.scene.frame_current
|
2010-05-30 20:04:24 +00:00
|
|
|
bpy.ops.sequencer.cut(frame=cfra, type='SOFT', side='RIGHT')
|
2010-05-03 22:17:05 +00:00
|
|
|
for s in context.scene.sequence_editor.sequences_all:
|
2010-07-15 16:56:04 +00:00
|
|
|
if s.select and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
|
2010-05-02 17:36:38 +00:00
|
|
|
context.scene.sequence_editor.active_strip = s
|
2010-05-16 12:15:04 +00:00
|
|
|
|
2010-05-02 17:36:38 +00:00
|
|
|
context.scene.sequence_editor.active_strip.multicam_source = camera
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
2010-05-16 12:15:04 +00:00
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class SequencerDeinterlaceSelectedMovies(Operator):
|
2012-07-03 09:02:41 +00:00
|
|
|
"""Deinterlace all selected movie sources"""
|
2010-05-03 22:17:05 +00:00
|
|
|
|
|
|
|
bl_idname = "sequencer.deinterlace_selected_movies"
|
|
|
|
bl_label = "Deinterlace Movies"
|
|
|
|
bl_options = {'REGISTER', 'UNDO'}
|
|
|
|
|
2010-08-09 01:37:09 +00:00
|
|
|
@classmethod
|
|
|
|
def poll(cls, context):
|
2013-04-20 13:23:53 +00:00
|
|
|
return (context.scene and context.scene.sequence_editor)
|
2010-05-03 22:17:05 +00:00
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
for s in context.scene.sequence_editor.sequences_all:
|
2010-07-15 16:56:04 +00:00
|
|
|
if s.select and s.type == 'MOVIE':
|
2010-08-20 06:09:58 +00:00
|
|
|
s.use_deinterlace = True
|
2010-05-03 22:17:05 +00:00
|
|
|
|
2010-05-16 12:15:04 +00:00
|
|
|
return {'FINISHED'}
|