diff options
author | FĂ©lix <Miadim> | 2021-03-20 01:55:39 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-03-20 03:40:53 +0300 |
commit | bfad8deb0be0d014b5e05c7e1af564acb3d494d1 (patch) | |
tree | e035210f0f0d4c3cd1a19870ea5d1183aa8ae825 /source/blender/makesrna/intern | |
parent | 4158405c0b9d32dd0c6cc1844bc06561b8513766 (diff) |
VSE: Add new_meta RNA API function
This function can be used to create empty meta strip, which is not
straightforward when using operators. Very useful for import/export
scripts.
Reviewed By: ISS
Differential Revision: https://developer.blender.org/D10661
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer_api.c | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 04ca3cfdb32..a6a0e9d3dcd 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -382,6 +382,32 @@ static Sequence *rna_Sequences_meta_new_sound(ID *id, id, &seq->seqbase, bmain, reports, name, file, channel, frame_start); } +/* Meta sequence + * Possibility to create an empty meta to avoid plenty of meta toggling + * Created meta have a length equal to 1, must be set through the API. */ +static Sequence *rna_Sequences_new_meta( + ID *id, ListBase *seqbase, const char *name, int channel, int frame_start) +{ + Scene *scene = (Scene *)id; + SeqLoadData load_data; + SEQ_add_load_data_init(&load_data, name, NULL, frame_start, channel); + Sequence *seqm = SEQ_add_meta_strip(scene, seqbase, &load_data); + + return seqm; +} + +static Sequence *rna_Sequences_editing_new_meta( + ID *id, Editing *ed, const char *name, int channel, int frame_start) +{ + return rna_Sequences_new_meta(id, &ed->seqbase, name, channel, frame_start); +} + +static Sequence *rna_Sequences_meta_new_meta( + ID *id, Sequence *seq, const char *name, int channel, int frame_start) +{ + return rna_Sequences_new_meta(id, &seq->seqbase, name, channel, frame_start); +} + static Sequence *rna_Sequences_new_effect(ID *id, ListBase *seqbase, ReportList *reports, @@ -626,7 +652,11 @@ void RNA_api_sequence_strip(StructRNA *srna) 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"); + 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"); @@ -699,6 +729,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri const char *new_image_func_name = "rna_Sequences_editing_new_image"; const char *new_movie_func_name = "rna_Sequences_editing_new_movie"; const char *new_sound_func_name = "rna_Sequences_editing_new_sound"; + const char *new_meta_func_name = "rna_Sequences_editing_new_meta"; const char *new_effect_func_name = "rna_Sequences_editing_new_effect"; const char *remove_func_name = "rna_Sequences_editing_remove"; @@ -713,6 +744,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri new_image_func_name = "rna_Sequences_meta_new_image"; new_movie_func_name = "rna_Sequences_meta_new_movie"; new_sound_func_name = "rna_Sequences_meta_new_sound"; + new_meta_func_name = "rna_Sequences_meta_new_meta"; new_effect_func_name = "rna_Sequences_meta_new_effect"; remove_func_name = "rna_Sequences_meta_remove"; } @@ -868,6 +900,28 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastri parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); RNA_def_function_return(func, parm); + func = RNA_def_function(srna, "new_meta", new_meta_func_name); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + RNA_def_function_ui_description(func, "Add a new meta sequence"); + parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_int( + func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_int(func, + "frame_start", + 0, + -MAXFRAME, + MAXFRAME, + "", + "The start frame for the new sequence", + -MAXFRAME, + MAXFRAME); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + /* return type */ + parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence"); + RNA_def_function_return(func, parm); + func = RNA_def_function(srna, "new_effect", new_effect_func_name); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); RNA_def_function_ui_description(func, "Add a new effect sequence"); |