Commit Graph

148613 Commits

Author SHA1 Message Date
Harley Acheson
14407595ce Fix #137218: Make All Tabs Visible for New Properties Area
With commit bf18e8f814 the Properties editor can filter categories.
There is versioning code to ensure that any existing areas show all by
default. But newly-created Properties areas start without any. For
example, start with Factory Settings and then change the 3D Viewport to
a Properties editor and it will be blank. I'm assuming this is not
intended behavior so this PR makes new editors start with all tabs
shown.

Pull Request: https://projects.blender.org/blender/blender/pulls/137237
2025-04-10 17:56:45 +02:00
Jeroen Bakker
532ec70041 Vulkan: Update unsupported features
Vulkan backend is progressing quickly. Lately we improved the
performance and finalized OpenXR support. Removing these
unsupported/limited features from Preferences->System.

The Vulkan backend is still mentioned to be experimental. Removing it as
experimental option requires some more discussions and user feedback.
2025-04-10 16:18:57 +02:00
Jeroen Bakker
3da222cb9a Vulkan/OpenXR: Direct3D Bridge
Some OpenXR platforms do not support OpenGL or Vulkan. To support these
platforms we use a bridge. Blender still renders in OpenGL/Vulkan, but
will copy the render result into a D3D11 swapchain.

OpenGL doesn this by importing the D3D11 swapchain into the OpenGL
context and perfor OpenGL calls to update the swapchain. However for
vulkan that could lead to construct 3 context for OpenXR

- Blender GPU Context
- OpenXR D3D Context
- New context that imports the Blender render result and the OpenXR
  Swapchain image and copies them.

Due to Direct3D limitations importing into a vulkan context has known
issues (driver + extensions). Secondly we are not sure if we are running
on the same device as the OpenXR swapchain. The solution provided with
this PR is to only support CPU data transfers.

**SteamVR using d3d bridge**

SteamVR normally would use the Vulkan binding. But by changing the binding
priority in code you can make it select the D3D bridge.

<img width="1518" alt="Screenshot 2025-04-10 114534.png" src="attachments/f856bb2b-9ad5-4bb2-9cfd-a1412da9edd1">

It has been tested and validated to work using Mixed reality portal as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/137264
2025-04-10 16:15:27 +02:00
Falk David
d0cf7df902 Fix: Geometry Nodes: Avoid recomputation of evaluated gizmo node ids
The `GeoTreeLog::ensure_evaluated_gizmo_nodes()` reran the iteration
over the tree loggers to add the node ids for the evaluated gizmo.

This wasn't an issue because `GeoTreeLog::evaluated_gizmo_nodes` is
a set, so nothing changed when trying to re-add the same ids.

This sets `reduced_evaluated_gizmo_nodes_` to `true` (probably an
oversight when this got added) so that the function returns early when
called again.
2025-04-10 14:52:19 +02:00
Brady Johnston
32b26e62ce Geometry Nodes: Hide "Group ID" value in Accumulate Field node
The `Group ID` input on every node is a hidden value except for the
Accumulate Field node. This patch just hides that value to bring it
inline with the other nodes, as different single values are meaningless.

Pull Request: https://projects.blender.org/blender/blender/pulls/137160
2025-04-10 14:30:44 +02:00
quackarooni
93f7c40fd0 Cleanup: Use std::move and std::nullopt in Accumulate Field Node
The nodes from #134640 were initially built off the Accumulate Field node.
During review for those nodes, certain changes to the code were suggested.

This patch applies the same changes to Accumulate Field node.
These changes namely being:
- Use `std::move` for field inputs
- Use `std::nullopt` as default for `node_type_from_other_socket`

Pull Request: https://projects.blender.org/blender/blender/pulls/137209
2025-04-10 14:29:19 +02:00
Jeroen Bakker
b65b6febb9 Fix: Vulkan/OpenXR: Use correct data format for CPU transfers
Incorrect data format was selected when using CPU data transfers in
OpenXR. It always used `GPU_DATA_HALF_FLOAT`, also when the swapchains
where `GPU_RGBA8`. This resulted in black screens in release mode, and
asserts in debud mode.

Fixed by selecting the correct data transfer data type based on the
swapchain format.

Co-authored-by: jeroen@blender.org <Jeroen Bakker>
Pull Request: https://projects.blender.org/blender/blender/pulls/137269
2025-04-10 14:22:55 +02:00
Falk David
afc3ae623c Fix: Geometry Nodes: Attribute search not working for Grease Pencil drawings
The attribute search for e.g the attribute name input in
the `Store Named Attribute` node did not list attributes
inside Grease Pencil drawings (curve and point domain).

The fix ensures that for the `GeometryComponent::Type::GreasePencil`
we also iterate over the attributes of each evaluated drawing.

Pull Request: https://projects.blender.org/blender/blender/pulls/137267
2025-04-10 14:16:22 +02:00
Brecht Van Lommel
1e49a7e135 Fix #137197: Grease pencil duplicating materials on custom brushes
Always compare absolute file paths.

Pull Request: https://projects.blender.org/blender/blender/pulls/137229
2025-04-10 13:06:27 +02:00
Brecht Van Lommel
7aaa43b557 Revert "Fix: Build failures when using path with spaces on macOS"
This reverts commit be63ebd961.

This doesn't work well with MSBuild, semicolons get escaped even in
verbatim mode.
2025-04-10 13:04:34 +02:00
Falk David
62062c7915 Fix #137227: Grease Pencil: Crash when getting multi frame falloff
One of the calls to get the frame falloff was missing a
check for `use_multi_frame_falloff`.

This puts the conditions for when the multi frame falloff
needs to be calculated in the `get_frame_falloff` function.
That fixes the crash and makes a code a bit easier to read
(without ternary operator).

Pull Request: https://projects.blender.org/blender/blender/pulls/137259
2025-04-10 12:21:52 +02:00
Julian Eisel
4f965e4d38 Fix #136254: Assets not available in search after saving file
We'd rather aggressively clear asset lists on file save since 9a9e2e19a9 (and
some related commits), seems like we can be a bit more precise here. Only
reload assets from the current file when saving the file, which is quite fast
to do and doesn't happen asynchronously (so UIs showing assets will only show
up once the assets are ready).

Actually we might not have to clear on file save at all, but needs more
testing.

Also fixes disappearing of asset previews on file save.

Pull Request: https://projects.blender.org/blender/blender/pulls/137117
2025-04-10 11:31:46 +02:00
YimingWu
79c6f2eacf Grease Pencil: Use smooth brush setting when smoothing temporarily
When sculpting a grease pencil object, user can hold `Shift` key to
temporarily switch to smooth brush. Previously it will keep using
whatever brush settings from the original brush for smoothing, which is
not ideal, now it will switch to the actual smooth brush but only keep
the radius the same.

The implementation is largely the same as `smooth_brush_toggle_on` from
`sculpt.cc`, brush is changed and restored in `on_stroke_begin/end`.

Part of #136300

Pull Request: https://projects.blender.org/blender/blender/pulls/136827
2025-04-10 11:28:34 +02:00
Jeroen Bakker
969e70fed8 Fix: Vulkan: Unable to start on WoA
Current Windows on ARM GPUs don't support
extenral memory. External memory is required
for OpenXR. So most likely OpenXR will not work
on these devices.

Most (read all) OpenXR platforms that support
vulkan also require external memory. So might
just be that those platforms won't work at all
on these devices.

In any case when not supported, the GHOST
OpenXR platform will use CPU for data transfer.
2025-04-10 10:15:23 +02:00
quackarooni
5a5ad978bf Nodes: Make spacing for Panel Toggle properties consistent with that of Boolean sockets
Panel toggles have a subpanel for listing out properties associated with their
Boolean checkbox.

The vertical spacing for properties in this panel is slightly different to how
normal Boolean sockets list their properties. This patch makes it more
consistent by putting the properties after `Default` in a `column` sublayout.

Pull Request: https://projects.blender.org/blender/blender/pulls/137211
2025-04-10 09:46:37 +02:00
Jeroen Bakker
ae8665b8b2 Cleanup: Missing pragma once 2025-04-10 09:36:19 +02:00
Jeroen Bakker
6f6df389a1 Cleanup: OpenXR: Move Direct3D to its own compile unit
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/137255
2025-04-10 09:32:48 +02:00
Jacques Lucke
dcc8d28859 Refactor: Geometry Nodes: store tree identifier in tree logger
The main goal here is to add `GeoTreeLogger.tree_orig_session_uid`. Previously,
it was always possible to derive this information in `ensure_node_warnings`.
However, with closures that's not possible in general anymore, because the
Evaluate Closure node does not know statically which node tree the closure zone
is from that it evaluates. Therefore, this information has to be logged as well.

This patch initializes `tree_orig_session_uid` the same way it initializes
`parent_node_id`, by scanning the compute context when creating the tree logger.
To make this work properly, some extra contextual data had to be stored in some
compute contexts.

This is just a refactor with no expected functional changes. Node warnings for
closures are still not properly logged, because that requires storing
source-location data in closures, which will be implemented separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/137208
2025-04-10 08:56:02 +02:00
Jeroen Bakker
07a9306bb4 Cleanup: Vulkan/OpenXR: Pass Blender context via constructor
Similar to Direct3D.

Pull Request: https://projects.blender.org/blender/blender/pulls/137254
2025-04-10 08:51:20 +02:00
Jeroen Bakker
a564a27c1f Cleanup: OpenXR: Introduce a Direct3D base class.
For the Vulkan/OpenXR code will be shared with the OpenGL-Direct3D
bridge. This cleanup separates the OpenGL specifics in its own class.

Pull Request: https://projects.blender.org/blender/blender/pulls/137252
2025-04-10 08:50:52 +02:00
Campbell Barton
ab5875b2d5 Fix #135979: Extensions refresh does nothing for local repositories
Support refreshing the active repository for "local" repositories.

Co-authored-by: Nika Kutsniashvili <nickberckley@gmail.com>
2025-04-10 15:44:38 +10:00
Campbell Barton
39db404ba4 Fix: resetting/clearing the filename skipped validation
The logic to add a file extension to the filename - which runs when
editing the text was not running when resetting/clearing the value.

Resolve by calling `uiBut::func`.

Along with [0], this fixes #134101.

[0]: f2a1c8d77c
2025-04-10 04:20:53 +00:00
Sean Kim
98fa6927d8 Cleanup: Various non-functional changes to paint cursor drawing methods
* Uses C++ math functions and types where possible
* Uses const where possible
* Reduces scope of variables where possible

Pull Request: https://projects.blender.org/blender/blender/pulls/137239
2025-04-10 05:39:34 +02:00
Sean Kim
7a4052e561 Cleanup: Reorganize rna_brush.cc capability section
* Groups related capabilities together
* Also adds a missing undef

Pull Request: https://projects.blender.org/blender/blender/pulls/137241
2025-04-10 05:39:06 +02:00
Campbell Barton
b2dbfa7d77 Cleanup: spelling in comments, use doxygen comments 2025-04-10 13:02:29 +10:00
Campbell Barton
f58e987c95 Cleanup: postpone imports until needed 2025-04-10 13:00:01 +10:00
Harley Acheson
2f6a10c75e Fix #137186: Allow Event Handling When Cursor Outside Wide Menus
When a wide menu is open and you move your mouse outside of it we have
new code that prevents the immediate opening of neighboring menus. But
while in this condition of mouse outside the menu, the rest of the
event processing is not run, so pressing "escape" will not close it.
This PR just moves the conditions around so event handling always
continues unless another menu is opened.

Pull Request: https://projects.blender.org/blender/blender/pulls/137243
2025-04-10 04:06:21 +02:00
Campbell Barton
d21b488ac9 UI: hide the "Geometry" panel when viewing the render result
Ref !137242
2025-04-10 01:50:43 +00:00
Campbell Barton
94aabc0dbe Versioning: ensure render slot names are valid UTF8
Also include pixel density which missed a version bump.
2025-04-10 01:47:11 +00:00
Campbell Barton
c70b48aae2 Fix: new render slots could contain truncated UTF8 byte sequences
Creating render slots from Python could truncate multi-byte sequences
which would then raise an exception when accessed.
2025-04-10 11:41:49 +10:00
Campbell Barton
4bd7706099 Fix: error report writing image that displayed "Success"
Failure to write an image that didn't set `errno` reported:

"Could not write image: Success"

Check errno is non-zero before using it's message,
ideally error prints would be shown here.
2025-04-10 01:01:35 +00:00
Campbell Barton
24f8819c78 Fix: correct check for Iris image dimensions
Mistake in [0], missed width check.

[0]: 7a23d7aba4
2025-04-10 10:50:10 +10:00
Sean Kim
4a97a807e5 Cleanup: Various non-functional changes to PaintCursorContext struct
* Use C++ math container types instead of arrays
* Use enum class instead of enum
* Use references instead of pointer for PainCursorContext
* Add a few comments

Pull Request: https://projects.blender.org/blender/blender/pulls/137235
2025-04-10 00:47:35 +02:00
Sean Kim
5a5db5ea88 WM: Pass tablet tilt data to paint cursor draw callback
Part of #82877

When drawing specialized cursors for the different paint modes via the
`wmPaintCursor` draw callback, tablet tilt direction is unavailable to
use to customize the drawing for the user.

To enable this functionality, this commit adds the `x_tilt` and `y_tilt`
data read while processing MOUSEMOVE events to the `eventstate` variable
so it can be used by consuming functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/137189
2025-04-09 23:07:03 +02:00
Bartosz Kosiorek
1148eb9c8b Fix #102755: Viscosity instability in Mantaflow
More accurately normalize 3D vectors, to avoid this an potential other
numerical stability issues in Mantaflow.

Pull Request: https://projects.blender.org/blender/blender/pulls/136966
2025-04-09 22:04:51 +02:00
Jesse Yurkovich
7afcba7da6 Cleanup: Movie: Adjust DNA and comments from recent ProRes addition
A few tidy ups from the recent ProRes addition[1]
- Reduce size of DNA structs
- Follow coding guidelines for multi-line comments

[1] 7d75c5e2bc

Pull Request: https://projects.blender.org/blender/blender/pulls/137231
2025-04-09 21:41:29 +02:00
Clément Foucault
890e00cecb DRW: DebugDraw: Revamp the module and make it global
- Make the module global and allow usage from anywhere.
- Remove the matrix API for thread safety reason
- Add lifetime management
- Make display linked to the overlays for easy toggling

## Notes
- Lifetime is in redraw. If there is 4 viewport redrawing, the lifetime decrement by 4 for each window redraw. This allows one viewport to be producer and another one being the consumer.
- Display happens at the start of overlays. Any added visuals inside of the overlays drawing functions will be displayed the next redraw.
- Redraw is not given to happen. It is only given if there is some scene / render update which tags the viewport to redraw.
- Persistent lines are not reset on file load.

Rel #137006

Pull Request: https://projects.blender.org/blender/blender/pulls/137106
2025-04-09 21:37:23 +02:00
Miguel Pozo
712e35a627 Cleanup: Don't use atomic aliases 2025-04-09 20:05:29 +02:00
Bastien Montagne
bb39cfc4ee Fix compiling Blender with USD in clang19.
Some headers are missing again it'd seem...

Pull Request: https://projects.blender.org/blender/blender/pulls/137212
2025-04-09 19:07:36 +02:00
Pablo Vazquez
3e8801849f UI: Make auto-run scripts setting off by default
Even though the default startup already has `Trusted Source` and
`Auto Run Python Scripts` off by default, when resetting their values
to default (right click, Reset to Default) they would be turned on.

It was simply missing explicitly setting this off by default.

Pull Request: https://projects.blender.org/blender/blender/pulls/137205
2025-04-09 18:57:13 +02:00
Hans Goudey
63beb6afb3 Fix #137145: Crash when enabling Auto Normalize in Weight Paint mode
Caused by d3f84449ad.

The problem was that one SharedCache referenced the data of another,
without using the shared_ptr mechanism that is typically used for that
case. I had forgotten to avoid this-- I already did a similar fix a couple
years ago for curves: b07085fe3c

This time I kept the result as part of the cache to avoid the overhead
of attribute access on every call to `Mesh::face_normals()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/137167
2025-04-09 17:57:12 +02:00
Habib Gahbiche
93f0867ba6 Cleanup: use dedicated math function for comparison with zero
Pull Request: https://projects.blender.org/blender/blender/pulls/137221
2025-04-09 17:20:18 +02:00
Jun Mizutani
115d809358 UI: Theme: Increase scrollbars contrast in light theme
Enhance the contrast and make the scrollbar more visible in the light theme.

Pull Request: https://projects.blender.org/blender/blender/pulls/137195
2025-04-09 17:02:09 +02:00
Miguel Pozo
176865062a Draw: Skip empty passes
Allow detecting passes that can be skipped without side-effects and
don't submit them.
Eases debugging and profiling, and may provide a performance
improvement.

Pull Request: https://projects.blender.org/blender/blender/pulls/135875
2025-04-09 15:34:38 +02:00
Habib Gahbiche
74818141a5 Fix: Assert division by zero when ellipse mask size is zero
`BLI_assert(b[i] != T(0));` assert in `VecBase operator/(const VecBase &a, const VecBase &b)`. Not an issue in release mode because the result of `math::length(x/0)` evaluates to zero.

Pull Request: https://projects.blender.org/blender/blender/pulls/137203
2025-04-09 14:55:26 +02:00
YimingWu
5fe1051839 UI: Move "Active Spline" panel to viewport.
The "Active Spline" panel used to be inside curve properties tab,
however the property is dependent on spline selection, so it makes more
sense to put this panel in the viewport, just below the "Transform"
panel, in edit mode this panel also edits active element so visually
they belong together.

Resolves #134208

Co-authored-by: Pratik Borhade <pratikpb2123@noreply.localhost>
Pull Request: https://projects.blender.org/blender/blender/pulls/134217
2025-04-09 14:41:01 +02:00
Sergey Sharybin
30b962b3d8 Cycles: Optimize 3d and 4d noise
The goal is to reduce the affect of the fmod() used in the noise code,
which was initially reported in the comment:

    https://projects.blender.org/blender/blender/pulls/119884#issuecomment-1258902

Basic idea is to benefit from SIMD vectorization on CPU.

Tested on Linux i9-11900K and macOS on M2 Ultra, in both cases performance
after this change is very close to what it could be with the fmod() commented
out (the call itself, `p = p + precision_correction`).

On macOS the penalty of fmod() was about 10%, on Linux it was closer to 30%
when built with GCC-13. With Linux builds from the buildbot it is more like 18%.

The optimization is only done for 3d and 4d noise. It might be possible to
gain some performance improvement for 1d and 2d cases, but the approach would
need to be different: we'd need to optimize scalar version fmodf(). Maybe
tricks with integer cast will be faster (since we are a bit optimistic in the
kernel and do not guarantee exact behavior in extreme cases such as NaN inputs).

Pull Request: https://projects.blender.org/blender/blender/pulls/137109
2025-04-09 13:40:10 +02:00
Falk David
58fa6a50ce Fix #137152: Grease Pencil: Layer flag is overridden during conversion
Broken by 4c9c9af2d6.

When Grease Pencil objects get converted (<= 4.2 to >= 4.3)
the code copies the legacy color over to the new one.
The issue is that the new color is a `float[3]` not a
`float[4]`! Thus the `flag` after the `color` was getting
overridden.

This fixes the issue by replacing the `copy_v4_v4` with a
`copy_v3_v3`.

Pull Request: https://projects.blender.org/blender/blender/pulls/137161
2025-04-09 13:38:21 +02:00
Habib Gahbiche
f77245e523 Clneaup: Node gizmos: check nullptr before flag access
Pull Request: https://projects.blender.org/blender/blender/pulls/137204
2025-04-09 13:32:56 +02:00
Campbell Barton
82a37e143f Fix #136563: Crash clicking on a light after it has been deleted
Failure to refresh the highlighted gizmo meant that clicking
on a highlighted gizmo would attempt to activate it even though
it's poll function failed - which crashed in this case.

Resolve the common-case by ensuring a call to refresh the gizmo-map
causes the event system to re-evaluate the highlighted gizmo,
even if the cursor doesn't move.

Since it's still possible the call to "refresh" the gizmo is missed,
gizmo_tweak_invoke now checks the gizmo-groups poll succeeds with an
assert and early return if it doesn't. This would have prevented the
crash although the highlighted-gizmo still won't be reset - causing
the cursor to display as if it's over a gizmo until it's moved.
2025-04-09 11:21:55 +00:00