Commit Graph

120467 Commits

Author SHA1 Message Date
Pablo Vazquez
71e02b3229 UI: Draw sidebar tabs as pills
The tabs in the sidebar are aligned to the content, which looks great
when region overlap is off, but when it isn't, it looks like the tabs
are attaching to nothing. Solve this by drawing sidebar tabs as pills,
when using region overlap. This matches the top-bar workspace tabs.

Pull Request: https://projects.blender.org/blender/blender/pulls/139951
2025-06-10 21:59:55 +02:00
Jesse Yurkovich
860172484a Merge branch 'blender-v4.5-release' 2025-06-10 11:20:43 -07:00
Jesse Yurkovich
9381caf484 Fix: USD: Pass correct frame time when checking ORCO evaluation
Similar to the recent fix 457cccd964.
There was another code path which could pass in the wrong time into USD
for certain Mesh Sequence Cache scenarios.

I was not able to craft a faulty scenario by hand to observe a real
problem though. The scenario begins by importing a USD file needing a
Mesh Sequence Cache modifier and then attaching a particle system  (like
Hair) to the object. This will trigger the specific check calling into
`can_use_mesh_for_orco_evaluation` with the wrong time.

This makes the code path more explicit and passes in the correct time to
USD regardless now e.g. frame 28 vs time 1.166666666666667 (24fps)

Pull Request: https://projects.blender.org/blender/blender/pulls/140092
2025-06-10 20:20:00 +02:00
Hans Goudey
b2589be579 Fix: Build error after recent UI refactor
Additional uses of uiLayoutSetActive were added since the PR was created.
2025-06-10 13:46:54 -04:00
Guillermo Venegas
ff9c883154 Refactor: UI: Add uiLayout active get and set methods
This replaces API for accessing the uiLayout active state
with methods, following uiLayout refactors and the Python
API naming.

Part of #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/139963
2025-06-10 19:12:00 +02:00
Bastien Montagne
6d2e7a3bee Merge branch 'blender-v4.5-release' 2025-06-10 18:13:26 +02:00
Bastien Montagne
f76ca0e144 Cleanup: Remove left-over debug prints. 2025-06-10 18:12:48 +02:00
Habib Gahbiche
bd61e69be5 Compositor: make compositor node trees reusable
This is part of the short term roadmap goal of simplifying the
compositor workflow
(see https://projects.blender.org/blender/blender/issues/134214).
The problem is that many users don't know how to get started with
compositing in Blender, even when they have used Blender for other
areas, e.g. modeling.

Note: although the solution makes compositor node trees reusable
accross blend files, this is a nice side effect and not the main goal
of the PR.

This PR implements a "New" button that creates a new compositing node
tree, and manages trees as IDs. This has following advantages:
- Consistent with other node editors and other parts of Blender,
therefore making it easier to getting started with compositing if users
are familiar with shading or geometry nodes
- Give users the ability to reuse the compositing node tree by linking
or appending it.

Note: The parameter "Use Nodes" is still present in this PR, but will
be removed (in a backward compatible way) in a follow up PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/135223
2025-06-10 17:46:55 +02:00
Miguel Pozo
5459d11ed9 Merge branch 'blender-v4.5-release' 2025-06-10 17:25:37 +02:00
Miguel Pozo
fca4a16975 Fix: GPU: GPUWorker lock
Prevent race conditions caused by calling `GPUWorker::wake_up` when the
worker is not waiting.
Found to be an issue in #139627, since `wake_up` is likely to be called
before the thread has fully started.

Pull Request: https://projects.blender.org/blender/blender/pulls/139842
2025-06-10 17:24:18 +02:00
Clément Foucault
a5dc8026ee GPU: Shader: Add runtime dependency resolution
This allows to generate source file that will
be injected in a predefined source dependance tree.

This allow much cleaner shader workflow where
all sources are explicitly referenced from the
main source file.

Pull Request: https://projects.blender.org/blender/blender/pulls/140047
2025-06-10 17:22:58 +02:00
Clément Foucault
e57359726f GPU: VertexFormat: Use new data types
This prevents the use of unaligned data types in
vertex formats. These formats are not supported on many
platform.

This simplify the `GPUVertexFormat` class a lot as
we do not need packing shenanigans anymore and just
compute the vertex stride.

The old enums are kept for progressive porting of the
backends and user code.

This will break compatibility with python addons.

TODO:
- [x] Deprecation warning for PyGPU (4.5)
  - [x] Deprecate matrix attributes
- [x] Error handling for PyGPU (5.0)
- [x] Backends
  - [x] Metal
  - [x] OpenGL
  - [x] Vulkan

Pull Request: https://projects.blender.org/blender/blender/pulls/138846
2025-06-10 17:20:45 +02:00
Christoph Lendenfeld
27d2d0a23a Fix: Crash when snapping to first key using subframes
When pressing Ctrl to snap the playhead while scrubbing,
Blender could crash while trying to snap to the first key.
This would happen if the current frame was higher than the
left keyframe, but the difference was less than the `BEZT_BINARYSEARCH_THRESH`.

Pull Request: https://projects.blender.org/blender/blender/pulls/140122
2025-06-10 16:40:07 +02:00
Falk David
af6cbae469 Merge branch 'blender-v4.5-release' 2025-06-10 15:46:46 +02:00
Sietse Brouwer
ab1b451250 Fix: Grease Pencil: Wrong check on editable layer and keyframe in Sculpt Mode and Vertex Paint mode
In Grease Pencil, when using the tools in Sculpt Mode and Vertex Paint
mode, the check on editable layers wasn't entirely accurate. There was
a strict check on an editable _active_ layer, but since the tools work
on _all_ editable layers, the check should be wider: if there is _any_
editable layer, the tool can work.
That is fixed in this PR. Now the tools can be used when, for example,
a layer group is active or when the active layer is hidden, but there
are other editable layers present.

In Vertex Paint mode there was an additional issue: with Auto Keying
enabled, a new keyframe was created for the active layer only. A new
keyframe should be created for _every_ editable layer. As is the case
now with this PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/140119
2025-06-10 15:45:44 +02:00
Philipp Oeser
18ebd8adad Merge branch 'blender-v4.5-release' 2025-06-10 15:42:54 +02:00
Philipp Oeser
5c1eb99279 Fix #140109: Grease Pencil - Lasso Erase does not delete single points
By definition, Bounds for single points (size zero) are empty (this
matches BLI_rct behavior), so doing an intersect will actually fail.

So to resolve, use the existing `is_point_inside_bounds` for single-
point-curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/140124
2025-06-10 15:42:27 +02:00
Campbell Barton
6195e84c65 Merge branch 'blender-v4.5-release' 2025-06-10 22:22:12 +10:00
Campbell Barton
1999b72ec2 Fix memory leaks in Python argument parsing
Resolve some of the leaks exposed by running tests with guarded-alloc
checks enabled.
2025-06-10 22:21:58 +10:00
Falk David
eec765fb14 Merge branch 'blender-v4.5-release' 2025-06-10 13:13:53 +02:00
Clément Foucault
4bee4a456a Fix #139553: EEVEE: Vulkan raytracing denoising pink propagation
This was caused by precision issue that made `sqrt(1.0f - NV2)`
evaluate to NaN. Making sure the input is saturated fixes the
issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/140071
2025-06-10 12:37:54 +02:00
Clément Foucault
368a64f386 GPU: Shader: Add support for shader entry points
This works by wrapping the entry point call inside a
`main` function.

Since resources are still defined in global space,
function accessing these are marked with a custom
attribute. This custom attribute expands in a
`#ifdef` guard for the matching stage.
This is a temporary solution and will eventually
be lifted once we support SRD.

### TODO
- [ ] Implement `[[gpu::vertex/fragment_function]]`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139233
2025-06-10 12:37:20 +02:00
Bastien Montagne
dcca2694c5 Merge branch 'blender-v4.5-release' 2025-06-10 12:26:44 +02:00
Bastien Montagne
5d07055b0f Fix #137238: Collection asset placement not working with collection hierarchies.
Code selecting objects in collections that have been instanced was only
handling objects directly owned by the collection, not the objects in
the hierarchy of children collections.

The objects from the whole hierarchy need to be hanlded here, since
children collections will not be processed (as they are already
instanced by their parent one).

Pull Request: https://projects.blender.org/blender/blender/pulls/140068
2025-06-10 12:26:26 +02:00
Jacques Lucke
152471ffdb Geometry Nodes: support structure types in closures
This adds support for specifying structure types on closures. The main immediate
benefit is that this makes it possible to use fields with closures (without
having incorrect warnings in the UI).

A closure zone behaves very similar to a node group with respect to structure
type inferencing. The structure types can be inferenced fully automatically, or
the user can specify them manually on the closure inputs. On the evaluate
closure zone, the user has to specify the structure types of the inputs and
outputs explicitly (or leave them as dynamic).

Working on this, I was a bit surprised that `get_output_socket_shape` depended
on the field state. Is that a left-over? It feels like it shouldn't be necessary
since the socket shape shouldn't depend on field inferencing anymore. I removed
that now and couldn't see a difference yet.

The operator that creates a closure zone from an evaluate closure node copies
the input structure types already. Beyond that, there is no automatic syncing of
the structure types yet. The structure types only affect the UI and not what's
actually done during evaluation.

Pull Request: https://projects.blender.org/blender/blender/pulls/139713
2025-06-10 12:25:51 +02:00
Bastien Montagne
243f093dd4 Fix #137238: Collection asset placement not working with collection hierarchies.
Code selecting objects in collections that have been instanced was only
handling objects directly owned by the collection, not the objects in
the hierarchy of children collections.

The objects from the whole hierarchy need to be hanlded here, since
children collections will not be processed (as they are already
instanced by their parent one).

Pull Request: https://projects.blender.org/blender/blender/pulls/140068
2025-06-10 12:19:42 +02:00
Clément Foucault
62251cad5f Fix #140072: Overlay: UV Stretch ANGLE Overlay always shows green in 4.5
Was caused by the angle being scaled for USHORT storage.
2025-06-10 12:15:58 +02:00
Jacques Lucke
fe81cdb88b Merge branch 'blender-v4.5-release' 2025-06-10 12:15:38 +02:00
Jacques Lucke
7810bbc199 Cleanup: quiet unused variable warning 2025-06-10 12:15:10 +02:00
Jacques Lucke
2e44db85d2 Fix #138511: support dropping material asset into Set Material node
The `Drop Name` operator previously only worked for local data-blocks and not for assets.
This makes it possible to drop assets with this operator too.

Pull Request: https://projects.blender.org/blender/blender/pulls/140053
2025-06-10 12:10:15 +02:00
Pratik Borhade
f88a7758d9 Fix: Value property in shape key tree rows
Missed in 0eed084cad

Pull Request: https://projects.blender.org/blender/blender/pulls/140045
2025-06-10 12:05:02 +02:00
Jeroen Bakker
744904b0dd Merge branch 'blender-v4.5-release' 2025-06-10 10:24:44 +02:00
Jeroen Bakker
a14a844a99 Fix: #140028: Vulkan: Incorrect move of resources
Previous implementation allows to move VKBuffers, but didn't do a
proper std::move. On second thought it is a bad idea to be able to move
GPU resources. This PR removes the ability to move the buffer and
replace the usages with a unique ptr.

Pull Request: https://projects.blender.org/blender/blender/pulls/140103
2025-06-10 10:24:04 +02:00
Jeroen Bakker
cffafda2ff Fix #139898: Vulkan: Read out of bounds with color picking
The color picking reads 3 channels from a 4 channel texture. In the
common case the data conversion is required. Data conversion happens on
all 4 channels, but the backed memory only has 3 channels.

This is a workaround as the actual solution needs to work in many
different situations. Previous solution had to many issues that we
reverted the solution. This PR adds a local workaround specific to color
picking.

In Blender 5.0 we want to add test cases for all situations and
implement a solution that works better.

Pull Request: https://projects.blender.org/blender/blender/pulls/140101
2025-06-10 10:22:50 +02:00
Jacques Lucke
f62fde234f Merge branch 'blender-v4.5-release' 2025-06-10 09:51:51 +02:00
Jacques Lucke
3eab86588c Core: add id_cast function as more type-safe reinterpret_cast alternative
Currently, we are forced to use `reinterpret_cast` (or c-style-casts) when
converting between `ID` and the actual data-block types like `Object` and
`Mesh`. While `reinterpret_cast` does preserve constness, it does nothing to
make sure that a cast is actually valid. This patch adds `blender::id_cast`
which can be used as a drop-in replacement of `reinterpret_cast` in supported
cases.

It supports a couple of cases (using `Object` as example for all data-block
types):
* Convert `ID *` to `Object *`. This asserts that the conversion is valid at
  run-time if the pointer is not null.
* Convert `ID &` to `Object &`. This always asserts that the conversion is valid
  at run-time.
* Convert `Object *` to `ID *`. This is preferred over `&object->id` even if the
  result is the same because the latter results in ASAN warnings if `object` is
  null.
* Convert `Object &` to `ID &`. Added for good measure. There isn't really much
  of a benefit of this over using `object.id` except for maybe in generic code
  where the source type can be an `Object &` or `ID &`.
* Identity cast identical id types (e.g. `Object *` to `Object *`). Not really
  necessary to add a cast in such a case but may be useful in generic code where
  the input can be an `Object *` or `ID *`.

Some additional notes:
* Const-correctness is preserved with this cast.
* When attempting to do a non-id-cast, the function triggers a `static_assert`.
* The data-block types must not be just forward declarations because the actual
  type information is necessary.
* Casting to and from `void *` is not supported because that can't provide any
  additional type-safety over `static_cast`.
* Casting between different data-block types like `Object` and `Mesh` is not
  allowed.
* It does not support casting double-pointer types currently  (e.g. `ID **` to
  `Object **`).

The new cast is added in `DNA_ID.h`. As part of this patch, I also sprinkled in
a couple of `id_cast` in various places for testing (it's surprisingly tricky to
have the type checks working for all the different combinations of
pointer/referenced/constness/etc.). Replacing more existing `reinterpret_cast`
can be done separately afterwards.

It's nice that `blender::id_cast` has exactly the same length as
`reinterpret_cast`. So formatting should never change when using it in global
scope. Using just `id_cast` when inside of the `blender::` namespace is
preferable of course.

Pull Request: https://projects.blender.org/blender/blender/pulls/139820
2025-06-10 09:49:43 +02:00
Omar Emara
82ccbe7a97 Merge branch 'blender-v4.5-release' 2025-06-10 09:48:10 +03:00
Omar Emara
a48e599bea Fix #139856: Ellipse/Box mask size is clamped
The Ellipse/Box Mask nodes recently got their size clamped by their soft
limit, which was not previously the case, breaking compatibility and
limiting the node's use in some setups. The same goes for their
position. We fix this by allowing any size and position.
2025-06-10 09:45:30 +03:00
Benjamin Beilharz
3cdd38da67 Compositor: Expose EWA sampling in interpolation enum
- Adds Anisotropic (EWA) sampling to the compositor's interpolation
  enum.
- Any compositor nodes using EWA sampling are refactored and depend
  now on the interpolation enum.
- More refactoring in the RNA properties and DNA nodes to unify usage.

Pull Request: https://projects.blender.org/blender/blender/pulls/139833
2025-06-10 08:36:29 +02:00
Mohamed Hassan
3883a88d4e Compositor: Maintain alpha in Lens Distortion node
The alpha channel value was previously hard codded to one in the lens
distortion node. This patch solves that by integrating the alpha as well
in the radial distortion mode and taking the average alpha in the
horizontal case.

This breaks backward compatibility, but is what users what in most
cases, so it is acceptable.

Fixes #134658.

Pull Request: https://projects.blender.org/blender/blender/pulls/137994
2025-06-10 07:42:35 +02:00
Campbell Barton
8cdccb0154 Refactor: improve error handling for the animation player
- Pass the exit code back from WM_main_playanim instead of calling exit.
- Errors are printed to the stderr.
- Resolve some leaks on exit.

Note that this addresses noisy leaks reported by ASAN which were
flooding the output, but doesn't attempt to address all leaks.
2025-06-10 13:49:41 +10:00
Campbell Barton
1021dbf5cb Build: unbreak building with GCC 15 2025-06-10 11:18:52 +10:00
Sean Kim
2580ea8511 Merge branch 'blender-v4.5-release' 2025-06-09 18:08:48 -07:00
Sean Kim
ddcd314df4 Fix: Silence warning in BKE_brush_calc_curve_factors
Introduced in 23951e1b12

Pull Request: https://projects.blender.org/blender/blender/pulls/139977
2025-06-10 03:07:36 +02:00
Sean Kim
a1306e8b12 Merge branch 'blender-v4.5-release' 2025-06-09 16:49:06 -07:00
Sean Kim
12f4e17044 Sculpt: Assert when applying a translation that contains NaN
There have been a number of commits that have introduced regressions
in Sculpt mode where NaN begins to be propagated. While it is visually
very obvious that this is happening, this commit adds an assert so that
any automated testing with asserts on will also catch this issue.

Related to 23951e1b12

Pull Request: https://projects.blender.org/blender/blender/pulls/133992
2025-06-10 01:48:21 +02:00
Sean Kim
480adcf847 Merge branch 'blender-v4.5-release' 2025-06-09 16:47:24 -07:00
Sean Kim
44bfeb2214 Fix #140078: Sculpt Paint brushes can apply NaN
Introduced with 23951e1b12

The paint brush uses either absolute or local distance values, mapping
this distance to a brush strength requires using different values for
`BKE_brush_calc_curve_factors` and cannot just use
`calc_brush_strength_factors`. To fix this, use the more generic method
instead to allow passing the correct radius.

Pull Request: https://projects.blender.org/blender/blender/pulls/140084
2025-06-10 01:46:09 +02:00
Sean Kim
c22ce4674b Merge branch 'blender-v4.5-release' 2025-06-09 13:11:20 -07:00
Sean Kim
1131254644 Fix #139969: Clay Strips brush can corrupt mesh
Introduced with 23951e1b12.

When using brushes that use a cube distance, some distances are set to
be float::max(). This breaks assumptions made inside the previously
linked commit, as the operations inside `BKE_brush_calc_curve_factors`
can easily cause this distance value to become infinity, which when
multiplied with the factor value of 0 results in NaN propagation in the
mesh.

To fix this, set the max distance in `calc_cube_distance` to 1.0f.

Pull Request: https://projects.blender.org/blender/blender/pulls/139965
2025-06-09 22:06:23 +02:00