Commit Graph

121311 Commits

Author SHA1 Message Date
Julian Eisel
183420bd07 Refactor: Make file-list cache struct non-trivial C++ one
Makes it possible to use non-trivial C++ types in `FileListEntryCache`.
I'm planning to use this for blender/blender!130543, to store status
information about downloaded previews. While it's possible to use
C-style types instead, this is easier and a worthwhile general
improvement.

I turned `FileList.filelist_cache` into an allocated pointer, so
`FileList` doesn't have to be ported to be a non-trivial type as well.
We probably want to do that too at some point.

Pull Request: https://projects.blender.org/blender/blender/pulls/141411
2025-07-04 23:09:02 +02:00
Germano Cavalcante
58af30f9b9 Refactor: Transform: Unify logic of "orient_axis" and "constraint_axis"
In rotation-based transform operations, the rotation axis can be
determined in two ways:
1. Through "orient_axis" (X, Y or Z)
2. Through "constraint_axis"

When the axis is obtained through the constraint, "orient_axis" is
ignored, and the angle may be negated depending on the view orientation
to match the mouse movement.

However, "orient_axis" never has its angle negated. Since the default
orientation is "View", the Z axis is inverted by default, aligning with
the mouse movement but not with the constraint axis.

This causes problems in the Redo Panel because the constraint fields
are hidden in the Rotation operation, so they need to be unset for the
Axis field to work. However, if you change the value of the Rotation
field, the object may have its rotation negated unexpectedly.

This issue was partially shown in #93078. Commit c30e6a37b0 attempted
to fix it by unsetting the constraint property when the Axis was
changed. However, this solution is incomplete: if the Axis is changed
and then reverted, the negative rotation issue reappears. In addition,
it has not been implemented in all operations.

This commit resolves the issue by reverting c30e6a37b0, aligning the
behavior of "orient_axis" and "constraint_axis", and unsetting
"constraint_axis" in `saveTranform`.

A downside of this solution is that it may break operators invoked from
Python that rely on "orient_axis" as the rotation axis, as the rotation
value now needs to be negated.

Pull Request: https://projects.blender.org/blender/blender/pulls/141101
2025-07-04 20:47:25 +02:00
Namit Bhutani
e5db240434 Mesh: Spatial Reordering for Sculpt Speed Improvements
**Problem Description**

Blender's current mesh data layout often lacks spatial coherence,
causing performance bottlenecks during BVH construction for sculpting
and painting operations. Each time a BVH is built, the system must
recompute spatial partitioning and vertex groupings from scratch,
leading to redundant calculations and suboptimal memory access patterns.

**Proposed Solution**

This patch implements pre-computed spatial organization of mesh data
through a new `mesh_apply_spatial_organization()` function that:

- Reorders vertices and faces based on spatial locality using recursive
  spatial partitioning.
- Stores pre-computed MeshGroup hierarchies in MeshRuntime for reuse.
- Enables the BVH system to bypass expensive spatial computation when
  pre-organized data is available.

This approach separates the expensive spatial computation from more
frequent BVH rebuilds, providing sustained performance improvements
across multiple sculpting operations.

**Limitations**

- Requires manual invocation (occurs automatically only during remesh
  operations).
- Additional memory overhead for storing MeshGroup metadata.
- One-time computational cost during initial organization.
- Spatial group references are not yet stored in files.

**User Interface**

The feature is accessible via a new "Reorder Mesh Spatially" operator in
the Mesh Data Properties panel under the Geometry Data section. Users
can invoke it manually when needed, or it will be applied automatically
during quadriflow and voxel remesh operations. The operator provides
feedback confirming successful spatial reordering.

Pull Request: https://projects.blender.org/blender/blender/pulls/139536
2025-07-04 20:02:37 +02:00
Harley Acheson
a60ec16858 Fix #141225: Hide Right Node Editor Scrollbars When Sidebar Visible
For Node Editors do not show right-side scrollbars if region overlap
and there is a right-aligned region open, to avoid two scrollbars.

Pull Request: https://projects.blender.org/blender/blender/pulls/141418
2025-07-04 19:50:44 +02:00
Germano Cavalcante
79721249b0 Cleanup: Avoid unnecessary indentation levels in 'tranform.cc'
Use early return and remove repeated conditions.
2025-07-04 14:47:11 -03:00
Hans Goudey
123267933c Fix #141430: Crash with viewer node on invalid domain
Since 68759af516, it was possible
to add attributes on invalid domains. Just add a check for that.

Pull Request: https://projects.blender.org/blender/blender/pulls/141460
2025-07-04 18:57:33 +02:00
Guillermo Venegas
3cd285d7f0 Cleanup: UI: Remove unused pie menu functions
I couldn't find exactly when it was stopped being used,
but seems that this has some years with no use.

Pull Request: https://projects.blender.org/blender/blender/pulls/141435
2025-07-04 18:29:05 +02:00
Falk David
cc7f1a2b52 Merge branch 'blender-v4.5-release' 2025-07-04 18:05:43 +02:00
Falk David
eff92923ec Fix: Grease Pencil: Soft eraser leaves points with zero opacity
The soft eraser could leave points with zero opacity. To fix this issue
for now, we apply a post-process step when the stroke is done to remove
these points.

In the future, it would be better to refactor the eraser a bit more and
delete points during the stroke.

Part of #131686.

Pull Request: https://projects.blender.org/blender/blender/pulls/141454
2025-07-04 17:22:49 +02:00
Pratik Borhade
a559fb833c Tree View: Multi-select support
Add support to select multiple tree view elements (similar to outliner/anim channels)
`Ctrl + LMB` to select+activate element under the mouse
`Shift + LMB` to select all items between active and clicked item.

As of now, only Shape key has support for multi-select. (straightforward to include
other views). `KEYBLOCK_SEL` flag is used for storing selection state.

Pull Request: https://projects.blender.org/blender/blender/pulls/138979
2025-07-04 15:45:18 +02:00
Philipp Oeser
458e224587 Merge branch 'blender-v4.5-release' 2025-07-04 15:01:33 +02:00
Philipp Oeser
eb82ff6166 Fix #141387: Light Probes not integrated into Animation Editors
You could basically not interact with the animation (except for
keyframes in the main region), channels region was totally empty, NLA
could not be used, ...

It is not something users will animate a lot, but we should still have
animation editors in mind when adding a new object type.

Just missing from cc31d7bb49

Pull Request: https://projects.blender.org/blender/blender/pulls/141449
2025-07-04 15:01:15 +02:00
Falk David
93d83bdad4 Merge branch 'blender-v4.5-release' 2025-07-04 14:57:53 +02:00
Falk David
859d271528 Fix: Grease Pencil: Crash when geometry has no drawings
Adds checks to the `get_drawing` functions to make sure that there is at
least one drawing in the geometry.
2025-07-04 14:57:08 +02:00
Omar Emara
c18e4b69a4 Fix: Versioning of Normal node applies to all nodes
The versioning code for the Normal node applies to all nodes, while it
should only apply to the Normal node.

Pull Request: https://projects.blender.org/blender/blender/pulls/141452
2025-07-04 14:07:00 +02:00
Campbell Barton
441cc3ab09 Merge branch 'blender-v4.5-release' 2025-07-04 20:23:30 +10:00
Jason C. Wenger
014be23586 Fix #141351: Default edge dissolve angle leaves many verts undissolved
Adjust angle threshold defaults to dissolve verts as before,
while preserving selected geometry.

The new behavior works as follows:

- If a dissolve terminates on an edge loop or the the corner vert of a
  face, do the dissolve.
- If a set of dissolve edges (either a chain, or a set of 3+ edges)
  crosses a loop cut, do the dissolve.
- If a chain of dissolve edges touch the corner of an unselected face,
  and then leave in a different direction without crossing a loop cut,
  preserve that vert. Just because the selection touches it doesn't mean
  it should be altered.
- If a dissolve edge is separating two triangles,
  then the face join creates a quad. Users generally prefer
  and strive to create meshes that contain quads.
  Instead of destructively dissolving the corners of the quad and
  automatically turning it to a triangle or wire,
  instead prefer to preserve the quad.

Ref !141097
2025-07-04 20:14:55 +10:00
Pratik Borhade
eab747e8dd Fix #51739: Sliding values in add primitive redo panel not hiding cursor
Cursor is actually wrapped at the beginning with the help of function
`WM_cursor_grab_enable`. Though the `ND_MODE` event notifier added
inside  `editmode_enter/exit_ex` further calls `region_cusor_set()`.
This resets the cursor to default at the bottom of
`ED_region_cursor_set()`. Such sitution could be avoided by creating a
dummy cursor function for hud region. But issue remains when we call
redo panel from F9. As Julian suggested, add condition for `grabcursor`
to avoid changing cursor when editing buttons.

Pull Request: https://projects.blender.org/blender/blender/pulls/133529
2025-07-04 12:01:03 +02:00
Pratik Borhade
841c36850c Fix #67806: Delete non existing temp screens
When deleting a window, clear screen ID data if it belongs to
non-main window with single area

Pull Request: https://projects.blender.org/blender/blender/pulls/132978
2025-07-04 11:56:12 +02:00
Campbell Barton
dcf59ca85a Merge branch 'blender-v4.5-release' 2025-07-04 19:54:38 +10:00
Campbell Barton
389a9197ae Merge branch 'blender-v4.5-release' 2025-07-04 19:51:40 +10:00
Patryk-Skowronski
c53a0cfcb6 NDOF: use fixed speed values for translations in "Fly Mode"
Use fixed speed values for translations in Fly mode to constant
values for each axis. Until now, after switching to the Fly mode,
the latest speed value calculated based on RegionView3D::dist
was used for translations.
Now, the translation speed in Fly mode is an adjusted constant
for each axis.

Ref !141285
2025-07-04 19:33:43 +10:00
Casey Bianco-Davis
5cbaee3321 Grease Pencil: Implement align Bézier handles in transform operator
This PR add bezier `align` type calculation to Grease Pencil.
Curves objects were implement in #128726.

Pull Request: https://projects.blender.org/blender/blender/pulls/141371
2025-07-04 11:27:14 +02:00
Pratik Borhade
29b97535d7 Cleanup: Use one struct member for GP and curve point count
Remove totgppoint/totcuvepoints and instead use `totpoints`.

Pull Request: https://projects.blender.org/blender/blender/pulls/141441
2025-07-04 10:58:03 +02:00
Pratik Borhade
70f4eccdfc Cleanup: Remove unused header
Functions from these headers are not used anywhere in `info_stats.cc`

Pull Request: https://projects.blender.org/blender/blender/pulls/141444
2025-07-04 10:56:56 +02:00
Falk David
c2225155e2 Cleanup: Remove meaningless consts in function declaration 2025-07-04 10:51:56 +02:00
Pratik Borhade
27b205f579 Fix #141420: Grease Pencil: Crash enabling material overlay without material
Crashed due to accessing members of nullptr Material. Add extra
condition to avoid this.

Pull Request: https://projects.blender.org/blender/blender/pulls/141431
2025-07-04 10:40:09 +02:00
Aras Pranckevicius
65ce05eae7 Merge branch 'blender-v4.5-release' 2025-07-04 11:37:22 +03:00
Aras Pranckevicius
641824753a Fix #141434: OBJ importer should apply bounds clamp size to the whole scene
It was applying the bounds clamp to each object individually,
which changed spatial relationships between objects. Make the logic
match what used to be done in the Python OBJ importer back in the day.

Pull Request: https://projects.blender.org/blender/blender/pulls/141446
2025-07-04 10:36:18 +02:00
Lukas Tönne
455a8554e2 Refactor: Utility "mixer" class to simplify armature deform functions
The main armature deform functions compute a vector and/or matrix from
a weighted sum of bone deformations. This can be done either with
linear interpolation or using dual quaternions.

The linear and dual-quaternion methods were mixed together in the same
functions, which makes the code unnecessarily hard to follow. This patch
introduces a "Mixer" concept (similar to attribute math) that abstracts
the process of adding bone influence to the target vector/matrix. It also
takes care of finalizing the value. This way the code iterating over the
vertex group and/or bone envelopes can be agnostic of the target data.

The ArmatureUserData also receives significant refactoring to remove
unnecessary variables, utilize modern math classes, and generally improve
variable naming.

Pull Request: https://projects.blender.org/blender/blender/pulls/141348
2025-07-04 10:13:48 +02:00
Philipp Oeser
ae0ca8e616 Merge branch 'blender-v4.5-release' 2025-07-04 10:11:52 +02:00
Philipp Oeser
ab9f03555c Fix #141384: Anim Channel Pinning: object data pin only for cameras
As mentioned in 98c7e75897, the idea of "pinning" was to have certain
animation always visible (regardless of object selection -- e.g.
animating camera movement even while animating something else).

dea7ef4dd9 added a special case that would also
include the object regardless of it being selected or not if its
**object data** is animated and pinned.

It only fully implemented that for Cameras though (that was the primary
request at that time), leaving ugly blank/empty space (pin icon missing)
for other object data types.

It is understandable that it only did it for Cameras a that time, but
there is no reason to **not** do it for other (viewport selectable)
object data types as well (animators might as well be interested in
pinning other types as well for timing reference) -- which is what this
PR does.

Adding this to 4.5 (since it fixes the blank space (even though it is
somewhat adding a feature as well...)

Pull Request: https://projects.blender.org/blender/blender/pulls/141396
2025-07-04 10:11:34 +02:00
Philipp Oeser
9f3d47a5d8 Merge branch 'blender-v4.5-release' 2025-07-04 10:09:55 +02:00
Philipp Oeser
5787b74580 Fix #141378: Anim Channel Pinning on object data lost adding object anim
Seems like a mistake in dea7ef4dd9

The decision to display an object or not in animation filtering is done
in `animdata_filter_base_is_ok`
So e.g. if an **object** has `AnimData` and that one is pinned
(`ADT_CURVES_ALWAYS_VISIBLE`) it would be included regardless of it
being selected or not. dea7ef4dd9 added a special case that would also
include the object regardless of it being selected or not if its
**object data** is animated and pinned.

What dea7ef4dd9 did wrong though in that special case was that it also
required the object to **not** have animation.
This seems wrong, the object can have animation which itself is not
pinned (ultimately causing `animdata_filter_base_is_ok` to return
`false`).

So to resolve, remove the check for NULL object animation, it should be
entirely enough to have object data animation which is pinned to include the
object in animation filtering.

Pull Request: https://projects.blender.org/blender/blender/pulls/141379
2025-07-04 10:09:34 +02:00
Guillermo Venegas
eb3c6c0505 Fix: Collection name is clamped to 64 characters on creation
Noticed while adding the `Move to Collection` menu #140883.
This follows #137608

Pull Request: https://projects.blender.org/blender/blender/pulls/141350
2025-07-04 05:33:07 +02:00
Campbell Barton
a950d0b2b1 Build: correct error in 2a414eea0c 2025-07-04 13:20:39 +10:00
Eitan Traurig
be72a484e5 UI: Disable Copy and Remove Materials when slots are empty
Grey out this operator when material list is empty

Pull Request: https://projects.blender.org/blender/blender/pulls/141283
2025-07-04 04:55:05 +02:00
Campbell Barton
2a414eea0c PyAPI: Refactor attribute access to avoid creating & clearing exceptions
- Add PyObject_GetOptionalAttrString (only available in Python 3.13).
- When registering RNA classes use optional attribute access to avoid
  raising and clearing exceptions.
- Refactor macro that handles substituting Python's built-ins
  with a `for` loop for better readability.
2025-07-04 12:09:16 +10:00
Campbell Barton
dad8bddd78 Cleanup: remove redundant calls to PyErr_Clear after PyErr_Print
I was under the impression both were needed however
PyErr_Print always clears the error too.
2025-07-04 11:10:54 +10:00
Campbell Barton
b99e4e1de1 PyAPI: treat "None" fallback properties as missing in class registration
If `__name__` or `__doc__` were None, the property would be detected as
being set when checking if the property is set (for required properties).

This is more of a technical correction as its unlikely developers would
run into this in practice since `__name__` should never be None and
the description is not a required property.
2025-07-04 11:02:24 +10:00
Sean Kim
34ce46322c Refactor: Change SubdivCCG adjacency structs to use containers
This commit changes the `SubdivCCGAdjacentEdge` and
`SubdivCCGAdjacentVertex` structs to be simple wrappers around standard
container types, avoiding the need for manual memory management.

Pull Request: https://projects.blender.org/blender/blender/pulls/141163
2025-07-03 23:03:57 +02:00
Sean Kim
6fb90e5303 Fix: Background paint strokes may not initialize certain settings
When a paint stroke is executed instead of processed via the modal
handler, prior to this commit, the `paint_brush_update` function was
not called. This method handles initialization of some temporary stroke
data inside `UnifiedPaintSettings`, which is used by dyntopo when
performing edge collapse.

This had the result of causing a divide by 0 with certain uninitalized
settings when using a brush with dyntopo enabled and calling the
operator from the python API (e.g. from unit testing), resulting in
nonsensical deformations.

There are a number of weak points with the current design:
* This issue was only exposed because of the refactor to the
  `UnifiedPaintSettings`, indicating that despite these values being
  runtime-only, they were still persisted in some cases in .blend files
* The data stored as individual stroke steps is not sufficient to
  reconstruct a paint stroke given a list of screen-space locations, and
  this data is populated outside of the common `stroke` callbacks.

Both of the above issues are wider reaching than this PR is intended to
fix.

This commit ensures that `paint_brush_update` is called in the `exec`
codepath and updates the related test image.

Pull Request: https://projects.blender.org/blender/blender/pulls/141314
2025-07-03 23:00:28 +02:00
Sean Kim
2e049ba4a7 Merge branch 'blender-v4.5-release' 2025-07-03 13:58:55 -07:00
Sean Kim
954dbedc57 Fix #140309: Invalid normals when using external render engine in Sculpt Mode
External render engines, like Cycles, do not use the paint BVH for
rendering. As part of the stroke update process, normal caches are
tagged as dirty. These normals need to be recalculated to be valid on
the next stroke step.

This commit is a mitigation for the reported issue, but does not
fully fix the underlying issue that causes the cycles data to
be in this state.

Pull Request: https://projects.blender.org/blender/blender/pulls/140503
2025-07-03 22:58:16 +02:00
Hans Goudey
de63022ca0 Cleanup: Remove unnecessary SDNA info for node tool flags
These all have getters and setters anyway. The flag for "wait for click"
was wrong, even though that dicn't cause an observable bug (AFAIK).
2025-07-03 16:11:29 -04:00
Hans Goudey
7ca392b5ee Merge branch 'blender-v4.5-release' 2025-07-03 16:01:08 -04:00
Guillermo Venegas
b36e5b4b06 Refactor: UI: Replace UI_block_layout with blender::ui::block_layout
This renames `UI_block_layout` API as `blender::ui::block_layout`,
following uiLayout refactors.
This function now returns a layout reference instead of pointer,
this changes applies this return type where the layout can be used
as such reference.

Changes includes the use of `blender::ui::LayoutDirection` and
`blender::ui::LayoutType` as typed enum parameters.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141401
2025-07-03 22:00:46 +02:00
Hans Goudey
dd535aba68 Fix #141406: "Wait for Click" changes Node tools Grease Pencil toggle
A mistake in the original commit a7d2b7850e
2025-07-03 15:59:05 -04:00
Jesse Yurkovich
d303ab59d8 Merge branch 'blender-v4.5-release' 2025-07-03 11:44:23 -07:00
Jesse Yurkovich
c8a4026984 Mesh: Tune the parallelism of normals_calc_corners
Tune the grain size used for the parallel_for to alleviate excessive
mutex contention inside `handle_fan_result_and_custom_normals`.

I happened to notice that the 4004 Moore Lane USD scene[1] experienced a
load time regression compared to the prior release. It looks due to the
grain size used and here are some 3-run averages for the import:
```
Grain      | Time in seconds
256 (main) | (14.6+14.6+14.8)/3 = 14.6667
1024       | (13+12.8+12.9)/3 = 12.9
4096       | (13.3+13.1+13.1)/3 = 13.1667
16384      | (12.2+12+ 12.5)/3 = 12.2333
65536      | (9.4+9.2+9.6)/3 = 9.4
131072     | (7.9+7.7+8)/3 = 7.8667
262144     | (7.3+7.1+7.2)/3 = 7.2
max(16384, #verts/2) (PR) | (7.1+6.9+6.8)/3 = 6.9333
```

This PR gets the scenario loading in just under 7 seconds now compared
to over 14 originally.
[1] https://dpel.aswf.io/4004-moore-lane/

Pull Request: https://projects.blender.org/blender/blender/pulls/141249
2025-07-03 20:43:43 +02:00