Commit Graph

118881 Commits

Author SHA1 Message Date
Harley Acheson
a043a0e74d UI: Increase Gizmo 3D Part Hit Size For Pens
Gizmos that contain 3D parts, like the rounded lines of the "Rotate"
gizmo, have a fairly small hit size that make it hard to grab with a
tablet pen. This PR just increases the radius around the pointer
position while using a pen.

Pull Request: https://projects.blender.org/blender/blender/pulls/136847
2025-04-10 18:38:23 +02:00
Hans Goudey
4c38327ea2 Cleanup: Explicitly define default constructor for StrokeCache
This is helpful for #133123 where we want to use std::unique_ptr for
a struct with a definition that's ideally unavailable in sculpt_intern.hh.
Just adding the constructor changes the initialization of the struct,
so I added explicit defaults for the struct's fields.

Pull Request: https://projects.blender.org/blender/blender/pulls/137233
2025-04-10 18:24:04 +02:00
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
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
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
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
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
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
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
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
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
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
Pratik Borhade
ff85c97278 Fix: Grease Pencil stats in status bar when in edit mode
When in edit mode, wrong stats info is shown for grease pencil. Move the
GP condition above so it is processed before `OB_MODE_EDIT`

Pull Request: https://projects.blender.org/blender/blender/pulls/137194
2025-04-09 11:46:12 +02:00
Jacques Lucke
8674ac339b Cleanup: avoid verbose redundant type names 2025-04-09 11:20:24 +02:00
Campbell Barton
12f0164eb0 CMake: match defines & CMake variable names
Avoid mistakes with these variables getting mixed up
(see: bf03a2684b).

Ref !137183
2025-04-09 08:44:36 +00:00
Jacques Lucke
8f52d535ac Refactor: Geometry Nodes: improve accessing contextual tree log data
The original motivation for this was to prepare the API to support having more
than one tree log for each zone. Currently, there is always a well defined tree
log for each zone (when the inspection index is taken into account). However,
for closures that is less true and there may be more than one equaly valid tree
log. While we might still want to show only one value per socket initially, it
would probably be nice in the future to support accessing information from
multiple evaluations at the same time (also for loops).

None of this is implemented here though, it's just a refactor with no expected
functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/137166
2025-04-09 09:53:48 +02:00
David Murmann
73efe738e4 Fix #135696: Alembic: Interpolate curve control points
Reading curves from alembic files did not interpolate the curves between
frames, leading to incorrect motion blur. This uses the existing
`use_vertex_interpolation` flag on the MeshSequenceCache to enable the
subframe interpolation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135698
2025-04-09 06:50:25 +02:00
Harley Acheson
840f6f2e4c UI: FullScreen Remove Outline and Fix One Pixel Offset
When toggling area "Fullscreen" with Ctrl-Spacebar, there is a one
pixel vertical change in the top of the area. This fixes that,
removes the border and active area outline. Looks much nicer.

Pull Request: https://projects.blender.org/blender/blender/pulls/137184
2025-04-09 04:44:37 +02:00
Campbell Barton
b024fe041e Cleanup: use more descriptive names for the IRIS format
Also add some code-comments.
2025-04-09 01:47:02 +00:00
Campbell Barton
6d8d37558a Cleanup: replace outdated function names in __func__ in error messages 2025-04-09 11:32:21 +10:00
Campbell Barton
7a23d7aba4 Fix: error writing & loading corrupt IRIS files
- Files cannot exceed 65535 width or height,
  attempting to write 65536 would write a zero sized image.
- Ensure that zero sized imbufs are never loaded.
2025-04-09 11:28:58 +10:00
Campbell Barton
35f5877ac3 Fix: incorrect iris image header detection
The first two bytes were being checked in the wrong order,
if files using this header were loaded they would detect as IRIS files
from imb_is_a_iris which would then fail to load (printing errors).
2025-04-09 11:05:47 +10:00
Campbell Barton
e94068e8d2 PyAPI: add "image_webp" build option
Match other image_* format booleans.
2025-04-09 10:26:55 +10:00