-
Notifications
You must be signed in to change notification settings - Fork 11
/
cuts.py
607 lines (538 loc) · 26 KB
/
cuts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
import bpy
from . import parenting
from . import timeline
from . import grabs
from . import vseqf
def vseqf_cut(sequence, frame=0, cut_type="SOFT"):
#Check parenting settings, remove if parent strip doesnt exist (prevents cut strips from getting false parents)
parent = parenting.find_parent(sequence)
if not parent:
sequence.parent = ''
bpy.ops.sequencer.select_all(action='DESELECT')
left_sequence = False
right_sequence = False
if frame > sequence.frame_final_start and frame < sequence.frame_final_end:
sequence.select = True
try:
bpy.ops.sequencer.split(frame=frame, type=cut_type, side="BOTH") #Changed in 2.83
except AttributeError:
bpy.ops.sequencer.cut(frame=frame, type=cut_type, side="BOTH")
sequences = timeline.current_selected(bpy.context)
for seq in sequences:
seq.select = False
if seq.frame_final_start < frame:
left_sequence = seq
else:
right_sequence = seq
else:
if sequence.frame_final_end <= frame:
left_sequence = sequence
else:
right_sequence = sequence
return left_sequence, right_sequence
class VSEQFCut(bpy.types.Operator):
"""Advanced cut operator with many extra operations.
Operator variables:
frame: The frame to perform the cut operation at
side: determines which side of the frame some cut functions select or work on. If this operator is invoked, this will be determined automatically based on mouse position relative to the frame. Defaults to BOTH.
type: tells the operator what cut operation to perform, options are:
SOFT: standard cut (like pressing 'k')
HARD: hard cut (like pressing 'shift-k')
INSERT: will perform a standard cut, then ripple insert empty frames.
INSERT_ONLY: will ripple insert empty frames without performing a cut
TRIM: will cut off one side of the strip and delete it. This mode will not run if side==BOTH.
TRIM_LEFT: trim to the left
TRIM_RIGHT: trim to the right
SLIDE: will cut off one side of the strip, and slide the remaining strip up to fill the space. This mode will not run if side==BOTH.
SLIDE_LEFT: slide to the left
SLIDE_RIGHT: slide to the right
RIPPLE: will cut off one side of the strip, and slide it and/or all following strips back to fill the empty space. This mode will not run if side==BOTH.
RIPPLE_LEFT: ripple to the left
RIPPLE_RIGHT: ripple to the right
UNCUT: if the strip to the left or right is the same source and in the same position, the strip will be merged into the current one. This mode will not run if side==BOTH.
UNCUT_LEFT: Uncut, to the left
UNCUT_RIGHT: Uncut, to the right"""
bl_idname = "vseqf.cut"
bl_label = "Wrapper for the built in sequence cut operator that maintains parenting relationships and provides extra cut operations."
bl_options = {"UNDO"}
tooltip: bpy.props.StringProperty("Cut the selected strips")
use_frame: bpy.props.BoolProperty(default=False)
frame = bpy.props.IntProperty(0)
type: bpy.props.EnumProperty(name='Type', items=[("SOFT", "Soft", "", 1), ("HARD", "Hard", "", 2), ("INSERT", "Insert Cut", "", 3), ("INSERT_ONLY", "Insert Only", "", 4), ("TRIM", "Trim", "", 5), ("TRIM_LEFT", "Trim Left", "", 6), ("TRIM_RIGHT", "Trim Right", "", 7), ("SLIDE", "Slide", "", 8), ("SLIDE_LEFT", "Slide Left", "", 9), ("SLIDE_RIGHT", "Slide Right", "", 10), ("RIPPLE", "Ripple", "", 11), ("RIPPLE_LEFT", "Ripple Left", "", 12), ("RIPPLE_RIGHT", "Ripple Right", "", 13), ("UNCUT", "UnCut", "", 14), ("UNCUT_LEFT", "UnCut Left", "", 15), ("UNCUT_RIGHT", "UnCut Right", "", 16)], default='SOFT')
side: bpy.props.EnumProperty(name='Side', items=[("BOTH", "Both", "", 1), ("RIGHT", "Right", "", 2), ("LEFT", "Left", "", 3)], default='BOTH')
all: bpy.props.BoolProperty(name='Cut All', default=False)
use_all: bpy.props.BoolProperty(default=False)
insert: bpy.props.IntProperty(0)
use_insert: bpy.props.BoolProperty(default=False)
def __init__(self):
if not self.use_frame:
self.frame = bpy.context.scene.frame_current
@classmethod
def description(cls, context, properties):
return properties.tooltip
def reset(self):
#resets the variables after a cut is performed
self.frame = 0
self.type = 'SOFT'
self.side = 'BOTH'
self.all = False
self.use_all = False
self.insert = 0
self.use_insert = False
self.use_frame = False
def delete_sequence(self, sequence):
"""Deletes a sequence while maintaining previous selected and active sequences
Argument:
sequence: VSE Sequence object to delete"""
active = timeline.current_active(bpy.context)
selected = []
for seq in bpy.context.scene.sequence_editor.sequences:
if seq.select:
selected.append(seq)
seq.select = False
sequence.select = True
bpy.ops.sequencer.delete()
for seq in selected:
seq.select = True
if active:
bpy.context.scene.sequence_editor.active_strip = active
def check_source(self, sequence, next_sequence):
"""Used by UnCut, checks the source and position of two sequences to see if they can be merged
Arguments:
sequence: VSE Sequence object to be compared
next_sequence: VSE Sequence object to be compared
Returns: Boolean"""
if sequence.type == next_sequence.type:
if sequence.type == 'IMAGE':
if sequence.directory == next_sequence.directory and sequence.elements[0].filename == next_sequence.elements[0].filename:
if len(sequence.elements) == 1 and len(next_sequence.elements) == 1:
return True
elif sequence.frame_start == next_sequence.frame_start:
return True
elif sequence.frame_start == next_sequence.frame_start:
if sequence.type == 'SOUND':
if sequence.sound.filepath == next_sequence.sound.filepath:
return True
if sequence.type == 'MOVIE':
if sequence.filepath == next_sequence.filepath:
return True
if sequence.type == 'SCENE':
if sequence.scene == next_sequence.scene:
return True
if sequence.type == 'MOVIECLIP':
#no way of checking source file :\
pass
return False
def execute(self, context):
return self.start_cut(context)
def invoke(self, context, event):
mouse_x = event.mouse_region_x
cut_frame = self.frame
region = context.region
view = region.view2d
cursor, bottom = view.view_to_region(cut_frame, 0, clip=False)
if mouse_x < cursor:
side = 'LEFT'
else:
side = 'RIGHT'
return self.start_cut(context, side)
def uncut(self, context, side="BOTH"):
#merges a sequence to the one on the left or right if they share the same source and position
if side == 'BOTH':
self.reset()
return{"CANCELLED"}
sequencer = context.scene.sequence_editor
selected = timeline.current_selected(context)
to_uncut = []
for sequence in selected:
if not timeline.is_locked(sequencer, sequence) and not hasattr(sequence, 'input_1'):
to_uncut.append(sequence)
for sequence in to_uncut:
if side == 'LEFT':
direction = 'previous'
else:
direction = 'next'
sequences = timeline.current_sequences(context)
merge_to = timeline.find_close_sequence(sequences, sequence, direction=direction, mode='channel', sounds=True)
if merge_to:
if not timeline.is_locked(sequencer, merge_to):
source_matches = self.check_source(sequence, merge_to)
if source_matches:
merge_to_children = parenting.find_children(merge_to)
parenting.add_children(sequence, merge_to_children)
parenting.clear_children(merge_to)
if direction == 'next':
newend = merge_to.frame_final_end
self.delete_sequence(merge_to)
sequence.frame_final_end = newend
else:
newstart = merge_to.frame_final_start
self.delete_sequence(merge_to)
sequence.frame_final_start = newstart
self.reset()
return{'FINISHED'}
def start_cut(self, context, side="BOTH"):
sequencer = context.scene.sequence_editor
if not sequencer:
self.reset()
return{'CANCELLED'}
#bpy.ops.ed.undo_push()
if not self.use_all:
self.all = context.scene.vseqf.quickcuts_all
if self.type == 'UNCUT_LEFT':
return self.uncut(context, side='LEFT')
if self.type == 'UNCUT_RIGHT':
return self.uncut(context, side='RIGHT')
if self.type == 'TRIM_LEFT':
self.type = 'TRIM'
side = 'LEFT'
if self.type == 'TRIM_RIGHT':
self.type = 'TRIM'
side = 'RIGHT'
if self.type == 'SLIDE_LEFT':
self.type = 'SLIDE'
side = 'LEFT'
if self.type == 'SLIDE_RIGHT':
self.type = 'SLIDE'
side = 'RIGHT'
if self.type == 'RIPPLE_LEFT':
self.type = 'RIPPLE'
side = 'LEFT'
if self.type == 'RIPPLE_RIGHT':
self.type = 'RIPPLE'
side = 'RIGHT'
sequences = timeline.current_sequences(context)
active = timeline.current_active(context)
to_cut = []
to_select = []
to_active = None
cut_pairs = []
#determine all sequences available to cut
to_cut_temp = []
for sequence in sequences:
if not timeline.is_locked(sequencer, sequence) and timeline.under_cursor(sequence, self.frame) and not hasattr(sequence, 'input_1'):
if self.all:
to_cut.append(sequence)
to_cut_temp.append(sequence)
elif sequence.select:
to_cut.append(sequence)
to_cut_temp.append(sequence)
if vseqf.parenting():
children = parenting.get_recursive(sequence, [])
for child in children:
if not timeline.is_locked(sequencer, child) and (not hasattr(child, 'input_1')) and child not in to_cut:
to_cut.append(child)
#find the ripple amount
ripple_amount = 0
for sequence in to_cut_temp:
if side == 'LEFT':
cut_amount = self.frame - sequence.frame_final_start
else:
cut_amount = sequence.frame_final_end - self.frame
#to_cut.append(sequence)
if cut_amount > ripple_amount:
ripple_amount = cut_amount
if side == 'LEFT':
ripple_frame = self.frame - ripple_amount
else:
ripple_frame = self.frame
bpy.ops.sequencer.select_all(action='DESELECT')
to_cut.sort(key=lambda x: x.frame_final_start)
for sequence in to_cut:
cutable = timeline.under_cursor(sequence, self.frame)
left = False
right = False
if self.type in ['TRIM', 'SLIDE', 'RIPPLE']:
if side != 'BOTH':
if side == 'LEFT':
if cutable:
sequence.frame_final_start = self.frame
to_select.append(sequence)
if self.type == 'SLIDE':
sequence.frame_start = sequence.frame_start - ripple_amount
else:
if cutable:
sequence.frame_final_end = self.frame
to_select.append(sequence)
if self.type == 'SLIDE':
sequence.frame_start = sequence.frame_start + ripple_amount
else:
ripple_amount = 0
if self.type in ['SOFT', 'HARD', 'INSERT']:
if self.type == 'INSERT':
cut_type = 'SOFT'
else:
cut_type = self.type
if cutable:
left, right = vseqf_cut(sequence=sequence, frame=self.frame, cut_type=cut_type)
cut_pairs.append([left, right])
else:
to_select.append(sequence)
if (side == 'LEFT' or side == 'BOTH') and left:
to_select.append(left)
if active and left == active:
to_active = left
if (side == 'RIGHT' or side == 'BOTH') and right:
to_select.append(right)
if active and left == active and side != 'BOTH':
to_active = right
timeline.fix_effects(cut_pairs, sequences)
#fix parenting of cut sequences
for cut_pair in cut_pairs:
left, right = cut_pair
if right and left:
children = parenting.find_children(left)
for child in children:
if child.frame_final_start >= right.frame_final_start:
child.parent = right.name
#ripple/insert
if self.type == 'INSERT' or self.type == 'RIPPLE' or self.type == 'INSERT_ONLY':
if self.type == 'RIPPLE':
insert = 0 - ripple_amount
else:
if self.use_insert:
insert = self.insert
else:
insert = context.scene.vseqf.quickcuts_insert
sequences = timeline.current_sequences(context)
if context.scene.vseqf.ripple_markers:
markers = context.scene.timeline_markers
else:
markers = []
grabs.ripple_timeline(sequencer, sequences, ripple_frame - 1, insert, markers=markers)
else:
for sequence in to_select:
if sequence:
sequence.select = True
if to_active:
context.scene.sequence_editor.active_strip = to_active
if side == 'LEFT':
if self.type in ['RIPPLE', 'SLIDE']:
context.scene.frame_current = context.scene.frame_current - ripple_amount
else:
if self.type in ['SLIDE']:
context.scene.frame_current = context.scene.frame_current + ripple_amount
self.reset()
return{'FINISHED'}
class VSEQFQuickCutsMenu(bpy.types.Menu):
"""Popup Menu for QuickCuts operators and properties"""
bl_idname = "VSEQF_MT_quickcuts_menu"
bl_label = "Quick Cuts"
@classmethod
def poll(cls, context):
prefs = vseqf.get_prefs()
if not context.sequences or not context.scene.sequence_editor:
return False
if len(context.sequences) > 0:
return prefs.cuts
else:
return False
def draw(self, context):
quickcuts_all = context.scene.vseqf.quickcuts_all
if quickcuts_all:
cut_strips = 'all'
else:
cut_strips = 'selected'
layout = self.layout
props = layout.operator('vseqf.cut', text='Cut')
props.type = 'SOFT'
props.tooltip = 'Cut '+cut_strips+' sequences under the cursor'
props = layout.operator('vseqf.cut', text='Cut Insert')
props.type = 'INSERT'
props.tooltip = 'Cut '+cut_strips+' sequences under the cursor and insert '+str(context.scene.vseqf.quickcuts_insert)+' frames'
props = layout.operator('vseqf.delete', text='Delete', icon='X')
props.tooltip = 'Delete selected sequences'
props = layout.operator('vseqf.delete', text='Ripple Delete', icon='X')
props.ripple = True
props.tooltip = 'Delete selected sequences, and slide following sequences back to close the gap'
layout.separator()
props = layout.operator('vseqf.cut', text='Trim Left')
props.type = 'TRIM_LEFT'
props.tooltip = 'Cut off the left side of '+cut_strips+' sequences under the cursor'
props = layout.operator('vseqf.cut', text='Slide Trim Left', icon='BACK')
props.type = 'SLIDE_LEFT'
props.tooltip = 'Cut off the left side of '+cut_strips+' sequences under the cursor, and slide cut sequences back to close the gap'
props = layout.operator('vseqf.cut', text='Ripple Trim Left', icon='BACK')
props.type = 'RIPPLE_LEFT'
props.tooltip = 'Cut off the left side of '+cut_strips+' sequences under the cursor, and slide all sequences back to close the gap'
props = layout.operator('vseqf.cut', text='UnCut Left', icon='LOOP_BACK')
props.type = 'UNCUT_LEFT'
props.tooltip = 'Merge selected sequences to those on left if they match source and position'
layout.separator()
props = layout.operator('vseqf.cut', text='Trim Right')
props.type = 'TRIM_RIGHT'
props.tooltip = 'Cut off the right side of '+cut_strips+' sequences under the cursor'
props = layout.operator('vseqf.cut', text='Slide Trim Right', icon='FORWARD')
props.type = 'SLIDE_RIGHT'
props.tooltip = 'Cut off the right side of '+cut_strips+' sequences under the cursor, and slide cut sequences forward to close the gap'
props = layout.operator('vseqf.cut', text='Ripple Trim Right', icon='FORWARD')
props.type = 'RIPPLE_RIGHT'
props.tooltip = 'Cut off the right side of '+cut_strips+' sequences under the cursor, and slide all sequences back to close the gap'
props = layout.operator('vseqf.cut', text='UnCut Right', icon='LOOP_FORWARDS')
props.type = 'UNCUT_RIGHT'
props.tooltip = 'Merge selected sequences to those on right if they match source and position'
layout.separator()
layout.prop(context.scene.vseqf, 'quickcuts_all', toggle=True)
layout.prop(context.scene.vseqf, 'quickcuts_insert')
layout.menu("VSEQF_MT_quicktimeline_menu")
class VSEQF_PT_QuickCutsPanel(bpy.types.Panel):
"""Panel for QuickCuts operators and properties"""
bl_label = "Quick Cuts"
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
bl_category = "Sequencer"
@classmethod
def poll(cls, context):
prefs = vseqf.get_prefs()
if not context.sequences or not context.scene.sequence_editor:
return False
if len(context.sequences) > 0:
return prefs.cuts
else:
return False
def draw(self, context):
layout = self.layout
row = layout.row()
quickcuts_all = context.scene.vseqf.quickcuts_all
if quickcuts_all:
cut_strips = 'all'
else:
cut_strips = 'selected'
row.prop(context.scene.vseqf, 'quickcuts_all', toggle=True)
row.prop(context.scene.vseqf, 'quickcuts_insert')
box = layout.box()
row = box.row()
props = row.operator('vseqf.cut', text='Cut')
props.type = 'SOFT'
props.tooltip = 'Cut '+cut_strips+' sequences under the cursor'
props = row.operator('vseqf.cut', text='Cut Insert')
props.type = 'INSERT'
props.tooltip = 'Cut '+cut_strips+' sequences under the cursor and insert '+str(context.scene.vseqf.quickcuts_insert)+' frames'
row = box.row()
props = row.operator('vseqf.delete', text='Delete', icon='X')
props.tooltip = 'Delete selected sequences'
props = row.operator('vseqf.delete', text='Ripple Delete', icon='X')
props.ripple = True
props.tooltip = 'Delete selected sequences, and slide following sequences back to close the gap'
box = layout.box()
row = box.row()
split = row.split(factor=.5, align=True)
column = split.column(align=True)
props = column.operator('vseqf.cut', text='Trim Left', icon='BACK')
props.type = 'TRIM_LEFT'
props.tooltip = 'Cut off the left side of '+cut_strips+' sequences under the cursor'
props = column.operator('vseqf.cut', text='Slide Trim Left', icon='BACK')
props.type = 'SLIDE_LEFT'
props.tooltip = 'Cut off the left side of '+cut_strips+' sequences under the cursor, and slide cut sequences back to close the gap'
props = column.operator('vseqf.cut', text='Ripple Trim Left', icon='BACK')
props.type = 'RIPPLE_LEFT'
props.tooltip = 'Cut off the left side of '+cut_strips+' sequences under the cursor, and slide all sequences back to close the gap'
props = column.operator('vseqf.cut', text='UnCut Left', icon='LOOP_BACK')
props.type = 'UNCUT_LEFT'
props.tooltip = 'Merge selected sequences to those on left if they match source and position'
column = split.column(align=True)
props = column.operator('vseqf.cut', text='Trim Right', icon='FORWARD')
props.type = 'TRIM_RIGHT'
props.tooltip = 'Cut off the right side of '+cut_strips+' sequences under the cursor'
props = column.operator('vseqf.cut', text='Slide Trim Right', icon='FORWARD')
props.type = 'SLIDE_RIGHT'
props.tooltip = 'Cut off the right side of '+cut_strips+' sequences under the cursor, and slide cut sequences forward to close the gap'
props = column.operator('vseqf.cut', text='Ripple Trim Right', icon='FORWARD')
props.type = 'RIPPLE_RIGHT'
props.tooltip = 'Cut off the right side of '+cut_strips+' sequences under the cursor, and slide all sequences back to close the gap'
props = column.operator('vseqf.cut', text='UnCut Right', icon='LOOP_FORWARDS')
props.type = 'UNCUT_RIGHT'
props.tooltip = 'Merge selected sequences to those on right if they match source and position'
class VSEQFDelete(bpy.types.Operator):
"""Operator to perform sequencer delete operations, while handling parents and rippling."""
bl_idname = 'vseqf.delete'
bl_label = 'VSEQF Delete'
ripple: bpy.props.BoolProperty(default=False)
tooltip: bpy.props.StringProperty("Delete the selected strips")
@classmethod
def description(cls, context, properties):
return properties.tooltip
def reset(self):
self.ripple = False
def execute(self, context):
bpy.ops.ed.undo_push()
to_delete = timeline.current_selected(context)
if not to_delete:
return {'CANCELLED'}
#Determine frames that need to be rippled
ripple_frames = set()
for deletable in to_delete:
delete_start = deletable.frame_final_start
delete_end = deletable.frame_final_end
for frame in range(delete_start, delete_end+1):
ripple_frames.add(frame)
#Delete selected
for sequence in to_delete:
if vseqf.parenting() and context.scene.vseqf.delete_children:
children = parenting.find_children(sequence)
for child in children:
if child not in to_delete:
child.select = True
bpy.ops.sequencer.delete()
if self.ripple:
#Ripple remaining sequences
sequences = timeline.current_sequences(context)
ripple_frames = list(ripple_frames)
ripple_frames.sort()
start_frame = ripple_frames[0]
end_frame = ripple_frames[0]
ripple_frames.append(ripple_frames[-1]+2)
for frame in ripple_frames:
if frame - end_frame > 1:
#Ripple section, start next section
ripple_length = end_frame - start_frame
if context.scene.vseqf.ripple_markers:
markers = context.scene.timeline_markers
else:
markers = []
grabs.ripple_timeline(context.scene.sequence_editor, sequences, start_frame, -ripple_length, markers=markers)
start_frame = frame
end_frame = frame
context.scene.frame_current = ripple_frames[0]
self.reset()
return {'FINISHED'}
class VSEQFDeleteConfirm(bpy.types.Operator):
"""Operator to call the delete menu if it's setting is activated"""
bl_idname = 'vseqf.delete_confirm'
bl_label = 'VSEQF Delete'
@classmethod
def poll(cls, context):
return not context.scene.sequence_editor.selected_retiming_keys
def execute(self, context):
if context.scene.vseqf.delete_confirm:
bpy.ops.wm.call_menu(name='VSEQF_MT_delete_menu')
else:
bpy.ops.vseqf.delete()
return {'FINISHED'}
class VSEQFDeleteConfirmMenu(bpy.types.Menu):
bl_idname = "VSEQF_MT_delete_menu"
bl_label = "Delete Selected?"
def draw(self, context):
del context
layout = self.layout
layout.operator("vseqf.delete", text='Delete')
class VSEQFDeleteRippleConfirm(bpy.types.Operator):
"""Operator to call the ripple delete menu if it's setting is activated"""
bl_idname = 'vseqf.delete_ripple_confirm'
bl_label = 'VSEQF Ripple Delete'
@classmethod
def poll(cls, context):
return not context.scene.sequence_editor.selected_retiming_keys
def execute(self, context):
if context.scene.vseqf.delete_confirm:
bpy.ops.wm.call_menu(name='VSEQF_MT_delete_ripple_menu')
else:
bpy.ops.vseqf.delete(ripple=True)
return {'FINISHED'}
class VSEQFDeleteRippleConfirmMenu(bpy.types.Menu):
bl_idname = "VSEQF_MT_delete_ripple_menu"
bl_label = "Ripple Delete Selected?"
def draw(self, context):
del context
layout = self.layout
layout.operator("vseqf.delete", text='Delete').ripple = True