Note: This is initial proposal aimed to gather feedback. It is subject to change.
This is task to coordinate restructurization of majority of VSE code.
Goal is to break existing code to smaller files with relatively narrow scope, create layer isolating low-level BKE code from functions close to user (operators, RNA, drawing). There should be minimum functional changes in first stages, followed by cleanups with minor functional changes if necessary (logic consolidation).
- Maintainability in general
- To allow work on T59540, where it is important for drawing, RNA and operator code to follow exact same logic to produce correct results.
- Make it easier and cleaner to make changes in rendering code
Since this will be relatively large operation, it will have to be done in few stages:
# Move rendering code from BKE.
# Move rest of high level code from BKE.
# Move as much as possible lower-level code from operators and RNA.
# Refactor operator and RNA code moving remaining low-level logic. Aim for limiting logic to iteration and calling sets of functions from "libraries".
Because I am involved in triaging mostly, I think that these patches will be spread out over few months. Refactors will be likely fast, final cleanup not so much. I think that precondition for this task is to fix as much bugs as possible. I have marked them with #2.90 tag.
sequencer.c cleanup, primitive functions mostly to alloc/free stuff
space_sequencer.c no change, space code
sequencer_add.c simplify logic / cleanup
sequencer_buttons.c simplify logic / cleanup
sequencer_modifier.c simplify logic / cleanup
sequencer_ops.c simplify logic / cleanup
sequencer_preview.c simplify logic / cleanup
sequencer_select.c simplify logic / cleanup
sequencer_view.c simplify logic / cleanup
sequencer_draw.c I could break up to timeline and preview specific functions, otherwise little changes.
sequencer_scopes.c no change most likely
sequencer_render.c new file, general render pipeline
sequencer_render_effects.c no change likely, effect strips
sequencer_render_modifier.c no change likely, modifiers
sequencer_render_cache.c little changes, image cache
sequencer_render_prefetch.c little changes, prefetching
sequencer_strips_select.c new file, handle selection
sequencer_strips_add.c new file, create strips
sequencer_strips_transform.c new file, move strips / content
sequencer_strips_edit.c new file, cutting strips, duplicating, changing properties
sequencer_strips_hierarchy.c new file, traversing, relations, checks
sequencer_strips_util.c new file, functions, that doesn't really fit anywhere else, this file should be kept small
Things to clarify:
- Structure is not really finalized, if during refactoring process file still feels like mixed mag, I may split it to more categories.
- I am not sure if proposed structure is OK - I don't see any subdirectories in `bf_editor_xxx`. I would like to have something at least resembling proposed structure. I guess `sequencer_category_subcategory.c` could be used?
- Should functions in `strips` category have `ED_` prefix? They are really meant to be a middle layer between BKE and operators.
- Scale and scope of patches. for example 1 patch per file or 1 patch per "category"