Page MenuHome

VSE: Refactor VSE strip loading code
ClosedPublic

Authored by Richard Antalik (ISS) on Dec 6 2020, 1:48 PM.

Details

Summary

Isolate RNA and operator logic from functions that create strips.

  • Operator specific code was removed from SeqLoadInfo structure and SEQ_add_* functions.
  • Strip loading code was removed from RNA and operator functions.
  • SEQ_add_* API was unified to work on SeqLoadData struct. Only exception is image strip, which require files to be loaded separately to strip creation itself. This is not ideal, but I think it's acceptable.
  • Some functions and variables were refactored so the code reads better.

There are minor functional changes (coincidental bugfixes):

  • Operator errors are reported per-strip. Previously they were not reported at all?
  • new_sound() RNA API function now create sound with length of 1 if source file does not exist. Previously it created strip with length of 0.
  • Replace selection operator property wasn't working correctly. Fixed in this patch.

Diff Detail

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

Event Timeline

Richard Antalik (ISS) requested review of this revision.Dec 6 2020, 1:48 PM
  • Resolve todos and cleanup
Richard Antalik (ISS) retitled this revision from De-duplicate RNA API and operator strip load functions to VSE: Rewrite strip loading code.Dec 6 2020, 4:14 PM
Richard Antalik (ISS) edited the summary of this revision. (Show Details)
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Dec 14 2020, 3:23 PM
Richard Antalik (ISS) edited the summary of this revision. (Show Details)
  • Correct error reporting, so it is more consistent with previous behavior
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Jan 3 2021, 1:14 AM
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Feb 4 2021, 4:07 PM
Richard Antalik (ISS) edited the summary of this revision. (Show Details)Feb 5 2021, 11:28 AM

There are some suggestions in the code.

Would also think that the commit message needs to be clarified. Think it will be more clear to title it as Refactor VSE strip loading code. Makes it explicit that it's a house-keeping change which does not really affect user land.

source/blender/editors/space_sequencer/sequencer_add.c
690

const

692

I would personally split those branches into sequencer_add_sound_single_strip and sequencer_add_sound_multiple_strips. Reduces vertical space of the operator and limits function to a more dedicated functionality.

source/blender/sequencer/SEQ_add.h
48–56 ↗(On Diff #33456)

For clarity you can use nested structs, to separate the fields in a way that it is clear from reading just code without seeing the comment.

For example,

struct {
  int type;
  int end_frame;
  struct Sequence *seq1;
  struct Sequence *seq2;
  struct Sequence *seq3;
} effect;
Richard Antalik (ISS) marked 3 inline comments as done.
  • Address inlines
Richard Antalik (ISS) retitled this revision from VSE: Rewrite strip loading code to VSE: Refactor VSE strip loading code.Mar 1 2021, 9:24 AM

To me sounds fine.

This revision is now accepted and ready to land.Mar 1 2021, 4:35 PM
This revision was automatically updated to reflect the committed changes.