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.
This commit is contained in:
2021-03-23 10:49:48 +01:00
parent d375889298
commit 4e0fd7fff1
3 changed files with 77 additions and 29 deletions

View File

@@ -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",