Commit Graph

120508 Commits

Author SHA1 Message Date
Jeroen Bakker
40eaaf089f Vulkan: Switch Qualcomm to switch to OpenGL
Due to driver issues qualcomm devices that try to start Blender with
a driver below 31.0.112.0 will automatically switch to OpenGL.

Pull Request: https://projects.blender.org/blender/blender/pulls/140902
2025-06-26 08:49:37 +02:00
Campbell Barton
8536261164 Fix crash calling the transform operator over the redo panel
Calling transform over the redo panel would access the regiondata
as a RegionView3D for any region type.

Resolve by checking the region type - as done elsewhere transform code.
2025-06-26 05:00:31 +00:00
Campbell Barton
582a54b94c NDOF: apply YZ axis swap to rotations
Apply the "Zoom direction" preference to the rotation axis.
Until now, this preference was limited to translations.

Note that the X/Y swap is now applied in the accessor functions instead
of wmNDOFMotionData::tvec because swapping the X/Y axis doesn't work
well in some cases (color picker for example), and it's confusing
of axis swapping is handled in different parts of the code for
rotation & translation.

Ref !140975

Co-authored-by: Patryk-Skowronski <patryk_skowronski@3dconnexion.com>
2025-06-26 03:23:25 +00:00
Howard Trickey
ffc204d1fa Fix #140574: Manifold boolean leaves redundant 2-edged vertices.
This is discussed more in PR #140773.
The cause of the breakage was the change of the Manifold library
version from 3.0.1 to 3.1.0. That change is very positive otherwise
because we can remove the "use runids" workaround to prevent bad
face merging, and that removal is also part of this commit.
Removing that changes the time to do a big sphere-sphere test
from 660ms to 340ms.
The problem that needed fixing is that the new library version appears
not to do some aggressive simplification that the old version did,
and as a result, when we dissolve triangulation edges after the boolean
is done, it sometimes leaves valence-2 vertices on original edges.
To fix that, new code detects and then dissolves such vertices.
2025-06-25 13:44:49 -04:00
Campbell Barton
5b06823f99 Fix #140929: Crash attempting to link from the current file from Python
Add an error check that the path being linked doesn't match the current
blend file.

Also resolve reference leak in the case of library override errors.
2025-06-25 13:37:52 +00:00
Jacques Lucke
f3d58ebb5b Fix: Geometry Nodes: crash with missing linked data-block
Geometry nodes can't be evaluated when the node tree is not available. This
never worked before and the modifier evaluation was "cancelled" later on before
already. However, new code in the modifier evaluation requires the modifier to
be cancelled earlier already which is what this patch does.

Pull Request: https://projects.blender.org/blender/blender/pulls/140923
2025-06-25 08:30:39 +02:00
Campbell Barton
3d852e4071 Fix #140439: Crash using "Edit Source" in popovers
Using "Edit Source" from a buttons context menu in a popover could
access freed memory when comparing buttons. Resolve by checking the
button still exists in the region.
2025-06-25 06:07:28 +00:00
Richard Antalik
62e25e315a Fix #140740: Blender fails to output video
Caused by change in `AVCodecID` enum. Our `IMB_Ffmpeg_Codec_ID` enum,
which was stored in .blend file did match `AVCodecID`. But after change
in external library headers it fails to initialize correct codec.

Function `MOV_av_codec_id_get()` was added to map these 2 enums and
the values are no longer hard coded.

Functions, that accepted `int codec_id` argument were modified to accept
`IMB_Ffmpeg_Codec_ID` or `AVCodecID` types.

Because `codec_id` was still stored as integer in DNA, get/set struct functions
were added. This way, compiler always knows what type is used and emit
error/warning when incompatible types are used.

Unfortunately, there is no way to ensure, that DNA `codec_id` field is not
accessed directly in future code other than comment.

Pull Request: https://projects.blender.org/blender/blender/pulls/140745
2025-06-25 07:15:13 +02:00
Campbell Barton
2a757f469c Fix cursor size being ignored by custom cursors under Wayland
The theme cursor size was ignored when setting custom cursors
such as the knife, only the DPI from GHOST was taken into account.

This meant cursors such as the knife would sometimes display too small.

Now when the theme-size is larger, a larger cursor will be used.

Currently the theme size is read from XCURSOR_SIZE environment variable
however it may be read from the system preferences in the future.

Also fix the software cursor sizes which incorrectly used the UI scale
preference which is ignored by cursor sizes.
2025-06-25 04:39:57 +00:00
Dhiraputta Pathama Tengara
a2cc3370ed Fix: Constrain screenshot selection to window edges
Improves the screenshot selection UX by ensuring the selection
rectangle stays within the window.

**Changes**

- Clamp the selection rectangle while dragging the cursor,
preventing it from extending outside the window.

- When shifting the selection area, movement is constrained
so that the entire rectangle remains within the window.

- When `force_square` is `true`, the square is clamped to the
largest possible square that fits within the window bounds
if it would otherwise exceed them.

Pull Request: https://projects.blender.org/blender/blender/pulls/139805
2025-06-24 16:06:27 +02:00
Piotr Makal
c329907435 Fix #140813: Bevel operation crashes when representative face is null.
Fix #140813 crash, when bevel operation doesn't choose proper representative
face (called frep, facerep or rep_face in code). In such scenario a nullptr
would be assigned to uv_face->attached_frep field in register_uv_face function
and later, as a result of that, BM_face_vert_share_loop function would crash
during call to update_uv_vert_map function.

This commit also includes additional safety check in register_uv_face function,
as well as removes compiler warning about assigned but unused center_bme variable.

This is from PR https://projects.blender.org/blender/blender/pulls/140864
but applied to the 4.5 release branch.
2025-06-24 08:33:01 -04:00
Campbell Barton
cda9ce9777 Fix #136396: Metaball Cube can't be selected with solid shading
The metaball selection radius was inside the cube and could only
be selected with wire-frame shading.

Resolve by expanding the radius by the dimensions of the cube.
2025-06-24 07:56:50 +00:00
Christoph Lendenfeld
32d2bc0a59 Fix #139277: box selecting on the summary line fails with NLA in tweak mode
The issue was that the summary channel was marked as
possible to do NLA mapping in `ANIM_nla_mapping_allowed`.
When it comes to doing the actual mapping it would silently do nothing
though because `bAnimListElem.adt` is always a `nullptr` for the summary.
However in `action_select.cc:580` the `KED_F1_NLA_UNMAP`
and `KED_F2_NLA_UNMAP` flags were already removed.
Those flags tell the summary line to do NLA mapping in `keyframes_edit.cc:368`.
(We may be able to remove those in the future)

The fix is to ensure that the summary line is
recognized as unable to do NLA mapping. That makes sense to
me at least because the summary line points to data but in itself
does not know about the NLA.

As a side effect, this also fixes circle select.

Pull Request: https://projects.blender.org/blender/blender/pulls/140664
2025-06-24 09:53:06 +02:00
Jacques Lucke
f3ba5bf08d Fix #140876: input socket interface not correctly propagated by link-drag-search
The solution is to use the same utility function that's also used when
connecting links to the extend socket of the Group Input node.
2025-06-24 09:02:18 +02:00
Campbell Barton
0be817a01c Fix knife tool showing axis in the wrong direction before cursor motion
Changing constraints required cursor motion to refresh the display.
2025-06-24 15:53:47 +10:00
Campbell Barton
7e2926233d Fix #138742: Knife tool not locking to axis when snapping to edge
Regression in [0] which moved the logic from
knife_closest_constrain_to_edge from 2D to 3D space.
The 3D location used (kcd->curr.cage) didn't have constraints
applied, causing snap not to lock to the constrained axis.

Resolve by passing in the constrained location which is then used when
edge snapping is calculated.

[0]: 7249b78b6b
2025-06-24 15:24:49 +10:00
Hans Goudey
2e568d31ed Fix #140767: Render Simplify "Normals" option doesn't work
One obvious problem is that `mr.use_simplify_normals` was assigned after
face corner normals were retrieved. The other more complex problem is
that now the normals caches automatically mix custom normals from other
domains. This can cause the expensive "Tangent Space" normals to be
calculated even though we don't explicitly request face corner normals.
To fix this, clarify the purpose of the option to only apply to that custom
normals format and use the true normals instead in that case.

Pull Request: https://projects.blender.org/blender/blender/pulls/140879
2025-06-24 03:52:40 +02:00
Rob Blair
379fffaf0d Fix #139664: bevel weight is now used for offset collisions #140436.
Problem - offset collision check for bevels did not consider the reduced
offset when using bevel edge weights, thus greatly reducing the allowed offset.
Solution - calculate the offset check using the weighted value and not
the full offset.
Alternatives - Since this error was introduced in the patch dd334faa58
a solution would be to revert the patch. This is not optimum since the
patch did correct the inf/inf condition in the offset calculation (ex at
90 degs, tan is 1/0).
Limitations - This patch is a correction to return the bevel function to
it's previous abilities. Further work is needed to properly handle edge
offset interference when looking at n-gons with reflex angles. There are
also situations where the bevel operation exceeds the checked offset distance
(exs. inner arc spread and bevel profiles that are not normal to the bevelled edge).
2025-06-23 21:15:48 -04:00
Sean Kim
7274fdb377 Fix #140556: Mask filter operations behave incorrectly on dense meshes
Mistake in 57c4e9dd2c

Pull Request: https://projects.blender.org/blender/blender/pulls/140570
2025-06-23 19:22:33 +02:00
Sean Kim
41d8066b1e Fix: Potential NaN when calculating average values
It is possible for a vertex to be processed by some function that
attempts to calculate the average of an attribute of all neighboring
elements when all elements are hidden. This results in NaN when using
`math::rcp` for the size of the related indices.

This commit switches the `rcp` call for the safe variant and removes an
invalid assert that previously existed.

Further cleanup to consolidate the various different average methods
will occur in the main branch (e.g. the `check_loose` and `interior`
functions)

Pull Request: https://projects.blender.org/blender/blender/pulls/140569
2025-06-23 19:21:53 +02:00
Sean Kim
ffcbe6205b BLI: Add assert for indexed_data_equal
Typically, we use this function to determine whether or not a subset of
data that has been collected with `gather` needs to be then persisted
into a larger array with `scatter`. As such, it makes sense to assert on
equality of the indices and smaller array size.

Pull Request: https://projects.blender.org/blender/blender/pulls/140752
2025-06-23 17:57:59 +02:00
Philipp Oeser
5790ff3b6a Fix #140801: Particle Weight Overlay Broken
Was not showing weights on the lines (but the points instead).
Points were supposed to show selection though, not weights.

This is now corrected.

Pull Request: https://projects.blender.org/blender/blender/pulls/140862
2025-06-23 17:52:31 +02:00
Brecht Van Lommel
a7bcea76d7 Fix #139769: ACES 2.0 configuration fails with shader errors
This code was initially only for OpenColorIO 2.3, and then later removed in
the refactor. But it appears to still be needed for 2.4 and configs like this.

Pull Request: https://projects.blender.org/blender/blender/pulls/140824
2025-06-23 15:13:59 +02:00
Julian Eisel
e852533ddd Fix #140781: Crash on "Adjust Pose asset" from Asset Browser
See:
https://projects.blender.org/blender/blender/issues/140781#issuecomment-1608861.
2025-06-23 14:39:41 +02:00
Sergey Sharybin
7519586ec0 Fix #140693: Crash on enabling override in file output color settings
The code around view transform selection accidentally got too coupled
to the scene. However, the file output settings do not have scene, so
the enumerator getter was crashing.

Caused by 7ceb4495c5.

This patch brings the code closer to the Blender 4.4 behavior by
maintaining a global from view name to an ID.

There is still a bug in the code which displays views from the active
scene's display settings in the override panel. This is because the
itemf() callback is hardcoded to use the display settings from the
active scene (via bContext). However, this issue exists since the
initial commit of the color management override option.

Pull Request: https://projects.blender.org/blender/blender/pulls/140729
2025-06-23 14:02:59 +02:00
Richard Antalik
6b8970d728 Fix: VSE: Using redo panel causes operator to fail
When movie strip is added and redo panel is tweaked, operator failed to
re-execute.

Caused by c4eab49b9. This added `sequencer_generic_invoke_xy__internal`
call in operator exec function, but did not specify `SEQPROP_NOPATHS`
argument, which caused `directory` and `filepath` properties to be
overwritten.

This PR adds clarification for `SEQPROP_NOPATHS` use case, because it
isn't immediately obvious what this is doing.

Pull Request: https://projects.blender.org/blender/blender/pulls/140736
2025-06-23 01:01:01 +02:00
Sybren A. Stüvel
de22f32656 Fix #140700: Blender 4.5 Crashes When Performing Loop Cut
Correct an oversight in df6d345bb4: without proportional editing, all
the transform data is "selected" by definition. This means that the
assumption "the selected data is sorted first in the array" is
trivially true, without calling any sorting function. So instead of
using the sorted index map in these cases, just fall back to regular
iteration.

To make the code handle this nicely, I made two "foreach" functions.
The first one transparently uses the sorted index map when available,
and performs regular iteration otherwise. The second function only
visits the selected items.

This makes the usage of these functions clearer, and the fact that
selected items are expected to be sorted first (either trivially or
explicitly) can be documented in a central place.

Pull Request: https://projects.blender.org/blender/blender/pulls/140720
2025-06-22 11:54:17 +02:00
Sean Kim
99d4e7e330 Fix: Incorrect file version for brush forward compatibility code
Mistake in 6a03e8249d

Pull Request: https://projects.blender.org/blender/blender/pulls/140777
2025-06-22 00:02:03 +02:00
Campbell Barton
5280ebc289 NDOF: all spaces now follow the navigation mode preference
Restore expected behavior of the NDOF, especially in the context of
non-3D editors. It addresses the following issues:

- Object mode, 3D viewport:
  With "Lock Horizon" off, the rotation axes will invert unexpectedly,
  making the camera behave similar to a "Fly mode".

- Fly mode, 2D editors:
  Changing a navigation mode to "Fly" makes no effect.
  Applies to UV and Nodes editors, Camera Preview etc.

Related to #140165

This includes some minor API changes back-ported from `main`
since the PR was created for `main`.

Co-authored-by: Patryk-Skowronski <patryk_skowronski@3dconnexion.com>

Ref !140537
2025-06-21 16:38:51 +10:00
Jesse Yurkovich
5c25a24528 Fix: USD: Prevent unreachable assert when processing String attributes
Incoming string attributes from USD have never been fully processed yet
they were added to our list of convertible types. This list originally
came from the Mesh reader before it was made common, but for Meshes the
string type was being skipped elsewhere so there was no harm. Now that
Point Clouds and Curves use this common code, it does matter.

Files containing string attributes for these object types will hit the
`BLI_assert_unreachable` call inside `copy_primvar_to_blender_attribute`
and trace an error to the console requesting the user to file bugs. This
was discovered while looking into the old Moana scene.

Remove the string entry for now as there's no regression in behavior and
it prevents the assert from firing (functionally harmless in Release
builds but the output to the terminal is unnecessary).

Pull Request: https://projects.blender.org/blender/blender/pulls/140681
2025-06-20 20:46:32 +02:00
Hans Goudey
19ef847647 Fix #140689: Paint mode crash with empty Grease Pencil layer
In this case an empty CurvesGeometry didn't contain the position
attribute. Skipping the lookup in that case should be harmless.
2025-06-20 11:40:42 -04:00
Hans Goudey
5d184bd1d6 Fix: Potential memory leak reading AttributeStorage
For unsupported domains, storage types, or other issues with
reading the attribute data, the attribute name and data struct
could be leaked.
2025-06-20 11:40:42 -04:00
Sybren A. Stüvel
f3428ed9af Anim: avoid 'unshare' node for custom properties and shapekey values
When creating depsgraph relationships for drivers, avoid creating the
'unshare' depsgraph node for drivers on custom properties and on
shapekey `value` properties.

This should fix a significant part of the performance regression
mentioned in #140706.

Pull Request: https://projects.blender.org/blender/blender/pulls/140724
2025-06-20 16:01:13 +02:00
Lukas Stockner
7f86ec13aa FFmpeg: Fix parameter name in deprecated API 2025-06-20 15:57:39 +02:00
Lukas Stockner
236b6513cf FFmpeg: Add compatibility code for deprecated codec info API
Direct access to pix_fmts, sample_fmts and supported_samplerates is deprecated
since version 61.13.100, see
https://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3305767560.
Instead, you're supposed to query them via avcodec_get_supported_config(),
so this adds compat code to get rid of 27 warnings.

Pull Request: https://projects.blender.org/blender/blender/pulls/140414
2025-06-20 13:58:36 +02:00
Campbell Barton
bfb6b184f5 Fix #140332: Crash with Python/RNA class registration
Resolve reference counting error in the RNA API which mixed up ownership
between ExtensionRNA::data & StructRNA::py_data.

In practice this generally worked as RNA_struct_free_extension behaved
as if ExtensionRNA owned the reference instead of StructRNA, so as long
as only one reference was removed, there wasn't any difference.

When re-registering Python classes with RNA, ownership wasn't handled
properly which could result in negative reference counts,
crashing in some cases.
2025-06-20 09:54:13 +00:00
Pratik Borhade
0faf2a058e Fix #140079: Redraw outliner after "remove unused" bone collections
After using the Purge Unused Data operator, hovering mouse over outliner
makes outliner tree dirty as the tree is not being rebuilt. The operator is
defined in python which calls `ANIM_armature_bonecoll_remove`. Add
notifier in that function code so that `outliner_main_region_listener`will tag
the outliner region for full redraw.

Pull Request: https://projects.blender.org/blender/blender/pulls/140256
2025-06-20 11:33:11 +02:00
Jacques Lucke
baf68516f0 Fix: Nodes: missing socket descriptions when grouping node 2025-06-20 10:23:32 +02:00
Jeroen Bakker
d2e88494e1 Cleanup: Vulkan: Remove unused code
Removes `VKTexture::current_layout_` and `VKTexture::init`. The code
was unused since the introduction of the render graph.

Pull Request: https://projects.blender.org/blender/blender/pulls/140708
2025-06-20 09:51:19 +02:00
Campbell Barton
6197335658 Build: resolve errors & deprecation warnings with Python 3.14 beta
Python 3.14 has moved some functionality into the public API,
use the updated names even with older Python versions.

Also resolve an error caused by variable reuse with delayed annotation
evaluation for TextureProperties_MixIn on startup.

Resolve #140695.
2025-06-20 04:19:35 +00:00
Harley Acheson
f3b0600083 Fix #139942: Clear Screen Active_Regions For Inter-Window Area Move
When dragging an area from one window to another it is possible for the
bScreen->active_area to be be invalid for a short period of time. This
is constantly updated so normally not noticeable but will cause ASAN
errors when trying to show keymaps in the status bar as this is use
after free. This PR just sets these to nullptr.

Pull Request: https://projects.blender.org/blender/blender/pulls/140683
2025-06-19 21:03:27 +02:00
Philipp Oeser
b7b9add385 UI: actually return an icon for shapekeys in UI_icon_from_idcode
`UI_icon_from_idcode` is used e.g. from the Action Editor to indicate an
Action's Slot Type (and without the icon it is kinda hard to tell what
the slot is suited for...)

Before
![image.png](/attachments/de26790d-d7c1-4eb0-b48e-245ff201f6bf)

After
![image.png](/attachments/64f2e486-8880-424a-b793-b66503cf1087)

Discovered while investigating #140618

Pull Request: https://projects.blender.org/blender/blender/pulls/140658
2025-06-19 18:41:35 +02:00
Hans Goudey
e82a051ade Fix: Issues in Grease Pencil blend file writing
After a recent commit, multiple drawings were always written using the
same address because we used the same stack memory in a loop. This
causes the blend file reading to not be able to distinguish between the
structs, meaning the file is corrupt. However, we already had the same
problem in some cases because of the inline buffer in `BlendWriteData`.
To resolve this, make all "temporary" data for writing live as long as
the writing is going on for the ID. This is somewhat inefficient since
it makes memory reuse impossible for this temporary data. In the future
we should use a technique like #127706 to address this.

For testing, I saved and loaded multiple production files with Grease
Pencil objects, with and without the "write with attribute storage"
option enabled. The fix still goes to 4.5 though, because the first
mentioned issue is present there, and the `CustomDataLayer` vector
address reuse is potentially a problem too.

Pull Request: https://projects.blender.org/blender/blender/pulls/140667
2025-06-19 17:44:28 +02:00
Piotr Makal
8412c0b42d Fix #79163: Bevel operation produces disconnected UVs #139595.
Fix #79163 bug related to the bevel operation producing disconnected UVs for
new bevel faces. This change replaces previous approach using scattered and
selective usage of functions: bev_merge_uvs, bev_merge_edge_uvs and
bev_merge_end_uvs with one coherent technique for all stages of the bevel operation.
It is utilizing a concept of loop (BMLoop) buckets to keep track of UV vertices
that should be merged at the end of bevel operation by a single call to
bevel_merge_uvs function. This approach doesn't touch initial UV position
calculation done by interpolation algorithm in bev_create_ngon function and
keeps the concept of representative faces (called frep, facerep or rep_face in
code) to help decide to which bucket specific loops should be assigned.

This is from PR https://projects.blender.org/blender/blender/pulls/139595,
which has more explanation and discussion.
2025-06-19 09:50:14 -04:00
Bastien Montagne
eb5d630db1 Fix #140581: Crash due to invalid info about potential ID dependencies of GP data.
GreasePencil ID type did not list `ID_OB` as its potential ID dependency
type, leading to lack of remapping of its layers' parents objects
pointers (e.g. on Object deletion), leading to crash from accessing
freed data.
2025-06-19 15:33:05 +02:00
Jeroen Bakker
fefbdefbca Fix: Vulkan: Crash on exit
We detected that the gpu/draw tests could lead to
crashes after the tests where finished. It was
identified that the crash happened as the submission
runner wasn't exited, uses a mutex, that is being
destroyed by the main thread.

Solution is to wait until the submission runner has
finished, before destroying resources.

Pull Request: https://projects.blender.org/blender/blender/pulls/140650
2025-06-19 14:13:00 +02:00
Damien Picard
e3945710a8 I18n: Tweak Automatic language tooltip
- Clarify that the English fallback is the US variant, now that a UK
  variant exists.
- Rephrase slighty for clarity.

Pull Request: https://projects.blender.org/blender/blender/pulls/140624
2025-06-19 13:05:54 +02:00
Philipp Oeser
4f482989d6 Fix #140636: Crash clicking in armature editmode after deleting a bone
Mistake in 3ddd2dff37

When checking a flag on an editbone in that commit, wasnt checking if we
have an active editbone to begin with...

Pull Request: https://projects.blender.org/blender/blender/pulls/140640
2025-06-19 12:06:51 +02:00
Sybren A. Stüvel
df6d345bb4 Fix #139042: use index map instead of sorting transform system data
Avoid modifying the order of transform system data. Instead, create an
index map and use that to traverse the data arrays in sorted order.

The issue observed in #139042 stems from the assumption, in _some_ of
the code, that `tc->data[i]`, `tc->data_ext[i]`, and `tc->data_2d[i]`
all contain information about the same "transformable thing". Since
`tc->data` was sorted (by selection state and, optionally for
proportional editing, by distance) but the other arrays were not, this
caused issues.

The most obvious solution, sorting all arrays the same way, turned out
to be hard to do, as some elements in one array have pointers to
elements in another array. Reordering those arrays would therefore
also make it necessary to find and update those pointers.

Instead, I decided to implement a sorted index map. The arrays can
then be kept in their original order, and the index map can be used to
visit them in sorted order.

Pull Request: https://projects.blender.org/blender/blender/pulls/140132
2025-06-19 11:20:08 +02:00
Christoph Lendenfeld
4fbcdba21e Fix #140452: Pasting a single keyframe may mess up handles
The issue was that the wrong flag was passed to
`ANIM_nla_mapping_apply_if_needed_fcurve` resulting
in the handles not moved back in this method.

This issue was only visible when pasting on top of a single keyframe,
or when the key had free handles. That is because the handles would
be recalculated otherwise.

Pull Request: https://projects.blender.org/blender/blender/pulls/140542
2025-06-19 10:08:49 +02:00