Commit Graph

28828 Commits

Author SHA1 Message Date
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
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
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
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
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
Hans Goudey
a9e6417e19 Cleanup: Remove unnecessary mutex for draw attribute requests
As noted in [0], locking or atomics are not required for merging
requests for a single mesh, because there is no multithreaded iteration
over objects that will process the same mesh in multiple threads. This
locking was  added preemptively over the years and has made code
needlessly complicated, even while the final design for parallel object
iteration isn't completely clear. This PR removes the locks to simplify
some changes necessary for mesh attribute storage refactors.

[0]: b6764e77ef

Pull Request: https://projects.blender.org/blender/blender/pulls/141405
2025-07-03 19:14:26 +02:00
Harley Acheson
619968eb87 merge blender-v4.5-release 2025-07-03 09:31:55 -07:00
Christoph Lendenfeld
d7dd45e4da Fix #138399: Key handle jumping when scaling to 0
When moving a handle so its length is 0, the other handle was automatically set to 0 as well.
Cancelling the action didn't move the other handle back to 0, but set its length to 1.

The reason for that was that the code tries to maintain the relation between the two handles,
but that would lead to a divide by 0 when either of the handles has a length of 0.
So it would set the handle length to 1 in that case.

The fix is to ensure that the length of a handle is never 0. This is done by clamping it at the key
position with a threshold of 0.001 and an extra floating point step to support large floating
point values.
This should not affect animation in any way.

This was discussed in the animation & rigging module meeting
https://devtalk.blender.org/t/2025-06-26-animation-rigging-module-meeting/41272#p-153605-patches-review-decision-time-5

Co-authored by Nathan Vegdahl

Pull Request: https://projects.blender.org/blender/blender/pulls/141029
2025-07-03 12:47:15 +02:00
Damien Picard
7f0d15b31f Python: Add new APIs to collection.exporters
Add three new RNA functions to `bpy.types.CollectionExports`:
- `collection.exporters.new('IO_FH_alembic', name="Alembic")`
- `collection.exporters.remove(exporter)`
- `collection.exporters.move(0, 1)`

which allow to respectively create, remove, and reorder collection
exporters. Previously, they were only achievable using operators and
not the Python data API.

Example usage:

```python
C.collection.exporters.new("test")
# Traceback (most recent call last):
#   File "<blender_console>", line 1, in <module>
# TypeError: CollectionExports.new(): error with argument 1, "type" -
#   enum "test" not found in ('IO_FH_alembic', 'IO_FH_usd',
#   'IO_FH_obj', 'IO_FH_ply', 'IO_FH_stl', 'IO_FH_fbx')

usd_exporter = C.collection.exporters.new('IO_FH_usd')
usd_exporter.filepath = "//exp.usd"

stl_exporter = C.collection.exporters.new('IO_FH_stl')

C.collection.exporters.move(0, 1)
C.collection.exporters.remove(stl_exporter)
```

The exporter UIList was updated to add arrows calling the move
operator.

Co-authored-by: Pratik Borhade <pratikborhade302@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/141076
2025-07-03 11:58:07 +02:00
Campbell Barton
62c063820c Merge branch 'blender-v4.5-release' 2025-07-03 18:39:21 +10:00
Campbell Barton
def2db3bdb Build: resolve error building without TBB 2025-07-03 18:36:29 +10:00
Bastien Montagne
841b518bf6 Refactor: Make Main struct a non-trivial C++ one.
Allows to use regular constructor/destructors. And standard CPP data
like string, maps, etc.

Main is defined as non-movable and non-copyable for the time being.

The existing creating/deleting API is kept as-is, moving to direct
MEM_new/MEM_delete usages in the code is kept as a later cleanup commit.

The 'ListBase' of split-by-libraries Mains has been replaced by a VectorSet.

This is an unfortunate consequence of making Main a non-trivial C++
struct: it is no more guaranteed that next/prev pointers required for
ListBase remain immediately at the top of the struct anymore - and on
Windows they indeed don't.

So move to a more modern form of storage for split-by-libraries mains,
with a few other related changes to internal readfile code.

WARNING: This is quite a sensitive change, extensively tested locally
(including library-related changes across undos and redos, in complex
production scenes).

Pull Request: https://projects.blender.org/blender/blender/pulls/141086
2025-07-03 10:22:30 +02:00
Campbell Barton
6f954e5c1a Extensions: strip the "www." prefix when creating repository names
Exclude this prefix as it's not useful to include in the name.
The issue was raised in #141212.
2025-07-03 18:21:16 +10:00
Sean Kim
412452fe39 Cleanup: Add comments for adjacency maps in SubdivCCG
Pull Request: https://projects.blender.org/blender/blender/pulls/141306
2025-07-02 20:59:30 +02:00
Falk David
56dc3539ce Merge branch 'blender-v4.5-release' 2025-07-02 17:17:24 +02:00
Falk David
92d72467a7 Fix #141222: Assert hit when resizing CurvesGeometry to 0
The `CurvesGeometry::resize` function would not work properly when
passing a new size of zero.
1) The `CustomData_realloc` would allocate an array with zero size.
2) A new size of 1 is passed to `implicit_sharing::resize_trivial_array`
   for the curve offsets when it should pass 0.
3) A value is written out-of-bounds to `curve_offsets`

This fixes the issues in the following ways:
1) `CustomData_realloc` now doesn't allocate any data when the new
    size is 0 and sets the `layer->data` to `nullptr`.
2) When the new number of curves is 0, resize the `curve_offsets` to 0
  not to 1. This also ensures that the data pointer is `nullptr`.
3) Make sure to only write the first and last curve offset when the
  number of curves is greater than 0.

Pull Request: https://projects.blender.org/blender/blender/pulls/141333
2025-07-02 17:16:50 +02:00
Guillermo Venegas
3f9d9c9e6b UI: Add Move to Collection Menu
This replaces the Move/Link to Collection operator popup with a menu,
allowing this to be able to search collection to move and to expand
this menu from other menus.
This removes the expected memory leak of using the popup.

Move to Collection operator now uses `session_uid` to identify
target collection, this now allows to target a collection from another
scene, however, is not exposed throw UI)

Resolves #133772

Pull Request: https://projects.blender.org/blender/blender/pulls/140883
2025-07-02 16:21:36 +02:00
Sebastian Parborg
0d006c6078 Merge branch 'blender-v4.5-release' 2025-07-02 13:58:22 +02:00
Sebastian Parborg
48b5906cba Fix #141111: Time remapping should not affect the audio playback
We do not do any audio time stretching when doing time remapping.
As we also use the audio to keep track of time passed, we should always
pass the actual timestamp we are starting playback from.

The issue was that the old logic would try to undo time remapping on cfra.
However cfra is already correct and is not remapped. I'm guessing that
this changed at some point and we forgot to fix it up in the sound code.

Pull Request: https://projects.blender.org/blender/blender/pulls/141288
2025-07-02 13:44:51 +02:00
Bastien Montagne
d334f78496 Merge branch 'blender-v4.5-release' 2025-07-02 12:27:12 +02:00
Bastien Montagne
78d78223b8 Fix #139715: Issue when duplicating Scene/Collection/Object with objects in EditMode.
Detection of whether an object is in Edit mode can rely on checking its
obdata ID status (for meshes e.g.), which will falsly make remapping
code think it is remapping the obdata of an edited object.

Somewhat work around the issue by forcing such remapping for the time
being. On the long run, check should be updated to only rely on the
Object's status.
2025-07-02 12:24:54 +02:00
Lukas Tönne
b613216864 Refactor: clean up bone envelope falloff function and modernize math
This just refactors the `distfactor_to_bone` function using modern C++
math and better variable names to clarify what it does.
No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/141289
2025-07-02 09:57:34 +02:00
Laurynas Duburas
d21517c6c7 UI: Curves: NURBS weight in Transform panel
Adds NURBS weight, radius and tilt to Transform panel.
To avoid code duplication  code is a bit refactored and `struct TransformMedian_GreasePencil` is removed.
Also GP case has a race condition in existing version. It is fixed using `std::atomic`.

Pull Request: https://projects.blender.org/blender/blender/pulls/141079
2025-07-02 05:38:21 +02:00
Hans Goudey
1f92fd7577 Refactor: Use AttrType instead of CustomData type in attribute API
Change `eCustomDataType` to `bke::AttrType` for uses of the attribute
API (the `AttributeAccessor` one anyway). I didn't touch any values that
might be saved in files; those should be handled on a case by case basis.

Part of #122398

Pull Request: https://projects.blender.org/blender/blender/pulls/141301
2025-07-01 22:14:26 +02:00
Hans Goudey
09902044ff Fix: Default value ignored for some new builtin attributes
0dbe435aa8 was not complete.

Pull Request: https://projects.blender.org/blender/blender/pulls/141304
2025-07-01 21:27:14 +02:00
Hans Goudey
0dbe435aa8 Fix: Invalid default value when creating some builtin attributes 2025-07-01 19:20:05 +02:00
Hans Goudey
bf0bcfb7c6 Cleanup: Use attribute API to access selection attributes 2025-07-01 19:20:05 +02:00
Hans Goudey
22e6aa619b Cleanup: Use attribute API to access UV maps in a few places 2025-07-01 19:20:05 +02:00
Hans Goudey
e54fc0a78d Cleanup: Use span accessor for mesh edges in softbody.cc 2025-07-01 19:20:05 +02:00
Hans Goudey
1f49ad963d Cleanup: Attributes: Remove outdated comment 2025-07-01 19:20:05 +02:00
Hans Goudey
54f81da296 Cleanup: Use span arguments for mesh mapping function
And use the attribute API to retieve UV seam data.
2025-07-01 19:20:05 +02:00
Hans Goudey
8fa54601e8 Cleanup: Remove unused mesh mapping function 2025-07-01 19:20:05 +02:00
Sean Kim
7e61ae1a2b Merge branch 'blender-v4.5-release' 2025-07-01 10:07:56 -07:00
Sean Kim
531bc5ca69 Fix: SubdivCCG uses 2x as much memory as needed for edge adjacency
On a Suzanne mesh with 125k faces subdivided at level 3, this patch
results in a 40MB savings of memory, from 1.24 GB measured in Blender
itself to 1.20 GB with this patch applied.

Pull Request: https://projects.blender.org/blender/blender/pulls/141167
2025-07-01 19:07:10 +02:00
Sean Kim
113225d6f8 Cleanup: Use references instead of pointers for subdiv_ccg.cc
Pull Request: https://projects.blender.org/blender/blender/pulls/141257
2025-07-01 18:36:05 +02:00
Sean Kim
750845589e Cleanup: Remove unused struct from subdiv_ccg.cc
Pull Request: https://projects.blender.org/blender/blender/pulls/141255
2025-07-01 18:31:21 +02:00
Hans Goudey
68759af516 Attributes: Use AttributeStorage for curves and Grease Pencil
This commit moves Curves and Grease Pencil to use `AttributeStorage`
instead of `CustomData`, except for vertex groups. This PR mostly
involves extending the changes from the above commit for point clouds
to generalize to other geometry types.

This is mostly straightforward, though a couple non-trivial places of
note are the joining of Grease Pencil objects (`merge_attributes`), the
"default render fallback" UV for curves objects which was previously
unused at the UI level and just ended up being the first attribute, and
the `update_curve_types()` call in the curves versioning function.

Similar to:
- fa03c53d4a
- f74e304b00

Part of #122398.

Pull Request: https://projects.blender.org/blender/blender/pulls/140936
2025-07-01 16:30:00 +02:00
Christoph Lendenfeld
8be420ff1f Merge branch 'blender-v4.5-release' 2025-07-01 14:33:41 +02:00
Christoph Lendenfeld
3233ddc3b3 Fix #141243: Crash when removing constraints with drivers via python
The issue was that the depsgraph was not rebuilt, thus
the driver node still stuck around. This then crashed when the
depsgraph evaluated.

The reason why this wasn't caught in the unit tests, was because the
depsgraph was not updated between creating and removing the data.

Pull Request: https://projects.blender.org/blender/blender/pulls/141272
2025-07-01 14:28:27 +02:00
Sean Kim
d73b8dd4f3 Paint: Migrate radial_symmetry from Scene to Mesh
This commit introduces the `radial_symmetry` property on the `Mesh`
datablock and simultaneously removes the `radial_symm` property in
Sculpt, Vertex Paint, and Weight Paint.

This allows users to have these symmetry values defined on a per-object
basis instead of needing to reconfigure it for each mesh.

Current values stored on the `ToolSettings` on a per-scene basis are not
copied to each mesh in a scene. This is done to avoid introducing
potentially inaccurate data to a large number of meshes at the cost of
some minor backwards incompatibility.

Part of #108107

Pull Request: https://projects.blender.org/blender/blender/pulls/141108
2025-06-30 23:58:05 +02:00
Omar Emara
fd24e1001a Refactor: Move contextual init before socket declaration
Currently, the standard init function is called before socket
declaration, but the contextual init function is called after, which is
problematic if the declaration depends on the initialization step. This
patch moves the contextual init function to be called before declaration
just like the standard init function.

This is needed when moving the File Output node to use socket
declaration.

Pull Request: https://projects.blender.org/blender/blender/pulls/141203
2025-06-30 18:47:09 +02:00
Habib Gahbiche
7f668be362 Nodes: rename "Hide" to "Collapse"
Design task: https://projects.blender.org/blender/blender/issues/139158

Renaming includes:
- UI description
- Python operator description
- Code (Enums, function names and variables)

Unchanged:
- Python API
  - `bpy.ops.node.hide_toggle()`
  - `node.hide`
- Python operators / scripts

The reasoning is that improved naming is not enough reason to break
backward compatibility for Python API.

Pull Request: https://projects.blender.org/blender/blender/pulls/141038
2025-06-30 15:28:19 +02:00
Nathan Vegdahl
e41450b675 Merge branch 'blender-v4.5-release' 2025-06-30 11:58:51 +02:00
Nathan Vegdahl
2630fc4978 Anim: Fix incorrect fix for weight paint Smooth Operator
#138435 was an attempt to fix the issue in #138168 where the Smooth
Operator modifies locked vertex groups. Unfortunately, the fix actually
changed some already-correct code to be incorrect to compensate for the
buggy code in the Smooth Operator.

This reverts that fix and applies a correct fix, which is to exclude
locked vertex groups in the Smooth Operator's code itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/141093
2025-06-30 11:53:09 +02:00
Jacques Lucke
04dc6b34eb Fix #141115: crash when using volume grids in simulation zone 2025-06-30 09:26:08 +02:00
Benjamin Beilharz
ac82b70b87 Compositor: Add extension mode to Translate node
This patch introduces a new Extension Mode option to the Translate node,
replacing the current repeat option and adding an extra Extend mode when
the nearest boundary pixel is sampled. The option allows choosing from
Zero, Repeat, and Extend for each of the axis independently.

A new generic sample method was added to the Result class for sampling
with arbitrary interpolation and extension modes.

Pull Request: https://projects.blender.org/blender/blender/pulls/140607
2025-06-30 09:01:34 +02:00
Jacques Lucke
4c418bfa86 Merge branch 'blender-v4.5-release' 2025-06-30 08:48:50 +02:00
Jacques Lucke
42cc65e5b5 Fix #141149: crash when toggling bake node muting
The `StringRef` in `MemoryBlobReader` was referencing data
that was freed under some circumstances. While the actual packed
data is shared between the original object and copy-on-eval object,
the name of the blobs are not.
2025-06-30 08:47:54 +02:00