Commit Graph

579 Commits

Author SHA1 Message Date
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
Ray Molenkamp 1b6cd937ff Cleanup: CMake: Modernize bf_imbuf dependencies
Pretty straightforward

- Remove any bf_imbuf paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115425
2023-11-25 23:37:24 +01:00
Ray Molenkamp 6b70c04724 Cleanup: CMake: Modernize bf_depsgraph dependencies
Pretty straightforward

- Remove any bf_depsgraph paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115422
2023-11-25 22:51:59 +01:00
Ray Molenkamp ae25298774 Cleanup: CMake: Modernize bf_blenfont dependencies
Pretty straightforward

- Remove any bf_blenfont paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115365
2023-11-24 18:29:09 +01:00
Ray Molenkamp b683bcc46c Cleanup: CMake: Modernize bf_intern_clog dependencies
Pretty straightforward

- Remove any bf_intern_clog paths from INC
- Add a dependency though LIB when missing

context: https://devtalk.blender.org/t/cmake-cleanup/30260

Pull Request: https://projects.blender.org/blender/blender/pulls/115323
2023-11-24 17:12:24 +01:00
Richard Antalik f4e28d4762 Fix #114982: Crash when rendering scene strips
Since b1526dd2c6, viewport renderer sets `G.is_rendering`, but VSE scene
rendering function used this to decide whether to do offscreen opengl
render or use render API. This logic was quite weak.

Use `SeqRenderData::for_render` instead of `G.is_rendering`, since it
explicitly defines whether strip rendering is invoked by F12 render job.

Since offscreen gl rendering rely on `BLI_thread_is_main()` being
true, use this to initialize `do_seq_gl` variable for clarity.

The use of render job path was further conditioned on `G.is_rendering`,
with exception of running headless, but this condition was incorrect.
This condition was reformulated as precondition, which if true, returns
`nullptr` instead of crashing.

Pull Request: https://projects.blender.org/blender/blender/pulls/115079
2023-11-23 04:29:09 +01:00
Harley Acheson ff04d50eee Cleanup: Make format
Formatting changes resulting from running Make Format
2023-11-22 12:50:31 -08:00
Richard Antalik 5118f6f573 Fix mistake in previous commit
Oversight in `d0e9468848` - missed a variable to rename.
2023-11-22 06:04:58 +01:00
Richard Antalik d0e9468848 Fix (Unreported) VSE crash when editing retiming
Caused by loop over `MutableSpan`, but underlying array can be
reallocated. Do index based looping instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/115121
2023-11-21 05:27:36 +01:00
Richard Antalik 918515495e Fix #115007: Crash when creating transition from last reiming key
This operation is not permitted, cancel operator execution when
attempted.

Pull Request: https://projects.blender.org/blender/blender/pulls/115122
2023-11-21 05:27:24 +01:00
ok_what c433f6666a Fix (unreported): Incorrect calculation of meta strip range
The meta strip range was calculated before the effect strip range was
updated. This resulted in incorrect range. To the user this appeared
as the meta strip erratically jumping to another location in the
timeline when transforming it, when it contained effect strips.

Pull Request: https://projects.blender.org/blender/blender/pulls/114644
2023-11-20 04:18:18 +01:00
Hans Goudey 3d57bc4397 Cleanup: Move several blenkernel headers to C++
Mostly focus on areas where we're already using C++ features,
where combining C and C++ APIs is getting in the way.

Pull Request: https://projects.blender.org/blender/blender/pulls/114972
2023-11-16 11:41:55 +01:00
Hans Goudey 2b1b600456 Cleanup: Remove unused old sequencer iterator
Unused after 3fccfe0bc6.
The functions weren't implemented anymore.
2023-11-14 09:55:39 +01:00
Hans Goudey 0c1bb82fc4 Cleanup: Remove unnecessary struct and typedef keywords from C++ headers 2023-11-14 09:51:41 +01:00
Bastien Montagne cb5f650a5a Merge branch 'blender-v4.0-release' 2023-11-10 14:41:46 +01:00
Bastien Montagne c688b03847 Fix (studio-reported) VSE prefetch process taking seconds to stop.
When VSE cache is invalidated (on most VSE edit operation e.g.), or
Blender quits, in some cases (complex and very long edits), the
prefetch job would block several seconds after being requested to stop.

This was because one codepath would keep looping over all frames without
checking for the `stop` flag.
2023-11-10 14:29:44 +01:00
Campbell Barton 58ea0e051f Cleanup: spelling in comments 2023-11-09 09:54:28 +11:00
Bastien Montagne 869372ffc3 Fix (studio-reported) VSE crash when deleting strips.
Caused by 3fccfe0bc6 again, no idea why these two VertorSet were defined
as static variables in the functions generating them... But this was for
sure calling for _lots_ of problem. There are almost never good cases
for a function to return a static variable, and if it's done, it has to
be done extremely carefully.
2023-11-07 12:49:09 +01:00
Bastien Montagne 67dda08dea VSE: Cleanup: Simplify code in iterator by de-duplicating logic.
No reason to do the same exact thing in two different functions.
2023-11-07 12:22:11 +01:00
Bastien Montagne 9ecd106307 Fix (unreported) VSE crash when duplicating 4 or more strips.
Regression caused by typo in 3fccfe0bc637...
2023-11-07 11:35:44 +01:00
Bastien Montagne 2f8499415b Fix (studio-reported) VSE crash when Text strips use missing fonts.
BLF code is not threadsafe, yet font loading gets called over and over
by text strips when the font file is missing, including e.g. from
depsgraph evaluation code when duplicating the strip for evaluation.

WARNING: This is a quick fix for deblocking the Blender studio, proper
fix (and report) still needs to be worked on.
2023-11-07 11:06:13 +01:00
Campbell Barton 611930e5a8 Cleanup: use std::min/max instead of MIN2/MAX2 macros 2023-11-07 16:33:19 +11:00
Richard Antalik 9463135fed Fix incorrect assumption when handling overlap
In `shuffle_seq_time_offset_get()` code tried to check whether
`strips_to_shuffle` would overlap with each other, but this was done
incorrectly. This check relied on result of `shuffle_seq_test_overlap()`
but that function assumes, that only 1 strip of its input is transformed
by `offset`. This means, that if 2 strips are moved by same offset and
overlap is checked against each other it could result in true return
value. However this is checked in the code already by
`strips_to_shuffle.contains(seq_other)`, in which case loop continues.
This resulted in emmision of warning which was incorrect.

The issue is fixed by continuing loop if `strips_to_shuffle` contains
`seq_other` as first precondition to signify, that this is expected and
in fact inevitable case. `shuffle_seq_test_overlap()` does not check
whether 2 passed strips are equal, rather `BLI_assert` is used to
signify, that this is not valid use-case.

Since the warning can not happen, the logging was removed.
2023-11-07 05:06:33 +01:00
Richard Antalik 570799374f Fix #114542: VSE overlap not handled correctly
Caused bu mistake in refactoring - tested `seq` instead of `seq_other`.
2023-11-07 05:06:32 +01:00
Campbell Barton aaf05c2497 Cleanup: various C++ changes (use nullptr, function style casts) 2023-11-07 11:35:16 +11: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
Campbell Barton 134393e846 Cleanup: spelling in comments 2023-11-04 14:08:13 +11:00
Hans Goudey 0ff4060cd3 Cleanup: Remove unnecessary struct keywords in sequences headers
Also remove const for non-pointer arguments which is meaningless in
the declaration, move a scene enum to the "enums.hh" header, and add
missing forward declaration of structs.
2023-11-03 09:05:31 +01:00
Richard Antalik 21ea67f962 Merge branch 'blender-v4.0-release' 2023-11-03 02:06:08 +01:00
Richard Antalik 5d765a0d31 Fix #114342: Crash when opening too many movies at once
Adding strips or changing filepaths caused thatde movie files were loaded,
but memory was only released after new frame was rendered. Since FFmpeg
can take a lot of memory per strip, this can cause crash.

Free memory for each strip immediately after it is not needed after
these operations.

Pull Request: https://projects.blender.org/blender/blender/pulls/114381
2023-11-03 02:01:17 +01:00
Richard Antalik 4d37fb80b1 Cleanup: Convert VSE headers from .h to .hh 2023-11-03 01:33:54 +01:00
Richard Antalik 6bb238c761 Merge branch 'blender-v4.0-release' 2023-11-01 13:19:06 +01:00
Richard Antalik 01b617a3c6 VSE: remove speed_factor RNA property from sound strips
Property `speed_factor` was used before retiming. It was kept for
potential versioning code for complex speed animation, that was
possible with even older `pitch` property.

Strips, where `speed_factor` is set to static value are already
correctly converted.

Such versioning code would be quite complex, possibly slow and maybe
could corrupt files. This is due to multiple factors:
- Sound seeking was broken, so conversion would have to ignore all
  keyframes before strip starts to map frames properly.
- Because some animation was effectively ignored, it may cause
  inconsistencies when doing conversion.
- It would have to integrate value of `speed_factor` to map keyframes
  to strip space, but the animation is not limited to strip length.
- For each keyframe where speed gradually changes, at least one smooth
  speed transition would be required, but there would be discrepancies
  that would have to be accounted for. With simpler strategy it is
  likely, that extent of ramps would be limited and thus animation would
  be quite different from original.

Because of these reasons, I think it is best to not convert
`speed_factor` animation.

Pull Request: https://projects.blender.org/blender/blender/pulls/114295
2023-11-01 13:17:06 +01:00
Brecht Van Lommel 39107b3133 Revert changes from main commits that were merged into blender-v4.0-release
The last good commit was 8474716abb.

After this commits from main were pushed to blender-v4.0-release. These are
being reverted.

Commits a4880576dc from to b26f176d1a that happend afterwards were meant for
4.0, and their contents is preserved.
2023-10-30 21:40:35 +01:00
Richard Antalik d9f66a78f7 Merge branch 'blender-v4.0-release' 2023-10-24 05:07:23 +02:00
Richard Antalik dadbb5c5f7 Fix VSE retiming last key position incorrect
Last key is drawn on the right edge of the strip, but that is end of
the frame, which it should be bound to. Because of this, drawing code
and operators must consider, that this key is always displaced.

This was not done in 86a0d0015a and caused issues like #113755 that was
fixed incorrectly.
2023-10-24 04:57:00 +02:00
Richard Antalik 79b1eacba9 Fix #113890: Buffer overread when rendering after strip content range
Caused by incorrect frame index clamping in `SEQ_give_frame_index()`.
2023-10-24 04:37:34 +02:00
Campbell Barton 6b4d16363d Merge branch 'blender-v4.0-release' 2023-10-23 12:22:58 +11:00
Campbell Barton a60de8a940 Merge branch 'blender-v4.0-release' 2023-10-23 12:22:52 +11:00
Richard Antalik 86778d4554 Fix VSE retiming speed transition can not be moved
In earlier design, retiming selection was managed outside of retiming
keys struct. This was changed to a flag of the retiming key struct.

Since moving of the transition deletes and re-creates keys, the
selection was lost. Selection is now re-established in
`seq_retiming_transition_offset()`.
2023-10-23 02:38:11 +02:00
Richard Antalik 14827de2a9 Fix #112267: Multiply doesn't multiply alpha channel
After eda58d6419, multiply operation does not affect alpha channel, but
Some users do expect this feature present.

This adds option `multiply_alpha`, so that multiplication (in strip
color panel) will affect alpha channel as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/113791
2023-10-23 02:37:41 +02:00
Sergey Sharybin 85c557ffa2 Cleanup: Rename BLI_string_utils.h to BLI_string_utils.hh
All users of it are now C++, which opens doors to add C++ to the
public API.
2023-10-20 10:27:26 +02:00
Campbell Barton e7e4e63313 Cleanup: spelling in comments, white-space in comments 2023-10-19 18:53:16 +11:00
Richard Antalik f62dde8b1f Merge branch 'blender-v4.0-release' 2023-10-19 02:10:24 +02:00
Richard Antalik c7384ba6f3 Fix #110878 VSE duplicating first frame and offsetting rest.
Conversion from timeline frame to frame index was done by casting to
integer, which followed logic of ffmpeg seeking. However this is not
best approach in some cases - for example when FPS of scene and movie
differs by a very small amount. In this case the first frame could be
duplicated and all other frames will appear as offset by one frame.

In particular this may happen scene is set to 29.97 fps and movie is
encoded at 30000/1001 fps. A frame will still have to be duplicated, but
it should be frame where decimal of frame index crosses 0.5 to keep
audio and video in sync as best as possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/113870
2023-10-19 02:08:20 +02:00
Richard Antalik 3a230075cc Merge branch 'blender-v4.0-release' 2023-10-18 01:13:26 +02:00
Richard Antalik 01612bacfd Fix #113755: Incorrect speed overlay on retimed strips
Caused by off by 1 error in speed calculation.
2023-10-18 01:11:31 +02:00
Campbell Barton b0a6c6c1de Merge branch 'blender-v4.0-release' 2023-10-11 10:44:23 +11:00
Campbell Barton 58442a420e Cleanup: comment for release configuration, quote-style & remove parens 2023-10-11 10:41:16 +11:00
Bastien Montagne df0d7c9c3d WM Jobs: Refactor all worker status variables into a single shared struct.
Move the three current 'status variables' (stop, update and progress)
into a single 'WorkerStatus' struct. This is cleaner and will allow for
future workin this area without having to edit tens of 'startjob'
callbacks signatures all the time.

No functional change expected here.

Note: jobs' specific internal code has been modified as little as
possible, in many cases the job's own data still just store pointers to
these three values. Ideally in the future more refactor will be using a
single pointer to the shared `wmJobWorkerStatus` data instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/113343
2023-10-09 12:12:22 +02:00