Commit Graph

120055 Commits

Author SHA1 Message Date
Harley Acheson
459572b15f UI: Custom Windows Cursors for VSE Handles
VSE has three mouse cursors defined, WM_CURSOR_LEFT_HANDLE,
WM_CURSOR_RIGHT_HANDLE, and WM_CURSOR_BOTH_HANDLES that are currently
always using our default cursor format. This format works on all
platforms but does not support multiple sizes or antialiasing. This
PR makes these use custom cursors (created by Pablo Vazquez) on the
Windows platform.

Pull Request: https://projects.blender.org/blender/blender/pulls/125252
2024-07-25 18:21:16 +02:00
Bill Spitzak
0d70481d15 Refactor: Optimize compositor realization shader
This patch optimizes the compositor realization shader by moving the
centring offset to the host code as opposed to the shader.
2024-07-25 18:58:29 +03:00
Jesse Yurkovich
1c69154aaf Fix #125395: Build: Missing include for s390x arch
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/125397
2024-07-25 17:53:57 +02:00
Hans Goudey
3199915f35 Cleanup: Switch to C++ API for 3D cursor transform
Replace the `BKE_scene_cursor` functions with member functions
of the `View3DCursor` DNA struct. This makes using the cursor's
transform simpler, especially in newer C++ code.

Pull Request: https://projects.blender.org/blender/blender/pulls/124903
2024-07-25 17:53:09 +02:00
Julian Eisel
d2bcca680e Fix asset shelf popup not closing when selecting asset with enter
When typing to search an asset and confirming with enter, the popup
should close.

Mistake in 2781725734.

Steps to reproduce:
- Enter sculpt mode with the default cube active
- Press Shift+Space to open the brush asset selector popup
- Type to search for a brush
- Press enter -- the popup didn't close as it was supposed to
2024-07-25 17:41:49 +02:00
Julian Eisel
3dfd9d84eb Fix memory leak when using grease pencil clone brush
Caused by parallel access to static clipboard storage: Multiple threads
could end up calling `ensure_grease_pencil_clipboard()` in parallel.
Here this resulted in a surprisingly reliable memory leak.

Use a simple mutex lock to prevent unsynchronized access.

Steps to reproduce were:
- Add Grease Pencil object
- Enter grease pencil Sculpt mode
- Select Clone brush asset
- Click in 3D Viewport
- Quit Blender (see console log for leak reports)

Pull Request: https://projects.blender.org/blender/blender/pulls/125428
2024-07-25 17:40:01 +02:00
Falk David
b1f747b19c Curves: Add explanation of magic number in calculate_point_handles
Add an explanation of the math for where the magic `2.5614f` comes from.

Pull Request: https://projects.blender.org/blender/blender/pulls/125302
2024-07-25 17:32:49 +02:00
Sybren A. Stüvel
34067f43b5 Fix compiler errors on non-experimental builds
Fix compiler errors when building without experimental features, by adding
more `#ifdef WITH_ANIM_BAKLAVA` guards around code.
2024-07-25 17:31:04 +02:00
Lukas Tönne
418c63f8db Fix #125229: Fill tool "radius mode" extension was not generating lines
The fill tool's stroke extension feature has a "radius" mode that was
implemented by just drawing filled circles at the end of strokes.
This should work by creating additional lines instead, the circles are
just indicators of the search range.

The radius mode now does a KDTree search for points inside the circles.
It generates extra extension lines and handles these in the usual way,
just like lines generated in "extension" mode.

GPv2 had an undocumented curvature feature that would also add lines to
interior points if their curvature was large enough. This is quite
obscure, not mentioned in the manual, and adds complexity. For now the
feature is not implemented, but some placeholder TODO comments have been
added.

Pull Request: https://projects.blender.org/blender/blender/pulls/125420
2024-07-25 17:29:00 +02:00
Sybren A. Stüvel
a8ee0b9a05 Anim: add Action Slot selector to Action editor
Add an Action Slot selector to the Action editor's header, next to the
Action selector. The selector shows all slots in the action that are
suitable for animating objects (as the Action editor itself is limited
to showing the Action of the active object).

This also considerably simplifies the 'Animation Debug' panel, as some
debugging code has been removed, as well as the display of any animation
layers. The latter can be reintroduced (if necessary) when multi-layer
animation support is added. Most importantly, it removes the
WindowManager property that was used as a hack to assign layered Actions
to objects.

API change: the RNA property `AnimData.slot` is now a pointer property
that reflects the actual slot (it used to be an enum property).

Some small changes to the UI code were necessary to make the selector
show the slot's display name (and not their internal name).

Pull Request: https://projects.blender.org/blender/blender/pulls/125416
2024-07-25 17:20:27 +02:00
Sybren A. Stüvel
09901d2416 Refactor: Anim, use enum types for enum values in bAnimContext
Use actual enum types (`eAnimEdit_Context` etc) for enum values in the
`bAnimContext` struct.

This commit also splits the `mode` field into `dopesheet_mode` and
`grapheditor_mode`, so that their values are clearly differentiated.
Before you'd have to check `spacetype` to know how to interpret this
field (but that wasn't described either). You still have to check that
field to know which one of the two you need to look at, but at least
it's now clear what values can be expected there.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/125423
2024-07-25 17:19:26 +02:00
Hans Goudey
37fca25820 Fix #125404: Crash converting matrix attribute
The allocation for the new attribute array ignored type alignment.
2024-07-25 11:04:31 -04:00
Hans Goudey
7e9771c9de Sculpt/Paint: Push undo nodes in parallel in more cases 2024-07-25 10:55:47 -04:00
Julian Eisel
4dd42c2cdd Fix crash with grease pencil clone brush without clipboard contents
Using the clone brush without previously having copied any stroke points
to clone would crash.

Steps to reproduce were:
- Add Grease Pencil object
- Enter grease pencil Sculpt mode
- Select Clone brush asset
- Click in 3D Viewport

Note that there's also a memory leak appearing now, will submit a
separate fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/125425
2024-07-25 16:36:51 +02:00
Bill Spitzak
b3e62d3052 Fix #124133: Compositor transforms are off by 0.5 pixels
The GPU compositor transforms are off by half a pixel in some cases.
That's because the realization shader was to perform transforms, and it
includes logic to move images by half a pixel if the domain and image
had different even/odd sizes. To fix this, we only move by half a pixel
if we are doing realization, while transforms are left as is.
2024-07-25 17:23:25 +03:00
Julian Eisel
2cae187dcb Fix: "Assign Shortcut" missing for grease pencil brush assets
Context menu operators to assign/change/remove shortcuts for brush
assets were missing. Reason being that the keymap to add them to and
look them up in was not detected correctly.

Part of #124418.
2024-07-25 15:36:14 +02:00
Christoph Lendenfeld
5d06e84b37 Fix: Failing unit tests after insert available changes
Caused by blender/blender@28dd78457a
Forgot to update the unit tests after changing the behavior to fix the bug.
The unit tests explicitly state that they are testing behavior that might
be undesirable. As such I changed the tests to reflect the new behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/125415
2024-07-25 15:21:27 +02:00
Sybren A. Stüvel
d5c6096a7b Anim: Action editor, show slot ID type icon on the right-hand side
In the Action editor's channel list:

- always show the 'slot' icon on the left, to indicate the channel
  represents a slot (icon design pending #123372), and
- show the slot's ID type icon on the right.

This should help reduce the confusion between "the ID name" and "the slot
name that animates the ID".

Pull Request: https://projects.blender.org/blender/blender/pulls/125314
2024-07-25 15:20:06 +02:00
Aras Pranckevicius
6432d54ef7 Fix #125043: VSE text outline is wrongly inside the actual text shape
This is only visible when text color has transparency or is fully
transparent. Desired behavior is that the outline would only be
"outside" the actual text.

Pull Request: https://projects.blender.org/blender/blender/pulls/125372
2024-07-25 14:32:26 +02:00
Christoph Lendenfeld
28dd78457a Fix #125169: autokeying with only insert available generates an empty action
When the setting "Only Insert Available" is enabled and there is no action yet,
we can exit early because we know that it will not be possible to insert a keyframe.
This prevents an action from being created.

Co-authored by: Pratik Borhade

Pull Request: https://projects.blender.org/blender/blender/pulls/125408
2024-07-25 13:03:53 +02:00
Julian Eisel
65d0151300 Cleanup: Unused function warning when building without NDOF 2024-07-25 12:26:17 +02:00
Falk David
f34a4229e0 Fix: GPv3: Lineart: Conversion from 4.2 not working correctly
There were two issues:
* The target layer name was not copied over
* The thickness setting was being divided by two when it
resulted in thinner strokes.
2024-07-25 12:08:19 +02:00
Falk David
d2714dab7d Cleanup: GPv3: static function name for lineart conversion 2024-07-25 12:08:19 +02:00
Sybren A. Stüvel
d4984216de Anim: Backward compatibility API for Action.fcurves
These functions can now be called on layered Actions:

- `action.fcurves.new(data_path, array_index)`
- `action.fcurves.find(data_path, array_index)`
- `action.fcurves.remove(fcurve)`
- `action.fcurves.clear()`

These will operate on the first keyframe strip (searching layers bottom
to top), and then its channelbag for the first slot.

If necessary, `fcurves.new()` will create the layer, keyframe strip,
channelbag, and slot.

This backward compatibility layer only kicks in if either of these is
true:

- The Action is empty AND the experimental flag is enabled, or
- The Action already has a layer or a slot (i.e. is already considered
  'layered').

If none of these conditions hold, `action.fcurves` just gives access to
the legacy data.

Ref: #124714
Pull Request: https://projects.blender.org/blender/blender/pulls/124996
2024-07-25 12:06:23 +02:00
Sybren A. Stüvel
651a7522a4 Refactor: Anim, rename leftover 'binding' references to 'slot'
Rename leftover references to action 'bindings' to 'slot':

- Two comments, and
- bunch of `bind_` variable prefixes, renamed to `slot_`.

No functional changes.
2024-07-25 12:04:05 +02:00
Sybren A. Stüvel
9427ec3f40 Fix #125063: Anim: layered Action data is still loaded in 4.2-release
Add `#ifdef WITH_ANIM_BAKLAVA` to the blend file reading/writing code,
so that the Action layers & slots are ignored when Blender is built
without experimental features.

This ensures that any loaded Action is just treated as 'legacy' (which
is the only kind of Action non-experimental Blender should have to deal
with), which will also properly deal with the forward compatible data
written by !125065.

This fix was committed on the `blender-v4.2-release` branch as
1b7485f20892523942752f81239807b2eab0f00b.

Pull Request: https://projects.blender.org/blender/blender/pulls/125068
2024-07-25 11:38:40 +02:00
Bill Spitzak
b76603b6bf Fix: Scale node is off by half a pixel
The Scale node was off by half a pixel because pixels were not evaluated
at their center. To fix this, we scale the pixels at their center.
2024-07-25 12:06:32 +03:00
Philipp Oeser
c13c502624 Fix: Tracking related RNA paths incomplete/wrong
While working on !125365, I was running over a couple of places where
RNA paths were also incomplete.

This PR covers:
- MovieTrackingDopeSheet
- MovieTrackingSettings

Pull Request: https://projects.blender.org/blender/blender/pulls/125373
2024-07-25 09:35:21 +02:00
Philipp Oeser
163baad17e Fix #125064 : Cursor Value to Selected wrong with Normalized FCurves
This affected cursor snapping as well as the `Jump to Keyframes`
operator since both use `sum_selected_keyframes` to get the averaged
values of elements. It was already taking into account the normalization
factor, but the way a single `KeyframeEditData` was created from
multiple `bAnimListElem` was wrong:

- first, we should only add to it if we actually have some keys selected
(not a problem without normalization, but with it, we would add values
there
- second, the offset needs to be taken into account for each selected
key when adding to the absolute values

Could go into LTS probably

Pull Request: https://projects.blender.org/blender/blender/pulls/125221
2024-07-25 09:34:37 +02:00
Aras Pranckevicius
d80f0aa068 Fix #124899: Font bounding box calculation is incorrect for some fonts
This is visible in VSE text strip "box" and "outline" options at least.
For some fonts (mostly script/cursive type) BLF_boundbox function
was calculating horizontal bounds purely from pen position and
advance to the next character position. But the actual glyph can extend
beyond the advance distance.

Curiously, blf_font_boundbox_foreach_glyph (used by
blf_str_offset_from_cursor_position and blf_str_offset_to_glyph_bounds)
was already doing the correct thing and taking glyph horizontal bounds
into account.

Pull Request: https://projects.blender.org/blender/blender/pulls/125363
2024-07-25 08:45:17 +02:00
Hans Goudey
e1a30b09eb Cleanup: Sculpt: Use generic functions for mesh data gather/scatter
For meshes (in comparison to multires grids and BMesh) there is nothing
special about position, normals, or mask arrays. We can use the same
functions for gathering and scattering all the arrays. This also gives us
a somewhat nicer temporary solution for the issue of the `array_utils`
utilities using multithreading forcing us to use task isolation. Now the
brushes don't use those utilities.
2024-07-24 23:10:52 -04:00
Campbell Barton
8418ec4952 CMake: include headers in source lists 2024-07-25 11:24:11 +10:00
Campbell Barton
547b63b69b Cleanup: sort cmake file lists 2024-07-25 11:24:10 +10:00
Campbell Barton
e8f9834ef9 Cleanup: clarify names, use a list for SVG icons & unset variables 2024-07-25 10:45:20 +10:00
Campbell Barton
c589634f73 Cleanup: use colon after parameters 2024-07-25 10:17:45 +10:00
Campbell Barton
2edc2393d2 Cleanup: spelling in comments 2024-07-25 10:17:42 +10:00
Campbell Barton
62afbbef9b Cleanup: use const variables & args, pass args by reference 2024-07-25 10:17:40 +10:00
Sean Kim
53df43e064 Cleanup: Move variable initialization into struct definition
Pull Request: https://projects.blender.org/blender/blender/pulls/125388
2024-07-24 23:45:40 +02:00
Jesse Yurkovich
b112549296 Cleanup: Formatting 2024-07-24 22:27:29 +02:00
Bill Spitzak
f701a71b0e Fix: Compositor Rotate node is off by 0.5 pixel
The Rotate node was off by 0.5 pixels because pixels were not evaluated
at their center. Furthermore, the center of rotation was also off by
half a pixel. To fix this, we ensure rotation happen around the exact
center as well as rotate the pixels at their center.
2024-07-24 22:28:35 +03:00
Bill Spitzak
ab51d879c3 Fix #124339: Compositor artifacts with 0.5 translation
The compositor translate node produces artifacts when its fractional
part is 0.5. That's because GPUs do round-to-even for nearest neighbour
sampling in case samples were at pixel boundaries.

To fix this, we bias translations by a small value to break the
rounding and ensure predictable rounding direction.
2024-07-24 19:22:00 +03:00
YimingWu
6041bdd93a Fix #125340: Div by zero in LineArt shadow stage
There could be a rare case where a div by zero situation would take
place in LineArt shadow stage where the silhouette and shadows are
calculated, which would cause infinite shadow edge cutting. Now will
return a non-cutting state for those edge cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/125361
2024-07-24 15:45:33 +02:00
Omar Emara
40be124184 Fix #122253: Image saving ignores EXR color format
All image saving mechanisms in Blender ignores the color format for EXR
images, including Render Pipeline, Save Operator, and File Output nodes.

To fix this, we first allow EXR images to be BW for flexibility. Then we
adjust the EXR saving code to take into account the required number of
channels. This is only done for single layer EXR images. Multi-layer EXR
images correctly ignores the option.

Pull Request: https://projects.blender.org/blender/blender/pulls/124807
2024-07-24 14:20:59 +02:00
Hans Goudey
45e4fecf9b Refactor: Separate mesh and multires PBVH building
Though it results in more duplication currently, splitting these
could help to facilitate further performance improvements here
in the future, and it avoids passing a bunch of useless arguments
for the multires case.
2024-07-24 07:54:59 -04:00
Hans Goudey
aa0ea3cf8f Cleanup: Remove "using" statements
The proper solution is to move the relevant code to the Blender
namespace. It should look ugly until then because it is.
2024-07-24 07:54:59 -04:00
Hans Goudey
dca3d87052 Cleanup: Remove unhelpful PBVH debugging utilities
These were mostly getting in the way of refactoring this code.
If the referenced problems actually happen, there would be
more obvious ways to observe the issues anyway.
2024-07-24 07:54:59 -04:00
Hans Goudey
d4f824b5af Cleanup: Reorder functions to group PBVH building 2024-07-24 07:54:59 -04:00
Hans Goudey
9d1b230a55 Cleanup: Sculpt: Pass BVH nodes by reference 2024-07-24 07:54:59 -04:00
Hans Goudey
f9c6fe30db Sculpt: Extract bounds calculation from BVH build, parallelize
This applies the same change as the previous commit to the bounds
of every BVH node. The bounds calculation can be changed to use
the standard functions from the regular BVH deformation.

In a simple test this makes building the sculpt BVH 64% faster.
I observed a change from 762ms to 464ms for a 1.9m vertex mesh.
2024-07-24 07:46:02 -04:00
Hans Goudey
8ab2a139ca Sculpt: Extract visibility calculation from BVH build, parallelize
This simplifies the BVH build process and potentially improves
its performance when parts of the geometry is hidden. The method
used to calculate whether a node is fully hidden is slightly different
too, vertex indices are used instead of triangle indices and a triangle
to face map.
2024-07-24 07:46:02 -04:00