Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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
Richard Antalik
618b7f4a9b Fix #130742 Scene render from VSE is taking twice as long
Regression caused by 5ecb70964e. This is, because renders of individual
strips could no longer be reused when cache is completely disabled
during rendering.

Instead of disabling cache completely, flag cache entries as temporary.
When reading entries also skip disk cache, since in 5ecb70964e goal was
to avoid reading from disk cache.

5ecb70964e also affected visual output of rendered image. This is
reported in #131106. Because of this 1 test must be updated.

Root cause for #131106 is, that byte image was automatically converted
to float, due to processing with other float image. Then the same byte
image was used for processing with another byte image. Before
5ecb70964e this byte converted to float image would be cached, which
caused float code paths to be used. This is correct behavior.
After 5ecb70964e, no image is cached, so float data were not saved, so
byte code path was executed in second processing step.

Pull Request: https://projects.blender.org/blender/blender/pulls/130781
2024-12-02 10:07:08 +01:00
Campbell Barton
9b39b4c91c Cleanup: use const pointers/references 2024-09-15 23:14:09 +10:00
Aras Pranckevicius
528471541b VSE: Faster and more consistent thumbnails
Implementing part of design outlined in #126087.

- VSE thumbnail cache has a new implementation, hopefully simpler
  and easier to understand.
    - Instead of cache key being a VSE strip, frame index, plus
      complicated logic for cache items linking etc.,
    - The cache is keyed by media file path (if multiple strips
      use the same input file, they will share cache entries), frame
      index within media file, and any extra data (e.g. steam index
      for multi-steam videos)
- Much reduced cache flickering and strange/weird thumbnail choices.
    - Likewise, thumbnails no longer disappear-and-reload on operations
      like Undo, dragging new video strip into timeline, or F12 render.
- Thumbnails now load faster.
    - Images use dedicated/faster thumbnail loading routines when a
      format can do that (e.g. JPG and EXR can).
    - Movies reuse ffmpeg decoding context for neighboring strips
      that use the same file (as often happens when cutting footage)
    - Thumbnail requests are processed on several threads now too.

Images and more detail in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/126405
2024-08-29 08:27:12 +02:00
Sergey Sharybin
06ce65d3b6 Fix: Crash in sequencer tests after recent commit
Also run clang-format on the file.

Ref #125947
2024-08-07 17:03:21 +02:00
Aras Pranckevicius
bcacb01d34 Cleanup: Make more VSE functions use const arguments where they can
SEQ_transform_sequence_can_be_translated, SEQ_transform_single_image_check,
SEQ_can_use_proxy can all trivially take const Sequence argument.

Made SEQ_give_frame_index take const Sequence too, by removing the
"modify seq strobe to be at least 1.0" code. The strobe itself is only
ever used inside the same function, and is already guarded by
"is strobe > 1.0" check.

Original code seems to be coming all the way from 2009 with
commit message "2.5. 12k lines of sequencer back!" (03fc5696dc).

Pull Request: https://projects.blender.org/blender/blender/pulls/126021
2024-08-07 15:53:06 +02:00
Richard Antalik
5ecb70964e Fix #125490: Scene strip incorrectly rendered as solid view.
Prevent VSE cache returning image when running render job.

Previously, before render job was started, cache was cleared, but since
disk cache is not cleared, it returned an image. Now cache is not
cleared, but it does not return or store images when rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/125947
2024-08-07 15:22:37 +02:00
Campbell Barton
004c247670 Cleanup: different declaration names, use r_ prefix for return args 2024-07-29 13:01:10 +10:00
Richard Antalik
6a39d79967 Fix #124767: VSE cache not updated for moved strips
The cache invalidation worked on basis of timeline frame instead of
frame index, which caused, that these images were outside of range, that
was considered to be changed, after strip was moved.

In this case the issue happened only with effect strips. This was not
an issue before, mainly because raw images for these strips were not
stored. For other strip types, raw image does not usually change.

This seems to be "caused" by f4f708a54f .

Pull Request: https://projects.blender.org/blender/blender/pulls/124870
2024-07-17 14:23:57 +02:00
Sebastian Parborg
221951657b VSE: Make cache overlay visible to non "Developer extras" users
This also moves the option to be a per editor space setting so you can
have different cache visualization options in different editor spaces
at the same time.

A quick toggle for the cache visualization is now available in the
overlays popover.

Pull Request: https://projects.blender.org/blender/blender/pulls/119428
2024-05-02 16:36:11 +02:00
Aras Pranckevicius
6826efdb02 Fix #119456, #119493: VSE adjustment/text strips do not update in some cases
As part of PR #118396 the "generator" effect strips (color, text,
adjustment) also started to put their "raw" images into the cache.
However, seq_cache_timeline_frame_to_frame_index that has optimization
that tries to use only one cache entry based on how many frames are
present in the strip was not expecting to see effect strips, ever.

As a result, something like adjustment layer would effectively just
cache a single frame, since it has no "source frames" to speak of.

Fixed that by only doing this optimization for non-effect strips.
2024-03-15 10:37:30 +02: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
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
Richard Antalik
4d37fb80b1 Cleanup: Convert VSE headers from .h to .hh 2023-11-03 01:33:54 +01:00
Campbell Barton
ebd4d1e2d6 Fix dangling pointer while scrubbing in the sequencer
SeqCache::last_key could be set to freed memory while scrubbing
two images in the sequencer.
2023-08-29 17:19:49 +10:00
Campbell Barton
ea8d985db8 Cleanup: various C++ cleanups
- Use C++ headers.
- Use function style cast.
- Use boolean literals.
- Remove redundant struct, void.
- Remove redundant parenthesis.
2023-07-28 09:38:07 +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