Commit Graph

120499 Commits

Author SHA1 Message Date
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
Campbell Barton
bce0f3f677 Fix #140339: Crash with "Spin" tool in "Edit Mode" Toggle Maximize Area
MESH_GGT_spin_redo (for the operator) depended on MESH_GGT_spin
(for the tool) having already been initialized however the order
gizmos are initialized currently isn't guaranteed.

Workaround the problem by adding a null check.
See the report for details.

Co-authored-by: Philipp Oeser <philipp@blender.org>
2025-06-19 16:22:09 +10:00
Campbell Barton
23b2f987d3 Fix #138715: Crash selecting in edit-mode with geometry-node modifiers
The logic to access the edit-mesh for the selection engine didn't match
the logic used for drawing.

Resolve using the edit-mesh from: BKE_object_get_pre_modified_mesh

Ref !140525
2025-06-19 00:24:11 +00:00
Campbell Barton
41bf2f598f Cleanup: spelling in comments (make check_spelling_*) 2025-06-19 00:10:18 +00:00
Jesse Yurkovich
5e5c51215a Fix: USD: Only process displacement if there's a valid source specified
Some USD files have the displacement input specified in the shader but
do not have it marked as an output in either the shader or the material.

Skip processing if we do not have a valid displacement source.

Pull Request: https://projects.blender.org/blender/blender/pulls/140619
2025-06-18 23:55:04 +02:00
Jesse Yurkovich
bcd5af34f9 Fix: USD: Traverse through UsdShadeNodeGraph nodes during material import
Follow connections through `UsdShadeNodeGraph` nodes when reading
materials rather than looking only for `UsdShadeShader` nodes.

Found while investigating the Intel Sponza research sample:
https://www.intel.com/content/www/us/en/developer/topic-technology/graphics-research/samples.html

Pull Request: https://projects.blender.org/blender/blender/pulls/140565
2025-06-18 20:25:29 +02:00
Hans Goudey
29c623f857 Fix #140530: Crash after writing Grease Pencil drawings in new format
`blend_write_prepare` expects to work on a shallow copy of the
`CurvesGeometry` struct. This is necessary because it changes
the struct to contain only the layers being written. This is
particularly important with writing with the new format enabled,
where attributes are written as part of `AttributeStorage`.

Writing with a shallow copy of the struct also gives us the
flexibility to zero the runtime pointer in the written file which
is generally a good practice.

Pull Request: https://projects.blender.org/blender/blender/pulls/140560
2025-06-18 16:02:15 +02:00
Pratik Borhade
cf14be7644 Fix: Regression: Invert doesn't work with search filter in some UIList
For UILists that doesn't use `filter_items()`, search filter doesn't work
along with invert button. For filter_items, invert case is already
handled in filter_items_by_name. In absense of that function,
handle the invert case inside `UI_list_filter_and_sort_items`. Existing logic
is a bit wrong. Now flags are adjusted, i.e. when search string matches, check
for invert status to decide whether items should be in the list or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/139523
2025-06-18 11:40:43 +02:00
Clément Foucault
234ff21a7b Fix #140490: EEVEE: Broken hair motion vectors
This was caused by a hash colision caused by an incorrect
auto conversion from `Object*` to `ObjectRef`. The `ObjectRef`
would then not contain any instancing data and would create
the same hash for the same particle system on each instance
(since only `foreach_hair_particle_handle` was constructing
`ObjectKey` from an `Object*` it did not affect the instance
itself).

Marking the incriminating constructor `explicit` to avoid
more issues. Changing the `ObjectKey` creation for psys to use
`ObjectRef` fixes the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/140544
2025-06-18 10:46:27 +02:00
Philipp Oeser
b254a1ac36 Fix: Graph Editor box select selects non-visible handles
We should never select something that is hidden in the viewport.

Generally, there can be multiple reasons why keyframe handles are not
shown in the Graph Editor:
- the `View` > `Show Handles` option is disabled
- the `Only Show Selected Keyframes Handles` is enabled
- a keyframe `Interpolation`  method is anything but `Bezier`

This PR corrects the first.

Details:
- In `box_select_graphkeys()`, the `incl_handles` parameter is only
be passed to `initialize_box_select_key_editing_data()`
- add a separate `KEYFRAME_ITER_HANDLES_INVISIBLE` flag (representing
SIPO_NOHANDLES)
- "include_handles" purely represents operator setting / user intend now
- "final" decision about handles/their visibility is done in
`keyframe_ok_checks()` etc

For consistency, add "include_handles" option to Lasso/Circle as well

Part of #139314

Pull Request: https://projects.blender.org/blender/blender/pulls/139349
2025-06-18 07:54:51 +02:00