VSE: Add move_to_meta RNA API function
This function can be used to move strips into meta strips with no side effects like change of selection state. Reviewed By: ISS Differential Revision: https://developer.blender.org/D10759
This commit is contained in:
parent
01f028a677
commit
4158405c0b
|
@ -81,6 +81,23 @@ static void rna_Sequence_swap_internal(Sequence *seq_self,
|
|||
}
|
||||
}
|
||||
|
||||
static void rna_Sequences_move_strip_to_meta(ID *id,
|
||||
Sequence *seq_self,
|
||||
Main *bmain,
|
||||
Sequence *meta_dst)
|
||||
{
|
||||
Scene *scene = (Scene *)id;
|
||||
|
||||
/* Move strip to meta */
|
||||
SEQ_edit_move_strip_to_meta(scene, seq_self, meta_dst);
|
||||
|
||||
/* Udate depsgraph */
|
||||
DEG_relations_tag_update(bmain);
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
|
||||
|
||||
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
|
||||
}
|
||||
|
||||
static Sequence *rna_Sequences_new_clip(ID *id,
|
||||
ListBase *seqbase,
|
||||
Main *bmain,
|
||||
|
@ -607,6 +624,11 @@ void RNA_api_sequence_strip(StructRNA *srna)
|
|||
parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "move_to_meta", "rna_Sequences_move_strip_to_meta");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
|
||||
parm = RNA_def_pointer(func, "meta_sequence", "Sequence", "Destination Meta Sequence", "Meta to move the strip into");
|
||||
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
|
||||
|
||||
func = RNA_def_function(srna, "invalidate_cache", "rna_Sequence_invalidate_cache_rnafunc");
|
||||
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
|
||||
RNA_def_function_ui_description(func,
|
||||
|
|
|
@ -33,6 +33,9 @@ struct Scene;
|
|||
struct Sequence;
|
||||
|
||||
int SEQ_edit_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char **error_str);
|
||||
int SEQ_edit_move_strip_to_meta(struct Scene *scene,
|
||||
struct Sequence *src_seq,
|
||||
struct Sequence *dst_seqm);
|
||||
void SEQ_edit_flag_for_removal(struct Scene *scene,
|
||||
struct ListBase *seqbase,
|
||||
struct Sequence *seq);
|
||||
|
|
|
@ -43,9 +43,11 @@
|
|||
#include "SEQ_add.h"
|
||||
#include "SEQ_edit.h"
|
||||
#include "SEQ_effects.h"
|
||||
#include "SEQ_relations.h"
|
||||
#include "SEQ_sequencer.h"
|
||||
#include "SEQ_time.h"
|
||||
#include "SEQ_transform.h"
|
||||
#include "SEQ_utils.h"
|
||||
|
||||
int SEQ_edit_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
|
||||
{
|
||||
|
@ -102,6 +104,26 @@ int SEQ_edit_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_
|
|||
return 1;
|
||||
}
|
||||
|
||||
int SEQ_edit_move_strip_to_meta(Scene *scene, Sequence *src_seq, Sequence *dst_seqm)
|
||||
{
|
||||
/* Find the appropriate seqbase */
|
||||
Editing *ed = SEQ_editing_get(scene, false);
|
||||
ListBase *seqbase = SEQ_get_seqbase_by_seq(&ed->seqbase, src_seq);
|
||||
|
||||
/* Move to meta */
|
||||
BLI_remlink(seqbase, src_seq);
|
||||
BLI_addtail(&dst_seqm->seqbase, src_seq);
|
||||
SEQ_relations_invalidate_cache_preprocessed(scene, src_seq);
|
||||
|
||||
/* Update meta */
|
||||
SEQ_time_update_sequence(scene, dst_seqm);
|
||||
if (SEQ_transform_test_overlap(&dst_seqm->seqbase, src_seq)) {
|
||||
SEQ_transform_seqbase_shuffle(&dst_seqm->seqbase, src_seq, scene);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, int mute)
|
||||
{
|
||||
Sequence *seq;
|
||||
|
|
Loading…
Reference in New Issue