Commit Graph

150077 Commits

Author SHA1 Message Date
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
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
quackarooni
a345f86e33 Fix #137169: "Panel Toggle" poll errors if a panel's first child item is a panel
The poll function for `NODE_PT_node_tree_interface_panel_toggle` looks at the
first child item and checks if it has the `is_panel_toggle` property set to
`True`. This fails if the first child is a panel, which doesn't have that
property.

The fix is to simply fall back to returning False if the first child item does
not have the aforementioned property.

Pull Request: https://projects.blender.org/blender/blender/pulls/137171
2025-04-09 10:17:41 +02: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
Campbell Barton
bf03a2684b Fix: error with CMake checking the wrong WEBP variable 2025-04-09 10:21:37 +10:00
Campbell Barton
2dc4a94e8b Cleanup: use consistent "format_" prefix for imbuf image formats 2025-04-09 00:16:20 +00:00
Campbell Barton
24dd6dd23e Cleanup: quiet warnings with headless builds 2025-04-09 09:55:26 +10:00
Harley Acheson
166d45b80f UI: Padding When Opening Menu When One is Already Open
When you open a menu or popover, moving your mouse to a neighboring
root menu button will switch to that one. For example when you open the
"File" menu and move to the right to have "Edit" open automatically.
This currently causes problems with some neighboring menus. This PR
adds a safety padding to the open item. This generally means that once
you open a menu, you will need to move your mouse into the neighbor's
content, not just hit the edge.

Pull Request: https://projects.blender.org/blender/blender/pulls/135692
2025-04-08 22:45:39 +02:00
Sean Kim
a0eedd2193 Fix: Multiplane Scrape sculpt plane can be incorrect
Similar to !136965

Pull Request: https://projects.blender.org/blender/blender/pulls/137015
2025-04-08 22:36:06 +02:00
Harley Acheson
110b8fee41 UI: Do Not Open Neighboring Menu if Open One is Wide
When a menu is open, moving your mouse to a neighboring menu can cause
that menu to open, closing the open one.  This is very problematic when
the open menu is very wide because users are likely to travel over
other menus while moving toward items in far columns. Typically this is
the "change area" menu, but this can happen with any wide menu. This PR
just checks the menu width and turns off this feature when it is wide.

Pull Request: https://projects.blender.org/blender/blender/pulls/136528
2025-04-08 22:01:40 +02:00
Harley Acheson
b4194b08d4 UI: Do Not Full Hide Scroll Bars When Region Overlap
Currently scroll bars that are in regions that are set to "region
overlap" (like Tool Bar and Side Bar using a transparent background)
will fully hide when your mouse is not near them. This PR removes that
feature so that they are treated like in other areas. This way you can
always see that there are portions of the region scrolled away and what
proportion. A less jarring transition since it is only 0.4 - 1.0,
rather than 0.0 - 1.0.

Pull Request: https://projects.blender.org/blender/blender/pulls/136571
2025-04-08 21:32:43 +02:00
Harley Acheson
b847cc0426 UI: Region Scaling Edge Highlighting
This draws a highlight line on the active edge of regions, like side
bars and toolbars, while dragging to resize them. Similar as we do for
area resizing. This has marginal utility while using a mouse, but is
much more important when using a pen. More so when the pen has a
minimum pressure for clicking. Even more so when using touch as your
finger covers the hit target.

Pull Request: https://projects.blender.org/blender/blender/pulls/136337
2025-04-08 21:12:40 +02:00
Jacques Lucke
93deafd4a3 Refactor: Depsgraph: add const variants of a couple depsgraph query functions
This avoids the need for `const_cast` when using the depsgraph query functions
like `DEG_get_original_id` in many cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/137162
2025-04-08 18:55:22 +02:00
Richard Antalik
bf18e8f814 UI: Filter visible tabs in Properties Editor
This commit allows to specialize or optimize properties editor for
particular workflows by hiding individual tabs. The filtering is done on
editor level, currently in editor options popover panel.

Primary motivation was to allow strip properties to be moved to
properties editor. The filtering is beneficial, as usually it does not
make sense to show strip propeties in modelling workspace and in video
editing workspace other properties would introduce quite a bit of noise.

Ref. #115626

Pull Request: https://projects.blender.org/blender/blender/pulls/115624
2025-04-08 18:43:18 +02:00
Leon Schittek
796e7edfce Nodes: Support snapping when resizing nodes vertically
The snapping was originally only implemented for resizing nodes
horizontally. But since frame nodes can be resized vertically, it
makes sense to also allow snapping in that direction as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/137116
2025-04-08 18:17:01 +02:00
Sean Kim
a4004c3ac4 Fix: Revert some C++ math changes for clay_thumb.cc
* math::normalize doesn't give the same result as normalize_m4
* rotate_direction_around_axis expects a unit vector unlike
  rotate_v3_v3v3fl

Pull Request: https://projects.blender.org/blender/blender/pulls/137159
2025-04-08 18:15:13 +02:00
Leon Schittek
6ba917cd18 Fix: Nodes: Make snapping during resizing more consistent.
Make the snapped size of the node consistent regardless of whether
they are resized by dragging on the left or right edge.

Pull Request: https://projects.blender.org/blender/blender/pulls/137046
2025-04-08 18:03:28 +02:00
Hans Goudey
42adf00f53 Fix #137098: Crash when saving file in edit mode from python load_post handler
Before accessing the BMesh from BMEditMesh, it should be null checked.

Pull Request: https://projects.blender.org/blender/blender/pulls/137155
2025-04-08 18:00:03 +02:00
Jacques Lucke
86341ae826 Fix: ASAN build does not link
When building an ASAN build, I get this link error currently:
```
ld.lld: error: version script assignment of 'global' to symbol '__progname' failed: symbol not defined
ld.lld: error: version script assignment of 'global' to symbol 'environ' failed: symbol not defined
```

The solution (as proposed by Brecht) is to change the symbol names into patterns with a wildcard.
That way the linker does not fail when the symbols are not found.

Pull Request: https://projects.blender.org/blender/blender/pulls/137153
2025-04-08 17:13:59 +02:00
quackarooni
17b5ab6965 Geometry Nodes: Field Statistic Nodes
Adds field versions of the operations from Attribute Statistic, can
support grouping via Group IDs. These operations are added as separate
nodes: `Field Average`, `Field Min & Max`, & `Field Variance` which
group the different statistic operations according to their use.

Supported Data Types:
- Field Average - (Float, Vector)
- Field Min & Max - (Float, Integer, Vector)
- Field Variance - (Float, Vector)

Pull Request: https://projects.blender.org/blender/blender/pulls/134640
2025-04-08 17:12:08 +02:00
Sergey Sharybin
5b0ed683a0 Cycles: Make select() and mask() for vectorized float work on CPU and GPU
Pull Request: https://projects.blender.org/blender/blender/pulls/137148
2025-04-08 17:04:18 +02:00
Jacques Lucke
8d1b7ce261 Fix: propagate warnings from closure zone to evaluate closure node 2025-04-08 16:50:49 +02:00
Sean Kim
ddd6403f11 Cleanup: Minor Clay Thumb brush plane calculation changes
* Removes unnecessary inverts
* Clarifys brush plane area normal usage
* Reduce scope of variables where possible
* Use equivalent C++ math apis

Pull Request: https://projects.blender.org/blender/blender/pulls/137013
2025-04-08 16:48:52 +02:00
Hans Goudey
d835c02607 Cleanup: Avoid capitals in Geometry Nodes Grease Pencil add menu
The capitals were only used for API compatibility when the add menu
was first added, they're not needed for new menus. Better to avoid
since they're non-standard for menu names.
2025-04-08 10:45:46 -04:00
Jacques Lucke
bf5339df14 Fix #137114: crash due to bad mesh ownership handling
When releasing a mesh from a `GeometrySet` one has to take manual control over
owner-management. In some cases, the geometry set was not the owner of the mesh,
but was just referencing it. This is generally fine in a limited set of
circumstances and can avoid copies. However, when taking ownership of the mesh
in the geometry set, one has to be sure that the geometry set actually has
ownership.

This is similar to what is done in e.g. `modifier_modify_mesh_and_geometry_set`.

Pull Request: https://projects.blender.org/blender/blender/pulls/137150
2025-04-08 16:11:52 +02:00
Sergey Sharybin
67fac1e391 Fix #137084: Image Editor shifts the images when Aspect Ratio is not 1.0
Seems to be an incorrect implementation of BLI_rctf_transform_calc_m3_pivot_min()
in 2a44bdfbd0.

Pull Request: https://projects.blender.org/blender/blender/pulls/137141
2025-04-08 15:27:47 +02:00
Falk David
20ce477ea0 Geometry Nodes: Add node to set the Grease Pencil depth order
Adds a new node to set the Grease Pencil depth ordering.

Here are the options:
* 2D Layers: Uses the Layer order + Stroke order to calculate the depth ordering.
* 3D Location: Uses the 3D position of the points as the depth.

This reflects the same setting that is available in the Grease Pencil
object-data properties.

The node is added to the `Grease Pencil` > `Write` menu.

Resolves #129458.

Pull Request: https://projects.blender.org/blender/blender/pulls/135914
2025-04-08 15:24:51 +02:00
Jeroen Bakker
7ecacbc3e6 Vulkan/OpenXR: Support VK_KHR_external_memory_win32
This PR add support to use a win32 handle to perform share render
result with the OpenXR vulkan instance. This is only possible when
the GPU matches. Otherwise a CPU roundtrip will be performed.

Pull Request: https://projects.blender.org/blender/blender/pulls/137093
2025-04-08 15:21:55 +02:00