Use multithreading, plus make the non-float / non-separate luma
calculations faster by avoiding byte->float->byte conversions
back and forth.
On a 4K resolution sequencer display, time taken to calculate the
waveform (Windows, Ryzen 5950X):
- regular images: 127.0ms -> 6.4ms
- regular images, separate colors: 160.3ms -> 13.1ms
- float images: 86.2ms -> 11.1ms
- float images, separate colors: 162.9ms -> 17.4ms
This also fixes curious "one black pixel row" in the middle of the
waveform, which was caused by the code spreading 256 possible luma
values over "off by one" vertical range:
Pull Request: https://projects.blender.org/blender/blender/pulls/115579
Exposed by 383a145a19.
Think the issue actually started in cfa53e0fbe, since then the new
destination normals were only filled from the first array copy onwards
(probably hidden by some recalculation of normals somewhere?).
In any case, starting the destination normals array with what we have
from the input mesh normals and then resizing the array (instead of
reinitializing it from scratch) fixes this.
Pull Request: https://projects.blender.org/blender/blender/pulls/115612
The grease pencil draw tool would still do a lot of smoothing
even if the active smoothing factor was set to 0.0.
This was because the screen space coordinates were always pre-blurred
before being passed to the curve fitting. Even if the curve fitting
outputs a line that fits the input exactly, it would still use the pre
smoothed coordinates.
The fix makes sure to use the smoothing factor in the influence
of the pre-blur. This way, no pre-blur is used when the factor is 0
and the lines will be smoothed much less.
Note that we always do some smoothing to avoid artifacts such
as pixel-grid-aligned lines etc.
When keyframing with the `Only Insert Needed` flag enabled,
the code was able to delete keyframes in certain cases.
This behavior is removed and replaced with the following rules.
* If there is a key on the current frame, and it has the same value, skip it.
* If there is no key, but the FCurve evaluates to the same value, skip it.
* Add a key in all other cases.
Remove that functionality for consistency and simplify the code around it.
Pull Request: https://projects.blender.org/blender/blender/pulls/115360
This patch adds a number of utilities to handle texture formats and
their relation to result types and precisions. This is needed for future
work, and also unifies the places one needs to update when adding a new
result type.
You could already do overshoot via the mouse, but it was arbitrarily
disallowed when entering values numerically. This simply lifts that
restriction so that numerical input is capable of the same things as
dragging the mouse.
Importantly, the operator slider code already appropriately clamps
both mouse and numerical input when needed. So the checks and clamping
removed in this commit simply aren't needed, and removing them just
makes numerical input get constrained exactly the same as mouse input.
Pull Request: https://projects.blender.org/blender/blender/pulls/115534
This patch implements a new mechanism for compositor results to wrap
external images, such as those cached in the static cache manager.
Thereby enabling zero cost use of those resources, which previously
needed a copy at each evaluation.
Pull Request: https://projects.blender.org/blender/blender/pulls/115574
Selection logic in ed_object_select_pick mixed operations for
object mode & other modes, making it difficult to reason about.
Refactor so object mode selection is isolated to it's own block,
following conventions for SelectPick_Params used by all other selection
picking operators.
This makes it possible to remove a call to de-select all objects
which was redundant in most cases.
Pass-through selection allows select-drag not to activate an already
selected object - so an existing selection can be dragged without
changing the active/selection (see #96544) & [0],
This caused entering pose-mode to fail when selecting an armature
with "Lock Object Modes" disabled.
There is a logical conflict where pass-through is intended to keep the
current selection & active, which doesn't make sense when selecting the
armature should enter pose-mode (details in code-comments).
Resolve by disabling pass-through when the select action changes
the objects mode.
[0]: 618f39fca2
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
Our `EnumerableThreadSpecific` wrapper doesn't accept an
example argument, only an initialization function. And some
removed variables were still used in asserts.
Caused by 383a145a19
Since above commit, normals were in a SharedCache, they need to be tagged dirty
for recalculation.
Instead of tagging the normals caches dirty explicitly, simply use
`BKE_mesh_tag_positions_changed` [which includes all this and also tags
positions dirty - which sounds also needed for updating other things]
Pull Request: https://projects.blender.org/blender/blender/pulls/115580
These updates are used to recalculate normals and average values between
grid boundaries during multires sculpting. In main the affected faces
are passed as an array of pointers. Using an `IndexMask` instead reduces
memory usage by 4x per affected face (8 byte pointer to 2 byte integer),
simplifies iteration and threading, and can also improve performance.
Finding which faces are affected is now multithreaded, with its runtime
changing from 0.63 ms to 0.12 ms in a simple test sculpting on a portion
of a 1 million face grid.
Also switch to VectorSet instead of GHash for finding affected adjacent
elements. That's a friendlier data structure that probably has better
performance as well.
`ED_view3d_win_to_ray_clipped_ex` requires `ray_end` when
`do_clip_planes` is true.
Since the snap code uses `ray_depth` instead of `ray_end`, the solution
is to always calculate the `ray_end` and convert to `ray_depth` when
necessary.
The new grid socket (#115270) will make these nodes obsolete and
provide more elegant ways of implementing the features. Removing
these nodes now to clean up and make future changes simpler.
Pull Request: https://projects.blender.org/blender/blender/pulls/115567
This avoids some duplication between the modifier and operator evaluation
contexts and also makes it easier to make independent from a specific
evaluation context (so e.g. the simulation nodes code shouldn't care whether
it's used from a modifier or operator.
Pull Request: https://projects.blender.org/blender/blender/pulls/115512
This makes so that locked layers don't show the points and the lines aren't visibly selected.
This separate the batch ensure function into two function, one for handling the visible grease pencil batch and one for handling the edit mode overlay batch.
This also makes it so that only selected curves show the points that make up it, (this matches legacy grease pencil).
Pull Request: https://projects.blender.org/blender/blender/pulls/114751
Because reading memfile undo steps doesn't send the mesh through the
versioning code that converts legacy layers back to the new generic
format, we can't write the old format in undo steps. This same check
existed during the mesh struct of array refactor.