VSE: Delete Strip and Scene Data in one step
Actually, delete the strip only deletes the container, but not the linked data. This patch adds the option to delete the scene also. This is very handy for storyboarding. Reviewed By: ISS Maniphest Tasks: T97683 Differential Revision: https://developer.blender.org/D14794
This commit is contained in:
parent
be84fe4ce1
commit
8c4bd02b06
Notes:
blender-bot
2023-02-14 00:10:08 +01:00
Referenced by issue #99932, Regression: Video in node group doesn't play Referenced by issue #98359, Regression: Crash switching to scene with LineArt Referenced by issue #97683, VSE: Add option for "Delete Strip and Data"
|
@ -946,6 +946,9 @@ class SEQUENCER_MT_strip(Menu):
|
|||
|
||||
strip = context.active_sequence_strip
|
||||
|
||||
if strip and strip.type == 'SCENE':
|
||||
layout.operator("sequencer.delete", text="Delete Strip & Data").delete_data = True
|
||||
|
||||
if has_sequencer:
|
||||
if strip:
|
||||
strip_type = strip.type
|
||||
|
@ -1064,6 +1067,10 @@ class SEQUENCER_MT_context_menu(Menu):
|
|||
props.keep_open = False
|
||||
layout.operator("sequencer.delete", text="Delete")
|
||||
|
||||
strip = context.active_sequence_strip
|
||||
if strip and strip.type == 'SCENE':
|
||||
layout.operator("sequencer.delete", text="Delete Strip & Data").delete_data = True
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("sequencer.slip", text="Slip Strip Contents")
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "ED_keyframing.h"
|
||||
#include "ED_numinput.h"
|
||||
#include "ED_outliner.h"
|
||||
#include "ED_scene.h"
|
||||
#include "ED_screen.h"
|
||||
#include "ED_sequencer.h"
|
||||
|
||||
|
@ -1719,11 +1720,26 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
|
|||
/** \name Erase Strips Operator
|
||||
* \{ */
|
||||
|
||||
static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static void sequencer_delete_strip_data(bContext *C, Sequence *seq)
|
||||
{
|
||||
if (seq->type != SEQ_TYPE_SCENE) {
|
||||
return;
|
||||
}
|
||||
|
||||
Main *bmain = CTX_data_main(C);
|
||||
if (seq->scene) {
|
||||
if (ED_scene_delete(C, bmain, seq->scene)) {
|
||||
WM_event_add_notifier(C, NC_SCENE | NA_REMOVED, seq->scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int sequencer_delete_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ListBase *seqbasep = SEQ_active_seqbase_get(SEQ_editing_get(scene));
|
||||
const bool delete_data = RNA_boolean_get(op->ptr, "delete_data");
|
||||
|
||||
if (sequencer_view_has_preview_poll(C) && !sequencer_view_preview_only_poll(C)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -1736,6 +1752,9 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
SEQ_ITERATOR_FOREACH (seq, selected_strips) {
|
||||
SEQ_edit_flag_for_removal(scene, seqbasep, seq);
|
||||
if (delete_data) {
|
||||
sequencer_delete_strip_data(C, seq);
|
||||
}
|
||||
}
|
||||
SEQ_edit_remove_flagged_sequences(scene, seqbasep);
|
||||
|
||||
|
@ -1778,6 +1797,14 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
|
|||
|
||||
/* Flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* Properties. */
|
||||
ot->prop = RNA_def_boolean(ot->srna,
|
||||
"delete_data",
|
||||
false,
|
||||
"Delete Data",
|
||||
"After removing the Strip, delete the associated data also");
|
||||
RNA_def_property_flag(ot->prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
Loading…
Reference in New Issue