Commit Graph

46 Commits

Author SHA1 Message Date
John Kiril Swenson
35cab63eaf Cleanup: VSE: Rename Strip::machine to channel
This should make VSE code more readable and easier to understand from an
outside perspective.

The name was chosen to be `channel` rather than `channel_index` to keep
things short and concise -- it should be clear based on the context
whether we are talking about the strip's channel index (singular case,
`Strip::channel` or `SeqTimelineChannel::index`) vs. the channel list
(plural case, e.g. `Editing::channels`).

Pull Request: https://projects.blender.org/blender/blender/pulls/138919
2025-05-21 19:13:20 +02:00
John Kiril Swenson
2ab59859c9 Cleanup: VSE: Replace remaining seq and sequence references
Ref: #132179

Renames:
- `Editing.act_seq` -> `Editing.act_strip`
- `SequenceModifierData` -> `StripModifierData`
  - Its member `mask_sequence` is now `mask_strip`.
- `MetaStack.parseq` -> `MetaStack.parent_strip`
- Remaining function names/parameters that were not dealt with in #132748
- Various references to `seq` or `sequence` throughout code and docs when
  referring to a strip

Also moves `_get` to the end of the renamed function names where
applicable for standardization (unless "by" or "from" are used).

There should be no changes to current behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/138077
2025-05-01 00:22:04 +02:00
Richard Antalik
dfea0628c4 Cleanup: VSE: Use cached meta lookup
Some old code used to iterate over all strips to find metas. Use
`seq::lookup_meta_by_strip` instead, since it is cached.

Pull Request: https://projects.blender.org/blender/blender/pulls/136406
2025-03-24 19:11:44 +01:00
Bastien Montagne
1d76cbab64 Cleanup: sequencer: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/135747
2025-03-10 17:16:43 +01:00
Richard Antalik
68abed543b Refactor: Remove module prefix form symbols in sequnecer namespaces
Remove
SEQ_ prefix for blender::seq namespace and
ED_sequencer for blender::ed::vse namespace

Pull Request: https://projects.blender.org/blender/blender/pulls/135560
2025-03-06 13:04:39 +01:00
Richard Antalik
a08246a1a2 Refactor: Move VSE code to namespaces
This PR creates 2 namespaces for VSE code:
- `blender::seq` for sequencer core code
- `blender::ed::vse` for editor code

These names are chosen to not be in conflict with each other.
No namespace was used for RNA.

Finally, file `BKE_sequencer_offscreen.h` was moved from BKE to sequencer.

Pull Request: https://projects.blender.org/blender/blender/pulls/135500
2025-03-06 06:22:14 +01:00
Aras Pranckevicius
cc2c6692c0 Cleanup: Name more IMB things as "byte" or "float" instead of "rect" and "rectFloat"
- IB_rect -> IB_byte_data
- IB_rectfloat -> IB_float_data
- Rename some functions:
	- IMB_get_rect_len -> IMB_get_pixel_count
	- IMB_rect_from_float -> IMB_byte_from_float
	- IMB_float_from_rect_ex -> IMB_float_from_byte_ex
	- IMB_float_from_rect -> IMB_float_from_byte
	- imb_addrectImBuf -> IMB_alloc_byte_pixels
	- imb_freerectImBuf -> IMB_free_byte_pixels
	- imb_addrectfloatImBuf -> IMB_alloc_float_pixels
	- imb_freerectfloatImBuf -> IMB_free_float_pixels
	- imb_freemipmapImBuf -> IMB_free_mipmaps
	- imb_freerectImbuf_all -> IMB_free_all_data
- Remove IB_multiview (not used at all)
- Remove obsolete "module" comments in public IMB headers

Pull Request: https://projects.blender.org/blender/blender/pulls/135348
2025-03-03 17:11:45 +01:00
Falk David
c47a4b1e13 Refactor: VSE: Remove scene dependency of SEQ_lookup_* functions
Instead of passing the `scene`, pass a pointer to the `Editing` struct.
This is the struct that owns the `StripLookup` in its `runtime`
so there isn't a good reason to use the `scene` pointer here
anyways.

Pull Request: https://projects.blender.org/blender/blender/pulls/134743
2025-02-18 15:16:20 +01:00
Brecht Van Lommel
c7a33a62a2 Cleanup: Directly include DNA_userdef_types.h and BLI_listbase.h
Instead of relying on them being included indirectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134406
2025-02-12 23:01:08 +01:00
Aras Pranckevicius
4f0fd32d6f VSE: Over Drop effect was not doing anything useful, map it to Alpha Over
Behavior of it was exactly the same as Alpha Over for the last 18 years (since
327d413eb3 in 2006 March), so just remap it to regular alpha over on file read.

Pull Request: https://projects.blender.org/blender/blender/pulls/134342
2025-02-10 16:10:01 +01:00
Bastien Montagne
87a4c0d3a8 Refactor: Make Library.runtime an allocated pointer.
Move `Library.runtime` to be a pointer, move the related
`LibraryRuntime` struct to `BKE_library.hh`. Similar to e.g.
Mesh.runtime, that pointer is expected to always be valid, and is
allocated at readtime or when creating a new Library ID.

Related smaller changes:
* Write code now uses standard ID writing codepath for Library IDs too.
  * Runtime pointer is reset to nullptr before writing.
* Looking up a library by its absolute path is now handled through a
  dedicated utils, `search_filepath_abs`, instead of using
  `BLI_findstring`.

Pull Request: https://projects.blender.org/blender/blender/pulls/134188
2025-02-07 17:47:16 +01:00
Falk David
b9f253564e VSE: Python API: Deprecate sequence properties and replace with new ones
This PR adds new RNA properties that deprecate and replace any `sequence` property.
The old prooperties are still there and fully functional, but the description is changed
to indicate that these will be removed in the future and that the new properties should
be used instead.

| Deprecated property | Replacement property |
| --------------------------------- | ----------------------------------- |
| `context.active_sequence_strip` | `context.active_strip` |
| `context.selected_editable_sequences` | `context.selected_editable_strips` |
| `context.selected_sequences` | `context.selected_strips` |
| `context.sequences` | `context.strips` |
| `SequenceEditor.sequences` | `SequenceEditor.strips` |
| `SequenceEditor.sequences_all` |  `SequenceEditor.strips_all` |
| `MetaStrip.sequences` | `MetaStrip.strips` |

Previously, rna paths for animation data on strips started with `sequence_editor.sequences`.
This PRadds versioning for the rna paths to make sure to use
the new naming scheme. This does mean that in previous versions of blender,
the animations don't show but the data is not lost (even if the file is saved in the older version).

Also do some cleanup of existing python scripts inside the source to use the
new properties.

Part of #132963.

Pull Request: https://projects.blender.org/blender/blender/pulls/133156
2025-01-21 11:30:20 +01:00
Falk David
63d3573c2b Cleanup: VSE: Rename occurences of sequence in lookup code
Rename `sequence` -> `strip` for all the lookup code for strips.
2025-01-07 17:04:00 +01:00
Falk David
32a1de9f78 Cleanup: VSE: Rename SEQ macros to STRIP
Rename `SEQ` macros (that refer to strips) to `STRIP`.
2025-01-07 17:04:00 +01:00
Falk David
ff91c27481 Cleanup: VSE: Rename SequenceType to StripType as well as flags
Rename the flags from `SEQ_TYPE_*` to `STRIP_TYPE_*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132753
2025-01-07 16:10:36 +01:00
Falk David
82cfa92233 Cleanup: VSE: Rename seq_ functions/variables to strip_
This should only rename functions and variables that are
referring to (operations on) a single `Strip`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132748
2025-01-07 16:03:11 +01:00
Falk David
8541296e9d Cleanup: VSE: Rename Strip *seq variables to strip
This only renames variables named `seq` and not other variants,
like `seq_*` or `seq1`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132736
2025-01-07 14:09:45 +01:00
Brecht Van Lommel
920e709069 Refactor: Make header files more clangd and clang-tidy friendly
When using clangd or running clang-tidy on headers there are
currently many errors. These are noisy in IDEs, make auto fixes
impossible, and break features like code completion, refactoring
and navigation.

This makes source/blender headers work by themselves, which is
generally the goal anyway. But #includes and forward declarations
were often incomplete.

* Add #includes and forward declarations
* Add IWYU pragma: export in a few places
* Remove some unused #includes (but there are many more)
* Tweak ShaderCreateInfo macros to work better with clangd

Some types of headers still have errors, these could be fixed or
worked around with more investigation. Mostly preprocessor
template headers like NOD_static_types.h.

Note that that disabling WITH_UNITY_BUILD is required for clangd to
work properly, otherwise compile_commands.json does not contain
the information for the relevant source files.

For more details see the developer docs:
https://developer.blender.org/docs/handbook/tooling/clangd/

Pull Request: https://projects.blender.org/blender/blender/pulls/132608
2025-01-07 12:39:13 +01:00
Falk David
655a17a6ab Refactor: VSE: Rename Sequence to Strip
This renames the struct `Sequence` to `Strip`.

While the motivation for this partially comes from
the "Sequence Design" #131329, it seems like this
is a good refactor whether the design gets implemented
or not.

The `Sequence` represents what users see as strips in the
VSE. Many places in the code already refere to a `Sequence`
as "strip". It's the C-style "base class" of all strip types.

This also renames the python RNA type `bpy.types.Sequence`
to `bpy.types.Strip` which means that this technically breaks
the python API.

Pull Request: https://projects.blender.org/blender/blender/pulls/132179
2025-01-06 14:19:24 +01:00
Falk David
a7d3ced570 Refactor: VSE: Rename Strip to StripData
This renames the `Strip` struct to `StripData` and also renames
the `Sequence::strip` member to `Sequence::data`.

This is a first step towards naming the `Sequence` struct to `Strip`.

Pull Request: https://projects.blender.org/blender/blender/pulls/132165
2024-12-20 18:02:31 +01:00
Aras Pranckevicius
e99252d7fd Refactor: more cleanups and renamed to movie/ffmpeg related files
- All movie related public headers now have MOV_ prefix instead of
  IMB_movie_.
- All movie related public functions now have MOV_ prefix as well,
  instead of IMB_movie_ or IMB_anim_.
- IMB_anim.hh -> MOV_read.hh (also ImBufAnim -> MovieReader), and
  various utility functions not related to playback were split off
  into MOV_util.hh.
- Other function name tweaks for clarity, e.g. IMB_suffix_anim
  -> MOV_set_multiview_suffix and so on.
- All except one usages of MOV_get_fps (nee IMB_anim_get_fps) were
  ultimately just converting returned value into a float. So make
  MOV_get_fps just return that directly. For the (exactly just one)
  place that needs numerator and denominator, have
  MOV_get_fps_num_denom.
- Code comments on the public header functions.
- Removed never-used code paths inside movie timecode proxy building
  file.

It might be easier to review each commit separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/132145
2024-12-20 13:23:08 +01:00
Aras Pranckevicius
974efe7d23 Refactor: move ffmpeg/video related code into one place
Previously, code related to reading/writing movie files via ffmpeg was
scattered around: some under blenkernel, some directly in generic
imbuf headers, some under intern/ffmpeg. Some of the files were named
with not exactly clear names. Some parts not directly related to movies
were including ffmpeg headers directly (rna_scene.cc).

What is in this PR:

Movie and ffmpeg related code is now under imbuf/movie:
- IMB_anim.hh: movie reading, proxy querying, various utility functions.
- IMB_movie_enums.hh: simple enum definitions,
- IMB_movie_write.hh: movie writing functions.
- intern: actual implementation and private headers.
    - ffmpeg_compat.h: various ffmpeg version difference handling
      utilities,
    - ffmpeg_swscale.hh/cc: scaling and format conversion utilities
      for ffmpeg libswscale,
    - ffmpeg_util.hh/cc: misc utilities related to ffmpeg,
    - movie_proxy_indexer.hh/cc: proxies and timecode indexing for movies,
    - movie_read.hh/cc: decoding of movies into images,
    - movie_write.cc: encoding of images into movies.
- tests: basic ffmpeg library unit tests that previously
  lived under intern/ffmpeg.

Interface changes (at C++ level, no Python API changes):
- Mostly just movie related functions that were BKE_ previously, are now IMB_.
- I did one large-ish change though, and that is to remove bMovieHandle
  struct that had pointers to several functions. Now that is
  IMB_movie_write_begin, IMB_movie_write_append, IMB_movie_write_end
  functions using a single opaque struct handle. As a result, usages
  of that in pipeline.cc and render_opengl.cc have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132074
2024-12-19 12:34:30 +01:00
Bastien Montagne
0b3a7cbe69 Cleanup: Move BKE_image.h and related headers to C++.
NOTE: This also required some changes to Cycles code itself, who is now
directly including `BKE_image.hh` instead of declaring a few prototypes
of these functions in its `blender/utils.h` header (due to C++ functions
names mangling, this was not working anymore).

Pull Request: https://projects.blender.org/blender/blender/pulls/130174
2024-11-12 16:53:54 +01:00
Aras Pranckevicius
754495247b VSE: Speedup drawing of the timeline channels sidebar
Drawing the list of channels on the left side of VSE timeline was taking
surprisingly long time (3.5ms in Sprite Fright Edit v135 on Mac M1 Max).
This PR makes them draw in 0.4ms, i.e. 10x faster, by doing two things:

- Stop "search through the whole timeline" work whenever we need to know
  which meta strip (if any) owns some VSE channel. Remember that info in
  the "sequence lookup" that already holds data to speedup similar queries
  (sequence by name, meta by sequence). I.e. this gains "channel owner by
  channel" query hashtable.
- Stop alternating between "regular font glyph cache" and "svg icons glyph
  cache" on each channel row, which incurs a draw call / UI batch flush.
  Instead, draw all the lock/mute widgets first, then all the channel names.

While at it, simplify code related to sequence lookup:
- Use C++ mutex with lock_guard
- Use BLI Map instead of GHash
- Simplify SEQ_sequence_lookup_tag to just SEQ_sequence_lookup_invalidate
- Remove unused SEQ_get_meta_by_seqbase and SEQ_query_all_meta_strips_recursive

Pull Request: https://projects.blender.org/blender/blender/pulls/127913
2024-09-21 14:30:48 +02:00
Pablo Vazquez
c2991a1751 VSE: Adjust label of subtract/multiply effect strip
When adding new effect strips, label "Subtract" instead of "Sub",
and "Multiply" instead of "Mul".
2024-06-19 19:44:43 +02:00
Aras Pranckevicius
31e56797f0 VSE: indicate missing media in timeline/display
Sequencer timeline displays red tint & appropriate icons for strips that are
missing media file (images, movies, audio, or meta strips that contain such).

Sequencer preview and rendering displays missing media strips as magenta,
similar to missing textures elsewhere in Blender. This is on by default,
sequencer view settings have an option to turn it off.

Pull Request: https://projects.blender.org/blender/blender/pulls/116869
2024-04-24 19:54:44 +02:00
Aras Pranckevicius
c64050ecd2 VSE: Timeline strip visual design updates
Design updates as per #118288:
- Tweak text labels (colors, drop shadows)
- Strip border colors, inset outlines
- Muted strips are mostly gray, and their thumbnails are faded
- Overlapping strips are not semitransparent anymore
- Locked stripes only in content area
- Missing data blocks
- Updates to meta strips w/ missing data blocks

Pull Request: https://projects.blender.org/blender/blender/pulls/118581
2024-04-24 12:37:38 +02:00
Campbell Barton
b2e00d1285 Cleanup: use const pointer arguments 2024-03-28 20:57:50 +11:00
Richard Antalik
fc32b9c5dd Fix: Crash when multiview movie right view is missing.
Ultimately this was due to missing nullptr check before trying to
process the image, but this should have been caught when loading
ImBufAnims. If any is missing, cancel multiview loading and load
movie as if it was single view only.
2024-03-02 18:12:47 +01:00
Richard Antalik
d4925b9775 Cleanup: Refactor VSE movie loading
Original code was very confusing, with seemingly indecisive logic.
I hope, that it is less confusing now, however there is still some
indecisiveness present. This is because multiview configuration may not
be correct, so there must be fallback and only some multiview settings
require loading of multiple files. Perhaps be better wording could be
used for `open_anim_file_multiview()`.
Fortunately this is now expressed within 5 lines of code instead of 100.

Further this can be improved by checking if the file exists, since now
VSE crashes when right eye image is missing, because loading code
does not try to actually open the file.

Pull Request: https://projects.blender.org/blender/blender/pulls/118580
2024-02-22 17:48:40 +01:00
Campbell Barton
fee47f6da8 Cleanup: unused includes in source/blender/sequencer
Remove 95 includes.
2024-02-13 13:37:56 +11:00
Bastien Montagne
5aaadebbe4 Cleanup: Make BKE_scene.h a full Cpp header. 2024-02-10 19:16:25 +01:00
Bastien Montagne
45e7827898 Clenup: Move BLT headers to Cpp.
Noisy but fairly straight forward.
2024-02-09 18:59:42 +01:00
Hans Goudey
0618de49ad Cleanup: Replace MIN/MAX macros with C++ functions
Use `std::min` and `std::max` instead. Though keep MIN2 and MAX2
just for C code that hasn't been moved to C++ yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/117384
2024-01-22 15:58:18 +01:00
Aras Pranckevicius
a705259b4b Cleanup: move imbuf .h files to .hh 2024-01-19 20:29:38 +01:00
Bastien Montagne
3acb64e7ac BKE_main: move header to be a fully CPP one.
Pull Request: https://projects.blender.org/blender/blender/pulls/115681
2023-12-01 20:38:54 +01:00
Aras Pranckevicius
df16f4931e VSE: speedup timeline drawing, and improve waveform display
Sequencer timeline UI repainting is 3x-4x faster now, for complex
timelines. On Sprite Fright Edit data set, with whole timeline visible
(2702 strips), repainting the timeline UI with all overlay options
(waveforms, offsets, thumbnails etc.):

- Windows (Ryzen 5950X, RTX 3080Ti, OpenGL): 62ms -> 18.6ms (16FPS -> 54FPS)
- Mac (M1 Max, Metal): 39.8ms -> 11.5ms (25FPS -> 86FPS)

This is achieved by:

- Avoiding tiny GPU draw calls (i.e. drawing one quad a time), instead
  batch all the quads / lines needed by the timeline display into
  series of about-1000 quads per draw.
- For retiming keys display, batch their keyframe point drawing too.
- For audio waveform overlay display, change it to draw batched quads
  instead of alternating between line strips and triangle strips. This
  actually changes how the waveform looks like (implements #115274)
  and fixes some visual issues with waveforms too.
- For fcurve overlays, also draw them as batched quads.

While at it, this also fixes an issue where while dragging strips over
other strips, their text labels would look as if they are behind the
background strips.

Pull Request: https://projects.blender.org/blender/blender/pulls/115311
2023-11-29 20:25:21 +01:00
Richard Antalik
3fccfe0bc6 VSE: Use C++ containers for strip iteration
Use `VectorSet`, `Vector` or `Span` instead of `SeqCollection` struct.
It is now possible to use native `for` loops and `SEQ_ITERATOR_FOREACH`
macro can be removed.

Another feature is, sets of strips no longer needs to be freed. However,
this poses a limitation, that query functions can not be used in case,
where these sets need to be available outside of scope where they are
created.

Pull Request: https://projects.blender.org/blender/blender/pulls/111909
2023-11-06 01:36:44 +01:00
Richard Antalik
4d37fb80b1 Cleanup: Convert VSE headers from .h to .hh 2023-11-03 01:33:54 +01:00
Damien Picard
564bbdf6e7 I18n: disambiguate and extract a few messages
This commit disambiguates the following messages:

- Sequencer effect strip types: use "Sequence" context in relevant
  places, as that is already extracted as part of the
  `sequencer_prop_effect_types` enum, and more specific.
- "Language" (a natural or programming language)
- "Flat" (gender)
- "Smooth" (action or amount -- very partial disambiguation for now
  because this is all over the place)

It also extracts these messages:

- Newly created Freestyle data
  - LineStyle
  - LineSet
  - Modifiers
- "Registering panel class:" error message from RNA registration
- "Node must be run as tool" error message from tool geometry nodes

Ref #43295

Pull Request: https://projects.blender.org/blender/blender/pulls/111146
2023-09-04 16:16:26 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Campbell Barton
adf58a77ff Cleanup: use LISTBASE_FOREACH & LISTBASE_FOREACH_BACKWARD macros 2023-08-04 08:51:13 +10:00
Campbell Barton
302887c619 Cleanup: use boolean literals in source/
Apply clang-tidy modernize-use-bool-literals to source/.
2023-07-22 11:43:01 +10:00
Campbell Barton
81ee130063 Cleanup: use C++ system headers
Apply clang-tidy modernize-deprecated-headers to source/
2023-07-22 11:27:25 +10:00
Campbell Barton
549848a0d8 Cleanup: various non-functional changes for C++
- Remove redundant void, struct.
- Use function style casts.
2023-07-20 20:35:49 +10:00
Jacques Lucke
9c10ba4117 Sequencer: move to C++
Also see #103343.

Pull Request: https://projects.blender.org/blender/blender/pulls/110273
2023-07-20 09:46:24 +02:00