Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2022-05-16 21:19:33 +0300
committerAntonio Vazquez <blendergit@gmail.com>2022-05-16 21:20:44 +0300
commit8c4bd02b067af921d0a7dcbfc601bd0ef0941be1 (patch)
tree4ff7db3ac4a1053a718f233dcd0522eb551a427e
parentbe84fe4ce1d8521ec91aa8bd6f56e9cdf4f7d8fe (diff)
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
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c29
2 files changed, 35 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index b3d2cbf914a..f5f1ae14369 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -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")
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 0370d3605a7..4b72b989e80 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -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);
}
/** \} */