diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-07-13 13:53:56 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-07-13 13:53:56 +0300 |
commit | d374469f4c045355b2e5b17d7ba5dae9c979c8c7 (patch) | |
tree | f8938fd7a693dc79130d958d8192d4db4b4b28b0 /source/blender/sequencer/intern | |
parent | af42b35e53413a90200bd9d8b0c2051ceee081b5 (diff) |
VSE: Make pasted strip active
When adding texts or various simple effects I often copy-paste strips
to reuse properties from a template such as font or position. I assume
this is common workflow. Issue with this workflow is, that active strip
is not changed after pasting, so when adjusting property, it is original
strip that is being modified.
This is not issue when duplicating strips - selection state is
transfered to duplicate strips, such that duplicate of active strip is
set to be active and duplicate of selected strip is set to selected.
Implement same selection transfering behavior in paste operator, that
exists in duplicate operator.
Since strip can be deleted after copying, it is not possible to rely
on sequencer state. This is true even when pasting strips to different
scene. Therefore active strip name must be stored in clipboard.
Reviewed By: sergey, Severin
Differential Revision: https://developer.blender.org/D11781
Diffstat (limited to 'source/blender/sequencer/intern')
-rw-r--r-- | source/blender/sequencer/intern/clipboard.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/sequencer/intern/clipboard.c b/source/blender/sequencer/intern/clipboard.c index e3f82dd4bb0..6c7cdbac7b5 100644 --- a/source/blender/sequencer/intern/clipboard.c +++ b/source/blender/sequencer/intern/clipboard.c @@ -24,6 +24,8 @@ * \ingroup bke */ +#include <string.h> + #include "MEM_guardedalloc.h" #include "DNA_scene_types.h" @@ -31,6 +33,7 @@ #include "DNA_sound_types.h" #include "BLI_listbase.h" +#include "BLI_string.h" #include "BKE_main.h" #include "BKE_movieclip.h" @@ -38,6 +41,7 @@ #include "BKE_sound.h" #include "SEQ_clipboard.h" +#include "SEQ_select.h" #include "sequencer.h" @@ -55,6 +59,7 @@ ListBase seqbase_clipboard; int seqbase_clipboard_frame; +char seq_clipboard_active_seq_name[SEQ_NAME_MAXSTR]; void seq_clipboard_pointers_free(struct ListBase *seqbase); @@ -177,3 +182,27 @@ void SEQ_clipboard_pointers_restore(ListBase *seqbase, Main *bmain) SEQ_clipboard_pointers_restore(&seq->seqbase, bmain); } } + +void SEQ_clipboard_active_seq_name_store(Scene *scene) +{ + Sequence *active_seq = SEQ_select_active_get(scene); + if (active_seq != NULL) { + BLI_strncpy( + seq_clipboard_active_seq_name, active_seq->name, sizeof(seq_clipboard_active_seq_name)); + } + else { + memset(seq_clipboard_active_seq_name, 0, sizeof(seq_clipboard_active_seq_name)); + } +} + +/** + * Check if strip was active when it was copied. User should restrict this check to pasted strips + * before ensuring original name, because strip name comparison is used to check. + * + * \param pasted_seq: Strip that is pasted(duplicated) from clipboard + * \return true if strip was active, false otherwise + */ +bool SEQ_clipboard_pasted_seq_was_active(Sequence *pasted_seq) +{ + return STREQ(pasted_seq->name, seq_clipboard_active_seq_name); +} |