Commit Graph

150077 Commits

Author SHA1 Message Date
Campbell Barton
7e9aab9d57 Fix #137366: UI: wrong render slot names
Regression in [0] caused by passing in the size instead of the string
length to the UTF8 stripping function.

[0]: 94aabc0dbe
2025-04-12 09:50:14 +10:00
Harley Acheson
0354136775 UI: Minimum Height for Timeline Marker Operations
When Timeline (and similar editors) is reduced to a just the height of
two headers you can still change the play head. Except if you have any
markers and then marker selection operator interferes. This PR sets a
minimum area height for marker operations. This minimum differs if you
hide the header.

Pull Request: https://projects.blender.org/blender/blender/pulls/137312
2025-04-12 01:38:14 +02:00
Nicola
0373a4ef94 Sculpt: Add BVH node parent index to optimize bounds update
Previously, the BVH bounds were updated with a top-down approach
starting at the root. As explained in #136471, algorithms that visit
every node of the tree can become a bottleneck when sculpting high-res
meshes.

This patch refactors `flush_bounds_to_parents` by using a bottom-up
approach starting from the dirty leaf nodes. This requires calculating
and storing the parents of the nodes during the BVH build.

The change reduces the overhead measured in #136471 to near zero. The
same tests give the following results:

| Radius | Node Ratio | Speedup |
|--------------|---------|------------|
| 0.10m | 297 | 1.25x |
| 0.25m | 297 | 1.23x |
| 0.50m | 551 | 1.18x |
| 1.00m | 1930 | 1.13x |

where node ratio is the ratio between total nodes and nodes affected by
the brush. For reference, typical ratios when sculpting something like
a character are very roughly:

- tens when sculpting main forms
- low hundreds when sculpting secondary forms
- high hundreds to thousands when sculpting tertiary details

Pull Request: https://projects.blender.org/blender/blender/pulls/137019
2025-04-12 00:50:03 +02:00
Jesse Yurkovich
e45a13118d Fix #116612: Load in USD skeleton rest transforms
Import the initial set of rest transforms as the Armature's rest pose,
even if there's no animation for the bones. The rest transforms are
already being written out during export.

Pull Request: https://projects.blender.org/blender/blender/pulls/135079
2025-04-11 22:47:49 +02:00
Sean Kim
64a9b02644 Cleanup: Change parameters for SCULPT_brush_plane_offset_get
* Switches `Sculpt` for `Brush` since the former was just used to access
  the latter.
* Simplifies the code to a single ternary.
* Renames and moves the method into the ed::sculpt_paint namespace

Pull Request: https://projects.blender.org/blender/blender/pulls/137368
2025-04-11 22:39:37 +02:00
Clément Foucault
9990273d04 GPU: Change Type enum to use lower case values
This is to help for future resource declaration
using macros.

Rel #137261

Pull Request: https://projects.blender.org/blender/blender/pulls/137367
2025-04-11 22:39:01 +02:00
Jacques Lucke
aab2b6004b Geometry Nodes: add compute context cache
For various purposes we traverse the computation done by a node tree (e.g. for
gizmos and socket usage infeferencing). For that we generally have to keep track
of the compute context we're in at any given time. During the traversal, it's
common to enter and exist the same compute contexts multiple times. Currently,
we'd always build a new compute context when that happens. That happens even
though the old one is generally still around, because other data may reference
it. This patch implements a `ComputeContextHash` type that avoids rebuilding the
same compute contexts over and over again.

I'm considering to also replace the usage of `ComputeContextBuilder` with this
cache somehow, but will see how that works out.

The reason I'm working on this now is that I have to traverse the node tree a
bit again to find where closures might be evaluated. I wanted to be able to
cache the compute contexts for a while already.

Pull Request: https://projects.blender.org/blender/blender/pulls/137360
2025-04-11 21:36:41 +02:00
Nicola
3c51029ec7 Fix: Plane brush symmetry passes do not use the stabilized normal
The issue is the following:
- The stabilized normal for the main pass is calculated in
`calc_brush_plane`
- The normal is (wrongly) recalculated in `update_sculpt_normal`. This
is a common problem that other brushes have. The specific issue with the
Plane brush is that the recomputed normal is not stabilized.
- For symmetry passes, this non-stabilized normal is then assigned to
the brush in `calc_brush_plane`

This PR fixes the issue by explicitly returning false in
`sculpt_brush_needs_normal` when the Plane brush is used. A more proper
refactor would be needed, but this can easily be ported to 4.4.

Pull Request: https://projects.blender.org/blender/blender/pulls/137271
2025-04-11 21:08:50 +02:00
Hans Goudey
0ee5e6ded7 Depsgraph: Use C++ Stack class
Use `blender::Stack` instead of `BLI_Stack`. Theoretically this can
improve performance because it makes use of inlining to remove function
call overhead and give the compiler more information. I observed a build
time improvement of about 4%, from 1156 to 1113 ms with 30k cube objects.
Notably, now `deg_graph_flush_visibility_flags` doesn't call any
non-inlined functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/137355
2025-04-11 19:55:17 +02:00
Sean Kim
9d57b947d9 Fix: Radial symmetry caculation for planar brushes incorrect
Introduced in e41ed565ff

Pull Request: https://projects.blender.org/blender/blender/pulls/137325
2025-04-11 19:21:14 +02:00
Sean Kim
84f29a0e72 Refactor: Extract plane brush node calculation to plane.cc
This commit renames the `types.hh` file to `brushes.hh` as an attempt to
make brush implementations more independent and begin to unwind and
remove much of the logic in `sculpt.cc`.

As a first step, this moves the node mask calculation exposed for the
plane brush into `plane.cc` and exposes the function header into
`types.hh`.

Pull Request: https://projects.blender.org/blender/blender/pulls/137020
2025-04-11 19:20:22 +02:00
Brecht Van Lommel
c8f9fdc0c8 Fix: Cycles CUDA errors after recent changes for scene update
Broken by 86b67a20d6. Delay upload of shader data to GPU until
after kernels have been loaded.

Pull Request: https://projects.blender.org/blender/blender/pulls/137349
2025-04-11 19:14:14 +02:00
Clément Foucault
bb52754652 GPU: Use f suffix for float literals
They are actually already some literals with the `f` suffix
that are in our shader codebase and we never had problem in
the past 5 years (or even 8 years).

So I think it is safe to do and improves convergence of codestyles.

Pull Request: https://projects.blender.org/blender/blender/pulls/137352
2025-04-11 18:28:45 +02:00
Jacques Lucke
183dfa68c9 Geometry Nodes: log closure evaluations
The goal is to log information about which closures are evaluated where. This
information is not exposed in the UI yet, but will be needed to be able to debug
the evaluation and inspect socket values within closures.

Pull Request: https://projects.blender.org/blender/blender/pulls/137351
2025-04-11 17:58:40 +02:00
Anthony Roberts
2ccaba94aa Deps: Windows ARM64: Add new Manifold library
4.5 Library tracking issue: #136540
Ref: #135261

Pull Request: https://projects.blender.org/blender/blender/pulls/137348
2025-04-11 17:54:51 +02:00
Miguel Pozo
7554ceba2b Fix: Metal: textureGather
Metal doesn't support the last textureGather parameter.
2025-04-11 17:22:12 +02:00
Hans Goudey
d1df97bd48 Depsgraph: Use LinearAllocator to allocate Relations
I observed allocation becoming a bottleneck when building the depsgraph
with scenes with many simple data-blocks. One of the main culprits was
the struct that encodes relations between nodes in the graph.

Instead of allocating each `Relation` with a separate allocation call,
combine them into a `LinearAllocator`. That is must faster because it
allocates in large chunks and just bumps an offset on each allocation.

In a test file with 30 thousand cube objects, I observe a 1.18x
improvement in depsgraph evaluation time, from 1370 to 1163 ms.

The depsgraph isn't completely re-allocated when it's rebuilt, so the
allocator added in this PR has to be cleared manually. In the future,
it can be used for other structs or potentially strings.

Pull Request: https://projects.blender.org/blender/blender/pulls/137303
2025-04-11 17:14:07 +02:00
Miguel Pozo
aafd5b677a Fix #137121: Overlay: Vertex Flickering in X-Ray View
Avoid aliasing and interpolation issues by sampling nearby pixels.

Pull Request: https://projects.blender.org/blender/blender/pulls/137154
2025-04-11 17:06:10 +02:00
Omar Emara
3b43f6ba57 Compositor: Make Rotate Star 45 option an input
This patch converts the Rotate Star 45 option in the Glare node into an
exposed input, with code to handle backward and forward compatibility.

Pull Request: https://projects.blender.org/blender/blender/pulls/137140
2025-04-11 16:51:03 +02:00
Jacques Lucke
6b92972dcc Geometry Nodes: initial boilerplate for viewer path for closure evaluation
This will be necessary for supporting viewers inside of closures.
2025-04-11 16:41:46 +02:00
Josh Belanich
3c70758f00 Fix #137081: Vulkan: Crash during animation playback
A couple of memory leak fixes for the vulkan backend.

We increment the submission_id on render_graphs upon reset. This
triggers cleanup of anything tracked as a VKResourceTracker. Notably
uniform buffers created for push constant fallbacks. This fixes a memory
leak that was accumulating VKUniformBuffers every frame without cleaning
them up.

Reset resource pools when a swapchain image is presented. This ends up
calling vkResetDescriptorPool, freeing up descriptor set resources. This
fixes a memory leak that was accumulate descriptor sets and pools over
time without freeing them.

Pull Request: https://projects.blender.org/blender/blender/pulls/137305
2025-04-11 14:46:35 +02:00
Campbell Barton
f9b9644cbb Fix: failure to save an existing Cineon file
Saving a Cineon fail a second time would fail because it would
default to 8 bits per sample, where only 10 bits is supported.
2025-04-11 22:31:05 +10:00
Campbell Barton
f6757abae2 Fix: crash saving large Cineon images
When the offset exceeded INT_MAX, the offset would wrap to a
negative number then attempt to read/write outside the buffer bounds.
2025-04-11 22:31:05 +10:00
Brecht Van Lommel
86b67a20d6 Refactor: Cycles: Move scene update earlier in render iteration update
This will be needed to determine if there are volumes in the scene, before
allocation passes to aid volume sampling.

The kernels are now also loaded in the middle of scene update, at a place
where kernel features are known but before the kernels are needed for
displacement and background light evaluation..

Updating the camera to final resolution for progressive refinement still
happens later.

Pull Request: https://projects.blender.org/blender/blender/pulls/137228
2025-04-11 14:28:22 +02:00
Brecht Van Lommel
c4db213127 Refactor: Cycles: Use full resolution for viewplane bounds check
Results should be unchanged, but it's confusing if these use the progressive
refinement resolution instead of the full resolution.

Pull Request: https://projects.blender.org/blender/blender/pulls/137228
2025-04-11 14:28:22 +02:00
Jeroen Bakker
a2338e3eca Fix #137329: Overlay: Cursor not always visible
On certain platforms the 3d cursor wasn't visible. The reason was that
the shader read garbage in `gpu_attr_1_fetch_unorm8` and interpreted the
data to be packed, resulting in loading incorrect colors.

Pull Request: https://projects.blender.org/blender/blender/pulls/137336
2025-04-11 13:59:17 +02:00
Pratik Borhade
b8f77fbc06 Fix: Curve status bar stats
Point count is missing in object and sculpt mode for Curves object.
Added an extra if block that handles this case. Added a new variable
`totcurvepoints` to track curve points count. Otherwise it is aggregated with
other points count (eg. mesh) which result in wrong number in status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/137199
2025-04-11 12:41:33 +02:00
Pratik Borhade
cc4b90ba55 Fix: VSE: SEQUENCER_OT_change_effect_input.swap not found
Found this during #137299
Python error observed when calling batch rename operator on sequencer
strips. `change_effect_input` operator doesn't have any enum property.
Remove operator_enum to fix the error.

Pull Request: https://projects.blender.org/blender/blender/pulls/137331
2025-04-11 12:32:04 +02:00
Sergey Sharybin
9f999adfc6 Fix #137230: Cycles OpenPGL crash with shadow catcher
The crash was caused by an overflow in the opgl_path_segment_storage
array. It happened because shadow catcher paths would write to the
segments but not clear them. This made it so the next render loop
iteration for the main path starts with non-empty segments in the
guiding data.

Disable training when megakernel is called for the shadow catcher
state.

To ensure this issue is not forgotten when the guiding is ported to
GPU add asserts in the `guiding.h`. While it is a no-op for default
GPU kernels sometimes we do compile debug kernels. But also it acts
as a plain-text reminder to the future-us in working on the code.

There is now also an assert before the main path megakernel to help
catching such cases in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/137291
2025-04-11 12:31:22 +02:00
Pratik Borhade
1c51b10b15 Fix #132028: Outliner: Skip search filtering in Lib override hierarchy
As mentioned in #132028, search box is intentionally skipped for lib
override hierarchy view mode of outliner. But search filtering from
previous mode still builds the tree with searched elements. Added a new
function that checks the outliner view mode. If it's lib
override-hierarchy, skip search filtering.

See images attached in PR description.

Pull Request: https://projects.blender.org/blender/blender/pulls/137086
2025-04-11 11:51:29 +02:00
Campbell Barton
44444a550e Fix #135039: Vulkan: Blender does not start with Wayland in GNOME
Remove logic to access LIBDECOR's underlying XDG window since it
required an "dummy-buffer" workaround which caused a crash with recent
drivers that require a DMA buffer.

This introduces a slight flicker on startup in some cases
see code-comments for details.

Ref: !136289
2025-04-11 09:44:46 +00:00
Campbell Barton
b1c55c6988 Cleanup: remove unused PyConstraint enum 2025-04-11 19:40:47 +10:00
RedMser
ba04393fde Cleanup: Remove deprecated Python and Rigid Body Joint constraints
Remove long-deprecated constraints that will likely never be
implemented in this form.

- Rigid Body Joint Constraint was removed in 2.80, but some references
  remained in the code. Versioning code was written that tried to
  remove them on load, but since constraint initialization code sets
  the type to CONSTRAINT_TYPE_NULL before versioning gets a chance,
  the versioning code ended up never running. This has all been
  removed.
- Python/Script Constraint never worked since 2.50 and showed an error
  message in the UI panel.

These constraints now load as 'null' constraint, as seems to be
(looking at the code) the way that Blender currently deals with
removed constraint types. These still show up in the outliner and
python API, but have no UI panel. Removing such constraints completely
will be left for another time, as it is beyond the scope of removing
these two specific constraint types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136672
2025-04-11 11:38:29 +02:00
YimingWu
b0e4c31bb0 Fix #134494: Grease Pencil: Tint modifier fix on gradient material
When a stroke has a gradient fill material that starts with a color with
zero alpha, the tint modifier would behave as if it's not effective at
all, this is caused by referencing source material color only with the
starting color in this case, and since the alpha is zero, the tint is
applied wrongly. Now use average color of start and end color of the
gradient to mix with the tint modifier color.

Note that this isn't technically correct still, since material gradient
is computed in the shader, and tint modifier isn't able to get the
acutal fill color at a given vertex (especially for the radial gradient
case) however the result of this patch looks visually good enough, and
users can always set all alpha to 1 when they feel the color is off.

Pull Request: https://projects.blender.org/blender/blender/pulls/134549
2025-04-11 11:34:58 +02:00
Alaska
44eb32f68d Release note tools: Only check for issue numbers if they contain a space before them
In the bug fixes per release tool, we got a list of bug reports that
were fixed by a commit using a regular expression that pulled the
number from `#NUMBER`.

However in specific situations, this resulted in the retrieval of the
wrong issue numbers, and ultimately a mis-classification of a
fix commit.

For example 778b1efd84 contains `Fixes blender/blender-manual#NUMBER`

We were extracting the NUMBER from this and treating it as if it was
a bug report for the `blender/blender` repository, which means it
points to the wrong bug report.

This commit fixes this issue by taking a simple approach of only
checking for report numbers that match the format:
`SPACE#NUMBER`, which will eliminate cases like
`blender/blender-manual#NUMBER`.

Pull Request: https://projects.blender.org/blender/blender/pulls/136744
2025-04-11 10:58:24 +02:00
Falk David
5aea7b4591 Fix #136243: Grease Pencil: Automerge doesn't propagate vertex groups
The `vertex_group_names` of the `CurvesGeometry` was not being
propagated leading to vertex group data getting lost.

Pull Request: https://projects.blender.org/blender/blender/pulls/137296
2025-04-11 10:53:58 +02:00
Campbell Barton
6d6c695619 Fix: integer overflows calculating the number of pixels in imbuf
Use IMB_get_pixel_count to prevent integer overflow.
2025-04-11 18:52:38 +10:00
Habib Gahbiche
b148593c5d Compositor: implement gizmo for ellipse mask node
Implement ellipse gizmo for the ellipse mask node. Behavior and implementation are similar to the box node with the exception that corners are always visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/137115
2025-04-11 10:32:43 +02:00
Habib Gahbiche
51c2cf2b9d Fix #137268: CTRL+Shift clicking creates additional Material Outputs
Only geometry nodes is allowed to have no active output (the group output node acts as an explicit node tree output). The previous fix only considered geometry nodes and compositor cases, which was not enough.

Pull Request: https://projects.blender.org/blender/blender/pulls/137288
2025-04-11 10:04:56 +02:00
Campbell Barton
d256b7f688 Fix: crash loading & saving large Iris images
Integer overflow in IMB_convert_rgba_to_abgr assigned a negative value
to size_t resulting in a large value which wrote past the buffer bounds.
2025-04-11 17:40:11 +10:00
Campbell Barton
37148d6711 Fix: crash saving large WebP images
WebP images can be at most 16383x16383,
however saving sizes which overflowed an integer would crash.

- Early exit with an error when the image is too large.
- Replace integer offsets with size_t.
2025-04-11 07:33:48 +00:00
Campbell Barton
2cbb07d7ad Fix: error reading RLE compressed Iris images
Regression in [0] which used a 4x large size bounds check
to prevent a buffer read overflow reading the RLE table.

[0]: 829916f4e5
2025-04-11 15:22:17 +10:00
Campbell Barton
d0157b0b70 UI: various minor fixes/changes to file BUTTONS_OT_file_browse
The internal logic for this operator has become broken over time.

- Relative paths could expand using, then be made relative
  using the blend file - but only for directories (not files).
- A trailing slash was added for directories (noted as important),
  but then ignored when the relative option was disabled.

Simplify the logic here:

- Use the same relative path logic for all paths.
- Add the trailing slash for the directory based on the RNA type
  instead of checking if the underlying path is a directory.
- Remove the logic that stripped the file-name off non-directories
  since the file selector doesn't allow a filename to be set
  when selecting a directory.
2025-04-11 14:11:57 +10:00
Sean Kim
5cacb7cedd Tests: Overhaul Sculpt performance tests
This commit makes a number of changes to the sculpt performance tests,
aimed at measuring more consistent data and making it easier to extend
the test cases.

* Repeats tests a minimum of 5 times up to 100 times, with a timeout
  of 5 seconds for a given test case to run, averaging the duration of
  the brush strokes to stabilize the value
* Sets the brush from the script instead of having it defined in each
  file, preventing the need to duplicate benchmark files.
* Uses the newly defined `override_location` property to allow defining
  the stroke in screen-space and repeating strokes multiple times
  without regenerating the base mesh
* Adds tests for the smooth brush, as basic neighbor calculations
* Adds tests for dyntopo sculpting
* Renames the base mesh tests to have a "mesh_" prefix as the data is
  inherently discontinuous here.

Related benchmark PR: blender/blender-benchmarks#2

Part of #133926

Pull Request: https://projects.blender.org/blender/blender/pulls/133841
2025-04-11 05:26:25 +02:00
Campbell Barton
aff2738dc5 PyAPI: match the more verbose identifier for blend-relative paths
Use the more descriptive identifier
when setting the option via `bpy.props`.

Missed this when updating the name elsewhere.
2025-04-11 13:06:51 +10:00
Campbell Barton
024ab180ca UI: hide "Relative Path" in the file selector when it's not supported
Hide the the relative option when browsing paths that don't support
relative paths.
2025-04-11 02:48:24 +00:00
Campbell Barton
e1ac1a71ff RNA: use the file-path subtype & blend relative flag where supported 2025-04-11 12:22:39 +10:00
Campbell Barton
d6825c863f Cleanup: remove redundant PropertyFlag casts which can hide errors 2025-04-11 12:02:07 +10:00
Campbell Barton
b2ee52775a Cleanup: remove invalid ParameterFlag cast to PropertyFlag
Correct invalid mixing of different flag types,
this happened not to cause any problems but it's error prone.

There is no need to set the "required" flag for return values.
2025-04-11 02:01:10 +00:00
Campbell Barton
b4d09517c1 RNA: enable flag the font-directory as relative
Based on it's usage it wasn't clear if this supported a relative prefix.

Enable the flag & add comments clarifying the file-selector
will expand the relative prefix.
2025-04-11 01:08:54 +00:00