Page MenuHome

VSE: Refactor delete operator and API
ClosedPublic

Authored by Richard Antalik (ISS) on Feb 19 2020, 6:57 PM.

Details

Summary

Operator logic is limited to iterating over selection and executing
same code as python API does.

Functional changes:

  • No attempt to preserve effects is made, but this can be re-introduced. Dependant effects are deleted.
  • No attempt to change meta strip boundaries, but this can be re-introduced as well.
  • Python API calls delete function with current seqbase rather than topmost sequence. This will allow to delete strips in meta strips, though meta has to be viewed first, so it's still quite cumbersome. I could look for strip in metas if it could not be found in topmost seqbase.

Partially fixes T73828

Diff Detail

Repository
rB Blender
Branch
arcpatch-D6892_1 (branched from master)
Build Status
Buildable 9032
Build 9032: arc lint + arc unit

Event Timeline

Jacques Lucke (JacquesLucke) added inline comments.
source/blender/blenkernel/intern/sequencer.c
6016

Looks like this should be two separate functions. One where flag_only is assumed to be true and one where it is false.

Richard Antalik (ISS) marked an inline comment as done.
  • Split BKE_sequencer_remove_sequence(..., bool) to specific functions
Campbell Barton (campbellbarton) requested changes to this revision.Jun 2 2020, 5:28 AM

From the Python side, I'd rather the API be less arbitrary supporting metastrip.remove(strip) as well as editor.sequences.remove(strip).
Otherwise the code will be slow and bugs harder to detect, because it's not clear where the data will be removed from.

source/blender/blenkernel/intern/sequencer.c
5990

For this loop, and the loop below - it's more common to use a for loop.

for (Node *node = list.first, *node_next; node; node = node_next) {
  node_next = node->next;

  /* Code */
}

This has the advantage the looping logic is centralized in one place and you can use continue without causing problems.

Or you could use LISTBASE_FOREACH_MUTABLE.

6028

Using the safe version of this function causes a list search.

Since this is looping on the seqbase there is no need to do this.

6034

The purpose of this return value isn't clear, since this is the success of the last call to BLI_remlink_safe.

Should this be "all succeeded" "any succeeded" ?

6037

This does remove sequences by calling BKE_sequencer_remove_flagged_sequences.

Where the function is named as if it's only tagging.

source/blender/makesrna/intern/rna_sequencer_api.c
373–377

This changes behavior of remove, making it context dependent, which I'd rather avoid in scripting.

Also, we should support writing scripts that don't cause an excessive amount of searching.

Instead, we could have meta-strip remove method.

This revision now requires changes to proceed.Jun 2 2020, 5:28 AM
Richard Antalik (ISS) marked 4 inline comments as done.
  • Address inlines
source/blender/blenkernel/intern/sequencer.c
6034

Though thinking about this, if seq pointer was invalid, this would fail when calling BKE_sequencer_flag_for_removal() So we have to validate pointer in rna_Sequences_remove()

source/blender/makesrna/intern/rna_sequencer_api.c
373–377

I would like to do this, but I am not sure if it is possible to pass correct seqbase to rna_Sequences_remove() if called from metastrip remove method. In such case we probably could add RNA_api_sequences to rna_def_meta so it has all features.

From the Python side, I'd rather the API be less arbitrary supporting metastrip.remove(strip) as well as editor.sequences.remove(strip).
Otherwise the code will be slow and bugs harder to detect, because it's not clear where the data will be removed from.

This point is still not addressed. I am not sure if that is even possible now so I can drop that change.

Richard Antalik (ISS) marked an inline comment as done.
  • Revert changes in rna_Sequences_remove
This revision is now accepted and ready to land.Jul 21 2020, 12:43 PM
This revision was automatically updated to reflect the committed changes.