Commit Graph

120319 Commits

Author SHA1 Message Date
Jacques Lucke
101b94fe92 Fix #140017: creating a node group from Bake node crashes
Extension sockets were not handled correctly. Those are not
exposed in the group.
2025-06-09 08:30:03 +02:00
Jacques Lucke
fd2be0026a Fix #137236: performance regression with nonsensical face material indices
From what I know, we don't really have a good way to detect whether a material
index is non-sensical in the right places. That's because the same material
index on a mesh may not make sense on one object but can still make sense on
another. This is the issue we fixed in the first place when the regression was
introduced.

What we can do though is to check which exact material indices a mesh is
actually using (not just the maximum). This allows us to skip a lot of work for
unused material indices. This doesn't help when a mesh has thousands of unique
non-sensical material indices, but it should be an improvement in the majority
of cases.

This patch adds a cache of used material indices to `Mesh`. The drawing code
requests that cache if the maximum material index is above some threshold (16
currently). We don't want to compute it all the time, because it requires
iterating over the mesh (at least once, then it is cached). So it's only worth
the extra cost of the there is at least one large material index. The threshold
also ensure that the large majority of scenes is not affected by this patch
performance wise.

Pull Request: https://projects.blender.org/blender/blender/pulls/139781
2025-06-09 08:10:48 +02:00
Richard Antalik
5f439c8e18 Fix #139863: Retiming sound does not tag depsgraph
After 9e4c26574a, `relations_invalidate_cache()` for sound strips
returns without doing anything, but VSE code relied on this function to
tag scene to update `ID_RECALC_SEQUENCER_STRIPS` which is mostly audio
related. Since the name of this enum value is not very descriptive,
clarifying comment was added.

Pull Request: https://projects.blender.org/blender/blender/pulls/139991
2025-06-09 01:22:29 +02:00
Campbell Barton
bb8c0b4397 Cleanup: spelling, use doxygen comments, move doc-string to declaration 2025-06-08 19:49:24 +10:00
Jason C. Wenger
8277d7e037 Fix crash dissolving two adjacent edges of a quad
Restore the BM_vert_is_edge_pair(v) check that was present prior to
!134017. In that PR, the edge pair check was moved up, to a previous
iteration pass, that checked the angle thresholds. However, even though
pairs were checked before, the process of performing edge merges might
change a neighboring vert such that it is no longer an edge pair.
Therefore it is necessary to check a second time.

Resolves regression in [0].

[0]: e418f7b1f1
2025-06-08 19:34:51 +10:00
Jason C. Wenger
0087d20e9c Fix the order dissolve angle is shown in the redo panel
The ordering of the Dissolve Selection panel in edge mode now matches
the ordering of the Dissolve Edges Panel.

Ref !139958
2025-06-07 12:54:17 +10:00
Jason C. Wenger
bfbc9c804c Fix bug in dissolve edges that was introduced in 4.4
A bug that was introduced in !131645 where the number of verts eligible
for dissolve was reduced, to prevent dissolving unrelated verts.

That PR changed the code to only do the dissolve check on verts at the
ends of selected edges, which solved bug #109765. However, this didn't
properly account for dissolving only one edge in a chain in a face pair.

This could result in cases where one of the vertices should be checked
but wasn't - if it wasn't selected.

Now when an edge is dissolved, each of its verts is checked,
and if it's in a chain, the VERT_MARK tag is moved down the
chain until it finds its natural endpoint.

Ref !139959.
2025-06-07 12:35:38 +10:00
Campbell Barton
def2a2d049 Logging: remove explicit newlines
CLOG adds newlines, including them in the string adds a blank line.
2025-06-07 12:13:16 +10:00
Sean Kim
23951e1b12 Fix #139846: Plane brushes behave incorrectly with constant falloff
When constant falloff is used, `BKE_brush_calc_curve_factors` doesn't do
any extra filtering of the given distances. The Plane brush previously
didn't filter the distances, leading to incorrect deformations when the
constant falloff was used.

To fix this, this commit makes a number of changes:
* `BKE_brush_calc_curve_factors` no longer sets the factor for an
  element to 0 if it is outside of the provided distance. This is
  replaced with an assert.
* The Plane brush and Cloth brush have an explicit
  `filter_distances_with_radius` added.

Pull Request: https://projects.blender.org/blender/blender/pulls/139851
2025-06-06 22:48:18 +02:00
Clément Foucault
36f1102756 GPU: GLProgram: Use unique pointer instead of movable object
This avoid issue with not moving the `std::mutex` that was
added in #136991.

Issue reported here https://projects.blender.org/blender/blender/pulls/139821#issuecomment-1592962

Pull Request: https://projects.blender.org/blender/blender/pulls/139937
2025-06-06 16:27:18 +02:00
Clément Foucault
9c305ef522 Fix: GPU: Metal: Compilation error 2025-06-06 16:25:19 +02:00
Jeroen Bakker
4a88c14d95 Fix #139917: Vulkan: Increase number of render frames
The number of render frames influences how long discarded memory will be
kept. There are platforms that require 5 frames to work succesfully.

Pull Request: https://projects.blender.org/blender/blender/pulls/139934
2025-06-06 16:02:47 +02:00
Clément Foucault
e0e5289138 Cleanup: GPU: Use CLOG instead of std::cout for profile error 2025-06-06 14:57:36 +02:00
Clément Foucault
023865b314 Vulkan: Add CPU profiling
This has limited use cases since it doesn't
profile the heavy part of the vulkan backend.

Almost 1:1 port of the metal implementation from #139551.
Doesn't cover rendergraph submission nor GPU timings.

Pull Request: https://projects.blender.org/blender/blender/pulls/139899
2025-06-06 14:39:51 +02:00
Bastien Montagne
a883f555ae Blender 4.5 Forward Compatibility for Long ID Names.
This commit enables Blender 4.5 to use (to some extent) blendfiles from
Blender 5.0 and later using 'long' ID names (i.e. ID names over 63 bytes).

On a more general perspective, it also introduces safer handling of
potentially corrupted ID names in a blendfile.

This is achieved by carefully checking for non-null terminated ID names
early on in readfile process, and then:
* Truncating and ensuring uniqueness of ID names.
* Doing similar process for action slot and slot users identifiers.
* In linking (and appending) context, such IDs are totally ignored. They are
  not listed, and are considered as missing if some other (valid) linked ID
  attempt to indirectly link them).
* Informing users through usual reporting ways.

Technically, this mainly changes two areas of the readfile code related to IDs
themselves:
* The utils `blo_bhead_id_name` that returns the ID name of an ID BHead,
  without actually reading that ID, now check for a valid null-terminated
  string of `MAX_ID_NAME` max size, and returns a `nullptr` on error.
  _This essentially prevents listing and linking such IDs, in any way._
* The actual ID reading code (`read_id_struct`) does the same check, and
  truncate the ID name to its maximum allowed length.
* Both of above checks also set a new FileData flag
  (`FD_FLAGS_HAS_LONG_ID_NAME`), which is used to ensure that ID names (and
  related actions slots identifiers) remain unique, and report to info to the
  user.

Implements #137608.

Branched out from !137196.

Co-authored-by: michal.krupa <michal.krupa@cdprojektred.com>
Co-authored-by: Campbell Barton <ideasman42@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/139336
2025-06-06 14:19:00 +02:00
Jeroen Bakker
c5317faec4 Fix #139898: Vulkan: Asan issue during color picking
Color picking reads 3 values from a texture that is backed by 4
channels. The conversion would also convert the 4th channel.

This is a short term fix. We should reconsider the usage of reading a
different number of elements than backed by the texture. But that
requires work in the color picking and python GPU module.

Pull Request: https://projects.blender.org/blender/blender/pulls/139929
2025-06-06 14:01:37 +02:00
Jeroen Bakker
9e221a10d3 Fix #139901: UI: Incorrect flow when drawing scopes
When drawing image scope the vulkan backend raised some asserts. After
checking them the issue was in the calling code, that could lead to
undefined behavior on other platforms as well.

It isn't allowed to have an immediate mode shader bound, when performing
batch drawing. There was also a point batch that didn't use any point
shader resulting in undefined behavior as well.

For 5.0 we should add this as a GPU module check.

Pull Request: https://projects.blender.org/blender/blender/pulls/139926
2025-06-06 14:01:02 +02:00
Sietse Brouwer
0c41c0372e Fix #132700: Grease Pencil: Strokes with locked materials receive weight value
With this fix strokes with locked materials are not affected any more
by the Grease Pencil weight paint tools. The vertex weights in
material-locked strokes are read-only: they are not changed, but the
weights do count for Average, Blur and Smear.

Pull Request: https://projects.blender.org/blender/blender/pulls/138900
2025-06-06 13:53:06 +02:00
Bastien Montagne
f6a9f082e9 Core: Add data-level support for new 'system IDprops' storage for Blender 4.5 forward compatibility with 5.0 blendfiles
This mainly adds DNA level IDProp storage for system properties, their
handling in data management code, and the forward-versioning code
copying back content from system properties into 'all-in-one' single
IDProperties storage, for data types that will support both in Blender
5.0.

There is no user-facing changes expected here.

Part of #123232.

Pull Request: https://projects.blender.org/blender/blender/pulls/139257
2025-06-06 11:49:54 +02:00
Jeroen Bakker
66d361bd29 Vulkan: Add support for descriptor buffers
Descriptor sets/pools are known to be troublesome as it doesn't match
how GPUs work, or how application want to work, adding more complexity
than needed. This results is quite an overhead allocating and
deallocating descriptor sets.

This PR will use descriptor buffers when they are available. Most platforms
support descriptor buffers. When not available descriptor pools/sets
will be used.

Although this is a feature I would like to land it in 4.5 due to the API changes.
This makes it easier to fix issues when 4.5 is released.
The feature can easily be disabled by setting the feature to false if it has
to many problems.

Pull Request: https://projects.blender.org/blender/blender/pulls/138266
2025-06-06 10:20:36 +02:00
Philipp Oeser
ac3afae380 Fix: uninitialized TransData center for Curves proportional editing
When proportional editing around individual origins is used, we would
end up with uninitialized TransData center for points in curves which
have nothing selected.

This is more or less harmless since the center is not even used in that
case (instead the center of the closest point found is used, see logic
in #set_prop_dist /#prop_dist_loc_get).

Still nicer to be clear about this, added some code comments which
hopefully make the situation clearer.

Ref. 1d0c11987f
Ref. #139101

Pull Request: https://projects.blender.org/blender/blender/pulls/139849
2025-06-06 08:09:32 +02:00
Campbell Barton
8cecf7a79c Fix failure to start with an unknown --gpu-backend
An unknown --gpu-backend argument would attempt to pass that argument
separately which then attempted to treat is as a blend file,
typically failing to start if the file wasn't found.
2025-06-06 12:24:50 +10:00
Campbell Barton
f991377d0d Fix missing call to MOV_exit in the animation player
When playing back multiple movies, MOV_init was called
each time without a matching MOV_exit call.
2025-06-06 10:48:25 +10:00
Campbell Barton
e8afe173a0 PyAPI: add bpy.app.built_options.experimental_features
Provide a way to check if blender is running WITH_EXPERIMENTAL_FEATURES
defined.
2025-06-06 10:48:25 +10:00
Harley Acheson
66763dc6d5 Fix #139903: Don't Check Minimum Size for Areas Not Yet Initiated
New windows with new areas have all their dimensions sized before they
are fully initialized (prior to ED_area_init). No need to check their
minimum size in this state.

Pull Request: https://projects.blender.org/blender/blender/pulls/139908
2025-06-06 02:01:01 +02:00
Sean Kim
1eadfb1fbf Fix: UnifiedPaintSetting converting values incorrectly
Mistake in 6a03e8249d

Pull Request: https://projects.blender.org/blender/blender/pulls/139905
2025-06-06 01:16:53 +02:00
Brecht Van Lommel
5905a1309a Fix #139828: Proportional edit connected only fails with some topology
For an initial single selected edge, adjacent edges were not always added
to the queue if there is no face to propagate the distance across.

Pull Request: https://projects.blender.org/blender/blender/pulls/139889
2025-06-05 20:36:31 +02:00
Julian Eisel
37b534967b Fix #137120: Asset catalogs overwitten by pre-existing ones on file save
Main issue was that the handling of catalogs for on-disk libraries
relies on an in memory version of a asset catalog definition file. This
wasn't present for the runtime current file library storage. We can
actually construct this quite easily when converting it from a runtime
to a on-disk library.

Pull Request: https://projects.blender.org/blender/blender/pulls/139881
2025-06-05 19:43:24 +02:00
Christoph Lendenfeld
5e5cf21944 Fix #139645: Incorrect preview rendering for screenshot previews
When taking screenshots above a certain size with the
recently introduced screenshot feature, it rendered incorrectly
when the backend was set to OpenGL. (Vulkan was fine)

The issue was that the image was not downscaled to 256
which seems to be the max supported size
for preview renders (`PREVIEW_RENDER_LARGE_HEIGHT`).
Scaling down the image resolves that issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/139879
2025-06-05 17:27:02 +02:00
Jeroen Bakker
3a16f3b45f Fix #137909: Vulkan: Recover from allocation errors
When buffers/images are allocated that use larger limits than supported
by the GPU blender would crash. This PR adds some safety mechanism to
allow Blender to recover from allocation errors.

This has been tested on NVIDIA drivers.

Pull Request: https://projects.blender.org/blender/blender/pulls/139876
2025-06-05 14:11:37 +02:00
Kamil Galik
64696cc699 NDOF: simplify the UI and preferences
- Navigation modes has been redefined a bit and introduced in a form of
  an enum so that new ones can me implemented in the future.
  Additionally switching between modes shouldn't require any additional
  configurations like inverting all the axes.
  Currently there are only 2 modes implemented,
  but 2 more are planned and will be proposed in follow-up PRs.
  Implemented modes are:

  - Object: works like "Orbit" option.
    but has all axes implicitly inverted
  - Fly: works the same as "Free".

- "Turntable" option has been turned into "Lock Horizon".
  This single option works for both normal navigation and Fly/Walk
  modes now.
- Pan and Rotation axes inversion has been removed from default
  configuration.
- UI has been simplified following the design from #136880.
- Zoom Invert has been removed since it looks like a duplication of
  `NDOF_PANZ_INVERT`.

Ref !139343
2025-06-05 21:29:53 +10:00
Clément Foucault
b89c36f0e7 EEVEE: Split static shaders in different compilation batches
This allow for more granular requests reducing the engine
startup time in case sub-process compilation is not enabled
(when it is enabled, gains are not substantial).
This also makes engine startup less blocking.

The batches are only requested if needed.
Some of the batches can only be requested after object sync.
Given we don't have a priority system for the shader compilation
queue, the engine shader ends up compiling after the scene
ones.

The remaining blocking is the texture loading and geometry loading.
The world compilation is still blocking in this patch to avoid making it
more complex. But this can be another optimization we can do later on.

See PR for performance numbers.

Pull Request: https://projects.blender.org/blender/blender/pulls/139454
2025-06-05 12:31:08 +02:00
Jeroen Bakker
4a1078b3de Fix #139726: EEVEE: HiZ unneeded filtering
This PR will remove the filtering when gathering texels for HiZ. The
algorithm that we follow doesn't use it, but had issues when
implementing using textureGather where he mentioned that he needed to
enable filtering.

```
I was experimenting with using texture gather lookups to reduce
the number of texture fetches from 4-to-7 fetches per fragment
down to 1-to-3 fetches per fragment (see the extension
ARB_texture_gather) it seems that texture gather works only if
the image is linearly sampled and to avoid the additional burden
involved by switching filtering state during rendering I stuck
to simple texture lookups as using texture gather lookups did not
show any visible effect on the construction time of the Hi-Z map.
```
https://www.rastergrid.com/blog/2010/10/hierarchical-z-map-based-occlusion-culling/

After testing we got identical results when turning off filtering.

Turning off filtering allows supporting devices that don't support
linear filtering on depth stencil texture (WoA) using the Vulkan
backend.

Pull Request: https://projects.blender.org/blender/blender/pulls/139868
2025-06-05 12:28:45 +02:00
Pratik Borhade
afa4eaa96c Fix #137942: Grease Pencil: Make layer operators non-editable for linked data
For linked grease pencil data, layer operators are accessible right
now. Grey out them in UI by adjusting poll functions. Also disabled
the individual layer row of tree-view.`

See images in PR description

Pull Request: https://projects.blender.org/blender/blender/pulls/137946
2025-06-05 11:55:38 +02:00
Falk David
a4c91939e7 Fix: Geometry Nodes: Unnecessary "Curve to Mesh" scale input versioning
The versioning code for the new `Scale` input (a92b68939a)
always added new versioning nodes connected to the `Scale` input to ensure
that the node behaves as before.

But these versioning nodes are only necessary when a profile curve is connected.
Otherwise, they don't have any effect at all, since the node just outputs
a wire mesh in this case.

This skips adding the versioning nodes in case the profile socket
is unused. The default scale value will be 1.

Pull Request: https://projects.blender.org/blender/blender/pulls/138968
2025-06-05 11:10:02 +02:00
Campbell Barton
0b94df6b2a Docs: use single quotes instead of back-ticks
Minor tweaks so text is extracted into the user manual properly.
2025-06-05 17:32:42 +10:00
Campbell Barton
2f60e37936 Fix command line help text mixing up "-a" arguments
The argument `-a` is used twice (render animation & animation playback).

Parsing logic works since their handled at different passes however
printing help text could return either since passes aren't used
for matching.

Workaround the problem using a deterministic lookup when printing
help text which that skips arguments that have already been handled.
2025-06-05 17:27:29 +10:00
Campbell Barton
628f1e08d0 Fix edge dissolve leaving visible edges connected to hidden vertices
Visible edges should always have both vertices visible.
When dissolving, hide any edges which become connected to hidden
vertices.
2025-06-05 05:33:51 +00:00
Jason C. Wenger
e418f7b1f1 Modeling: add an angle threshold that affects vertex dissolve
When dissolving an edge merges faces, use an angle threshold before
dissolving vertices from the face which have become chains as reult
of the merge (connected to 2 edges).

Also fix edge-flag handling when dissolving multiple edges
from a chain into a single edge, previously flags from the
resulting edge was effectively random.
Now flags from all edges are merged.

Resolves #100184.

Ref !134017
2025-06-05 05:33:49 +00:00
Campbell Barton
2d86699209 PyDoc: improve BMesh operator docs
- Place doc-strings before arguments (avoid over long lines).
- Enable clang-format for BMesh operator definitions.
- Remove invalid comments (likely left in from copy-paste).
- Use double back-ticks for RST.
- Use full sentences.

No functional changes.
2025-06-05 15:31:36 +10:00
Harley Acheson
ccb0dc50fb Fix #139780: Always Enforce Minimum Area Heights on File Load
We attempt to enforce a minimum area height so that they cannot be made
smaller than header height. This works correctly as we drag resize
areas but not when loading blend files. We skip doing so if resizing
from smaller to a bigger vertical size. This PR just makes it so we
enforce minimum size always.

Pull Request: https://projects.blender.org/blender/blender/pulls/139804
2025-06-05 03:31:56 +02:00
Sean Kim
6a03e8249d Paint: Add forward compatibility code for brush size
In 5.0, we plan to change the brush size from representing radius to
diameter. This means that for 5.0 files loaded in 4.5, we need to
scale the stored value when reading the relevant brush fields.

Related to #134204

Pull Request: https://projects.blender.org/blender/blender/pulls/139561
2025-06-05 00:44:43 +02:00
Sean Kim
e906fe2738 Fix: UV Editor doesn't show UVs in non-edit modes
Introduced in 440c6c8b6f

Pull Request: https://projects.blender.org/blender/blender/pulls/139857
2025-06-05 00:02:03 +02:00
Hans Goudey
c9bb7f0b23 Fix: Texture paint color jitter dereference of uninitialized optional
The value isn't created unless jitter is enabled, but it was always
retrieved for a function argument. The uninitialized memory wasn't read,
but it caused a crash in debug builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/139854
2025-06-04 21:27:16 +02:00
Laurynas Duburas
46bc894570 Fix: Curves: Custom knots in Curves and GP operators
Current strategy to deal with operators not supporting custom NURBS
knots is to fall back to calculated knots for curves of the custom mode
but with no `CurvesGeometry::custom_knots` allocated. Such curves are
the result of operators that copy only `Point` and `Curve` domains. This
way the problem is only postponed. It is not possible to add new custom
knot curves to such `CurvesGeometry` as custom knot offsets are
calculated all together and there is no way to distinguish between old
curves with lost knots and new ones. This is more a future problem.

The actual problem in `main` can be shown with an attached blend file
(see PR) by applying `Subdivide` to some points and then adding new
`Bezier` curve to the same object. This particular problem could be
addressed somewhere in `realize_instances.cc` but the actual problem
would persist.

This PR handles custom knots in all places where `BKE_defgroup_copy_list`
is iused, and where `bke::curves::copy_only_curve_domain` is called.
Here the assumption is made that only these places can copy custom knots
modes without copying custom knots. Depending on operator logic knots are
handled most often in one of two ways:
 - `bke::curves::nurbs::copy_custom_knots`:
   copies custom knots for all curves excluding `selection`. Knot modes
   for excluded curves are altered from the custom mode to calculated.
   This way only curves modified by the operator will loose custom knots.
 - `bke::curves::nurbs::update_custom_knot_modes;`
   alters all curves to calculated mode.

In some places (e.g. `reorder.cc`) it is possible to deal with knots
without side effects.

PR also adds `BLI_assert` in `load_curve_knots` function to check if
`CurvesGeometry::custom_knots` exists for custom mode curves. Thus
versioning code is needed addressing the issue in files in case such
already exists.
Pull Request: https://projects.blender.org/blender/blender/pulls/139554
2025-06-04 20:43:15 +02:00
Hans Goudey
e346c6d7a0 Fix #139816: Corrupt wireframe with antialiasing off and subdivision
Caused by 1e1ac2bb9b.

Previous removal of < 4 byte aligned GPU vertex buffer formats was
incomplete. The edge factor buffer still used a single-byte format.

Pull Request: https://projects.blender.org/blender/blender/pulls/139839
2025-06-04 17:47:13 +02:00
Bastien Montagne
e66ebc5a5b Cleanup/Fix: BLO: Include missing header.
The `adjust_fcurve_key_frame_values` template uses enums from RNA
header, so directly include the relevant header.
2025-06-04 15:31:26 +02:00
Thomas Dinges
ea5b1f7527 Release: Update 4.5 branch to beta
Splash by Blender Studio
2025-06-04 14:10:17 +02:00
Bastien Montagne
456a07c5e6 Improve Blender resilience to blendfile DNA data corruption.
This commit improves DNA parsing resilience to data corruption in two ways:
* Detect and abort on failure to allocate requested amount of memory.
* Detect multiple usages of the same `type_index` by different struct
  definitions.

The second part fixes the `dna_genfile.cc:1918:40.blend` case reported
in #137870.

Pull Request: https://projects.blender.org/blender/blender/pulls/139803
2025-06-04 12:53:27 +02:00
Omar Emara
6bf52d11f1 Fix #139327: Movie distortion result is cropped
The Movie distortion node crops its data if the movie size differs from
the input size. That's because boundary extensions do not take
calibration size into account. To fix this, we use the same coordinates
range as the distortion grid computation, which computes the distortion
in the space of the calibration size.

Pull Request: https://projects.blender.org/blender/blender/pulls/139822
2025-06-04 12:24:33 +02:00