From 4e0fd7fff11b76e52a5f11ba8704028c9b3c3ab0 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Tue, 23 Mar 2021 10:49:48 +0100 Subject: VSE: Sanitize move_to_meta usage There were multiple cases that could lead to problems like moving meta strip into itself or into it's children meta strips. Print error string to console when invalid action is requested. --- source/blender/makesrna/intern/rna_sequencer_api.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 1fb0e502ec6..a49a404fe6c 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -81,15 +81,16 @@ 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) +static void rna_Sequences_move_strip_to_meta( + ID *id, Sequence *seq_self, Main *bmain, ReportList *reports, Sequence *meta_dst) { Scene *scene = (Scene *)id; + const char *error_msg; /* Move strip to meta. */ - SEQ_edit_move_strip_to_meta(scene, seq_self, meta_dst); + if (!SEQ_edit_move_strip_to_meta(scene, seq_self, meta_dst, &error_msg)) { + BKE_report(reports, RPT_ERROR, error_msg); + } /* Update depsgraph. */ DEG_relations_tag_update(bmain); @@ -651,7 +652,7 @@ void RNA_api_sequence_strip(StructRNA *srna) 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); + RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID | FUNC_USE_MAIN); parm = RNA_def_pointer(func, "meta_sequence", "Sequence", -- cgit v1.2.3