VSE: Fix multicam splitting all selected strips

`split_multicam` used split operator, where if more strips than
multicam were selected, all would be split, which is undesirable.

Add `Sequence.split()` RNA API function. to split individual strips.
Function accepts `frame` and `split_method arguments`. Returns right
strip after splitting.

In case when strip being split have effects, these will be split too, so
no invalid state should be created.

Selection is not handled, this is by design up to user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11926
This commit is contained in:
2021-07-16 19:09:14 +02:00
parent 1dcf0f9cf1
commit 53743adc29
3 changed files with 46 additions and 7 deletions

View File

@@ -108,14 +108,13 @@ class SequencerSplitMulticam(Operator):
if s.multicam_source == camera or camera >= s.channel:
return {'FINISHED'}
if not s.select:
s.select = True
cfra = context.scene.frame_current
bpy.ops.sequencer.split(frame=cfra, type='SOFT', side='RIGHT')
for s in context.scene.sequence_editor.sequences_all:
if s.select and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
context.scene.sequence_editor.active_strip = s
right_strip = s.split(frame=cfra, split_method='SOFT')
if right_strip:
s.select = False
right_strip.select = True
context.scene.sequence_editor.active_strip = right_strip
context.scene.sequence_editor.active_strip.multicam_source = camera
return {'FINISHED'}