Commit Graph

145911 Commits

Author SHA1 Message Date
Christoph Lendenfeld
de31cecfaf Fix #133731: Performance issue with many stashed actions
When duplicating an action, it is stashed in the NLA on a muted track.
Over time this can slow down blender, because certain code will look at every
FCurve in every action in the NLA.
To fix the performance issue, we can take advantage of the fact that
stashed actions are put onto a muted NLA track.

With this patch any strip on a muted NLA track is ignored in the
Depsgraph evaluation.

Measurements of `DEG_graph_relations_update`

| - | Before | After |
| - | - | - |
| 50 actions | ~140 ms | ~10.0 ms |
| 100 actions | ~250 ms | ~10.7 ms |

Pull Request: https://projects.blender.org/blender/blender/pulls/133864
2025-01-31 16:38:30 +01:00
Clément Foucault
651ae0e47c Metal: Add OOB coordinate rejection to image atomic functions
These should have been guarded but are not, creating
buffer out of bound access error on Apple devices.
2025-01-31 16:17:58 +01:00
Clément Foucault
636147053d Metal: Add support for repeating byte sequence for buffer clearing
This allows to run with the --debug-gpu option (which
does NAN and 0xF0F0F0F0 clearing) without asserts
even when the texture atomic workaround is enabled.
2025-01-31 16:13:56 +01:00
Clément Foucault
067f6767d4 Fix #129571: Metal: Broken texture atomic workaround
The refactor 9c0321ae9b
had the wrong mental model of the backing texture
layout for the atomic workaround.

For 3D textures, the layout is breaking the 3D texture
and reinterpreting the linear location as its 2D
linear location. This breaks the 3D texture Z slices
into non contiguous regions in 2D.

Comments have been added to avoid future confusion.

Pull Request: https://projects.blender.org/blender/blender/pulls/133830
2025-01-31 16:10:59 +01:00
Philipp Oeser
7397fda92b Fix #133764: Collada crash (editmode + triangulate + apply modifiers)
Exposed by bc0b86797c
(but even before we had Asserts in a debug build -- also crashed
WITH_ASSERT_ABORT OFF)

The call to ensure Mesh data from a mesh in edit mode needs
to happen before the triangulation which uses Mesh. This gets rid of
the crash and also previous asserts.

Pull Request: https://projects.blender.org/blender/blender/pulls/133859
2025-01-31 15:46:12 +01:00
Sybren A. Stüvel
f97c54ff76 Anim: emit liboverride on slot handle when action is changed
Emit a 'diff' for the `animdata.slot_handle` property whenever the
`.action` property is changed through a library override.

The slot handle is only meaningful within the context of the assigned
action. So when a liboverride changes the assigned action, the slot
handle should also get an override.

This is necessary even when the numerical value of the slot handle
happens to be the same in both actions, as the newly chosen slot is
different from the slot that was chosen in the library file.

This applies to direct Action assignment, NLA strips, and Action
constraints.

Pull Request: https://projects.blender.org/blender/blender/pulls/133727
2025-01-31 15:43:34 +01:00
Sybren A. Stüvel
815337a7da Anim: add ensure parameter to KeyframeStrip.channels(...) RNA function
Add `ensure` boolean parameter to the `ActionKeyframeStrip.channels()` RNA
function. Passing `ensure=True` will ensure the channelbag for the given
action slot handle exists. This makes it more straight-forward to create
F-Curves for a slot regardless of whether there already was a channelbag
for those F-Cuves:

```python
strip = action.layers[0].strips[0]
slot = action.slots[0]

# Old:
channelbag = strip.channels(slot.handle)
if not channelbag:
    channelbag = strip.channelbags.new(action_slot)
ob_loc_x = channelbag.fcurves.new('location', index=0)

# New:
channelbag = strip.channels(slot.handle, ensure=True)
ob_loc_x = channelbag.fcurves.new('location', index=0)
```

Pull Request: https://projects.blender.org/blender/blender/pulls/133678
2025-01-31 15:16:10 +01:00
Lukas Tönne
7f5c803a8b Fix #133572: Grease Pencil: Reproject operator raycast instead of depth buffer
The reproject operator in GPv3 was implemented using the depth buffer instead of
using the transform snap functions that are based on raycasts. This causes
problems with accuracy and does not account for possible animation of objects.

This patch reintroduces the raycast method.

Pull Request: https://projects.blender.org/blender/blender/pulls/133863
2025-01-31 14:55:26 +01:00
Bastien Montagne
2612b27e42 Refactor: Move 'need link' and 'need expand' ID tags to runtime readfile data.
Also adds a new `BLO_readfile_id_runtime_tags_for_write` accessor to
ensure readfile data is created before assigning a tag value.

Followup to 2ec1b6887d. Should cover the last existing ID tags that
can be moved to temp runtime readfile ID data.

Pull Request: https://projects.blender.org/blender/blender/pulls/133715
2025-01-31 14:26:38 +01:00
Pratik Borhade
41e693c43c Fix #133407: Grease Pencil: Support auto merge for Primitives
Auto-merge with nearby strokes seems to only implemented for stroke drawing.
Code has been copied from `on_stroke_done()` that handles the
auto-merging, this will allow to join the primitive shape with nearest stroke.

Pull Request: https://projects.blender.org/blender/blender/pulls/133420
2025-01-31 14:22:30 +01:00
Hans Goudey
e79859ab14 Refactor: Use Map instead of GHash for Python translations cache
This makes the code simpler, aligns it with the builtin translations in
messages.cc, and should improve performance as well. My motivation
for the change is to allow returning StringRef/StringRefNull from the
translation functions instead of char pointers.

To test the change I used the Sun Position addon which includes
translations and toggled different languages in the preferences.

Pull Request: https://projects.blender.org/blender/blender/pulls/133827
2025-01-31 14:10:14 +01:00
Sybren A. Stüvel
a058922e68 Refactor: Anim, use std::cout for debug prints instead of printf()
Use streaming to `std::cout` for debug prints, rather than using
`printf()`. Different compilers disagree on the `printf()` format string
for `int64_t`: GCC thinks it should be `%ld` while Clang says `%lld`,
and either will emit a warning when the other's preference is used.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133857
2025-01-31 12:48:02 +01:00
Jeroen Bakker
96c9153c5e Fix: Vulkan: Use after free of VkBufferView
VkBufferViews could be used after they were freed. The reason is that
they were not managed by the discard pool. Detected when looking in
failing render tests (pointcloud_motion.blend).

This part of the API is used by motion blur in EEVEE. Fixes the next
render tests

- `eevee_next_motion_blur_vulkan`
- `eevee_next_pointcloud_vulkan`
- `eevee_next_hair_vulkan`

Related: #133546
Pull Request: https://projects.blender.org/blender/blender/pulls/133856
2025-01-31 11:41:39 +01:00
Christoph Lendenfeld
037c0c74a1 Fix #133786: Crash when modifying a Grease Pencil NLA track
The issue is that `ANIM_animdata_filter` with the flag `ANIMFILTER_ANIMDATA`
did not actually return only animdata.

The reason for this is in `animdata_filter_grease_pencil_data`,
where there is special handling for this flag.

It seems that returning non-animdata things is expected for Grease Pencil.
So my solution is to just verify the type of `bAnimListElem` before use.

Pull Request: https://projects.blender.org/blender/blender/pulls/133853
2025-01-31 11:31:37 +01:00
Jeroen Bakker
63a6bea4e8 Bump render test 2025-01-31 11:28:31 +01:00
Nathan Vegdahl
b166fa46b8 Anim: set Action.idroot when writing blend file, for forward compat
When writing an Action to a blend file, for forward compatability
reasons the animation data in the first slot is also written to the old
Animato Action storage locations. That way, loading the Action in an
older version of Blender will still at least have that animation data.

However, we overlooked `Action.idroot`, which indicates which ID
type the Action is for, and therefore all Actions have an unspecified
`idroot` when loaded in pre-layered-action versions of Blender.

This PR fixes that by also setting the `idroot` to match the target ID
type of the first slot when writing to disk.

Pull Request: https://projects.blender.org/blender/blender/pulls/133819
2025-01-31 10:47:16 +01:00
Omar Emara
028506712d Fix #133807: File Output node ignores transforms
The File Output node sometime ignores the transformations of their
inputs. That's due to the fact that transforms are now delayed and the
File Output node does not realize its inputs on its domain in case it
was not multi-layer.

To fix this, add another realization mode for transforms only. And use
that in the File Output node, as well as the Bokeh Blur, UV Map, and
Plane Track Deform, which also need this fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/133850
2025-01-31 10:14:54 +01:00
Omar Emara
3fd894a2d9 Fix #133847: Single value node trees fail in GPU
Nodes that process single values can fail to work for GPU compositing.
That's because multi-function procedures writes to the single values but
never uploads them to the GPU, which is what this patch does.

Pull Request: https://projects.blender.org/blender/blender/pulls/133851
2025-01-31 10:10:22 +01:00
Pratik Borhade
126b3722ae Fix #133656: Grease Pencil: Move to new layer fails with matching names
When creating a layer, suffix is added to the new layer name. In move to
layer operation, the target layer is searched based on the old name,
results in transferring strokes to wrong layer. Now fixed with correct
target layer.

Pull Request: https://projects.blender.org/blender/blender/pulls/133697
2025-01-31 10:06:24 +01:00
Brecht Van Lommel
bbdd6419ac Fix #133800: View Render Animation leaves play buttons inactive
The operator can get freed late if the window is out of focus. So finish
up everything already when the job ends.

Pull Request: https://projects.blender.org/blender/blender/pulls/133828
2025-01-31 09:40:44 +01:00
Brecht Van Lommel
40ac21e5a5 Refactor: Move OGLRender data structure towards C++
https://projects.blender.org/blender/blender/pulls/133828
2025-01-31 09:40:44 +01:00
Pratik Borhade
7e5749c679 Fix #133314: Grease Pencil: Move strokes to same layer clears wrong data
When moving strokes to same layer, curve at wrong index is removed at
the end of operation. This seems to happen due to wrong order of
geometryset component.

Pull Request: https://projects.blender.org/blender/blender/pulls/133359
2025-01-31 09:11:56 +01:00
Omar Emara
75f1cbb6dd Refactor: Clarify code around scheduling composite nodes
There is a special case in the compositor code where viewer nodes are
treated as composite nodes. This patch renames relevant methods and
updates comments to clarify this use case.

Pull Request: https://projects.blender.org/blender/blender/pulls/133811
2025-01-31 07:43:00 +01:00
Omar Emara
5fd5685a6a Compositor: Allow repeating in the Translate node
This patch changes how the Wrap option in the Translate node works. It
now repeats infinitely when realized, and not just in its own domain.
This is essentially how it used to work prior to version 4.2, so we are
reverting that change. We also rename Wrap to Repeat for clarity.

This is part of an ongoing to project to allow the user to control how
boundaries and empty areas are filled after transformations. So similar
options will be added to all transform nodes. But this patch is the
first step, since the functionality is already there, we just need to
extend it to work in all domains.

Pull Request: https://projects.blender.org/blender/blender/pulls/133766
2025-01-31 07:41:40 +01:00
Campbell Barton
09cf9caa75 Docs: clarify doc-strings for edit-bone selection & visibility
Ref !133743
2025-01-31 15:43:52 +11:00
Campbell Barton
9d4b48b107 Cleanup: spelling in build-files & docs 2025-01-31 15:22:50 +11:00
Campbell Barton
cb83a41dc4 Cleanup: spelling in comments
Also include "release/" in the `check_spelling_py` target.
2025-01-31 15:07:11 +11:00
Alaska
850b749a76 Release tools: Add script to generate a list of bugs fixed from last release
This commit adds a script that will collect a list of commits that
fix bugs that have been in Blender for 1 or more major release.

This list can then be added to the release notes, an example being:
https://developer.blender.org/docs/release_notes/4.3/bugfixes/

Details about how it works can be found at the top of the script, or
by running the script with `-h`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131615
2025-01-31 04:13:48 +01:00
Campbell Barton
2be282a8f3 Cleanup: spelling in comments (check_spelling target) 2025-01-31 13:27:05 +11:00
Campbell Barton
ec40ad0b3f Cleanup: use str.format to format strings in Python 2025-01-31 13:22:10 +11:00
Campbell Barton
20c08147b3 Cleanup: resolve warnings from pylint
- `self` -> `cls` for class methods.
- quiet long line & unused variable warnings.
2025-01-31 13:22:04 +11:00
Campbell Barton
448e3c2009 Cleanup: remove redundant setting & add NUMPAD_1 for direct lookups
Add NUMPAD_1 to match NUMBERS_1 to avoid inline formatting,
also de-duplicate logic that uses both NUMBERS_1 & NUMPAD_1.
2025-01-31 13:08:05 +11:00
Lukas Stockner
c12f9ad765 Tests: Add a Cycles render test for velocity multi-step motion blur 2025-01-31 01:04:49 +01:00
Lukas Stockner
0677e19fa0 Fix: Cycles: Wrong motion transform interpolation when using velocity
The issue here is that originally, the step count for the geometry's
motion and the object transform's motion were tied together, so a
single variable is used to store that step count.
However, when using the velocity attribute, it's possible for the step
counts to differ, which will lead to an incorrect interpolated object
transform in the kernel.

Pull Request: https://projects.blender.org/blender/blender/pulls/133788
2025-01-31 00:47:55 +01:00
Jonas Holzman
8a2336bf0a Cleanup: Remove unused variable 2025-01-30 21:32:05 +01:00
Hans Goudey
8e13b2b048 Fix: Missing subtype for Points node position input 2025-01-30 14:31:02 -05:00
Harley Acheson
224dffc41b UI: Corrections for Object Scale Warnings
Small changes to the status bar display when the active object has non-
uniform or negative scale. Use CTX_data_active_object rather than
BKE_view_layer_active_object_get. Case correction for a text string.
Small spacing change. Improved comments.

Pull Request: https://projects.blender.org/blender/blender/pulls/133834
2025-01-30 20:10:22 +01:00
Hans Goudey
c2fd4eb9cc Cleanup: Deduplicate custom VectorSet identifier hash and equality
Add `CustomIDVectorSet` for this purpose.
Based on code from Jacques in #133778.

Pull Request: https://projects.blender.org/blender/blender/pulls/133821
2025-01-30 19:51:40 +01:00
John Kiril Swenson
cc97c55515 Cleanup: VSE: Replace usage of find_nearest_seq
The original function did extensive calculations to get the nearest handle,
even though none of the calling functions used that information.

Its functionality was very similar to `mouseover_strips_sorted_get`, except
that it was less precise and did not factor in `STRIP_OFSBOTTOM/OFSTOP`.
`mouseover_strips_sorted_get` is called by
`ED_sequencer_pick_strip_and_handle`, so update all of the calling functions to
use this instead.

Refactor and replace `find_nearest_seq` into `mouseover_strip_get`, which does
not factor in padded strip handles, and is used only by
`ED_sequencer_special_preview_set` as a static function for scrubbing over
strips.

Pull Request: https://projects.blender.org/blender/blender/pulls/133744
2025-01-30 18:57:30 +01:00
Harley Acheson
46a418e7b5 UI: Status Bar Display for Key Blending
For all 12 items in the Graph Editor Key Blend menu, improve the
display of the status bar by using icons, state highlighting, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/133461
2025-01-30 18:49:26 +01:00
Sean Kim
0ca96421b9 Tests: Fix "opengl_draw" tests
The opengl_draw_tests.py render test had a number of issues when
running, likely due to test data restructuring:
* Invalid CMakeLists.txt specification preventing tests from being added
* Invalid parameters to the `screenshot` function

This commit fixes both issues as well as renames the related files and
folders to better indicate their usage.

Pull Request: https://projects.blender.org/blender/blender/pulls/132838
2025-01-30 18:44:23 +01:00
Ankit Meel
301e298040 Build: Remove macOS mold and lld linkers support
The mold linker doesn't support macOS anymore. The sold linker
gets no new releases since the Xcode 15+ linker is at par with sold.

https://github.com/bluewhalesystems/sold/issues/50#issuecomment-2076249631
https://github.com/rui314/mold/issues/189#issuecomment-1495288926

Pull Request: https://projects.blender.org/blender/blender/pulls/133634
2025-01-30 18:21:38 +01:00
Harley Acheson
06a43d7d99 UI: Object Scale Warnings
Show warnings on the status bar during idle time (not running any
operators) when the active object has non-uniform or negative scale.

Pull Request: https://projects.blender.org/blender/blender/pulls/132969
2025-01-30 18:09:46 +01:00
Hans Goudey
9c94c3803f Cleanup: Follow style guide for public member naming 2025-01-30 11:27:14 -05:00
Laurynas Duburas
a806f1c866 Curves: Optimization of ed::curves::duplicate_points
Adds new function `foreach_content_slice_by_offsets` that gathers mask's
indices into `IndexRange` lists grouped by given offsets. New approach
doesn't need temporary `points_to_duplicate` array of size
`curves.points_num()`. Traversal is more effective as only selected
indices get visited. Also point data is copied by point ranges instead
of point by point.

Performance was tested with following code:
```cpp
TEST(curves_geometry, DuplicatePoints)
{
  CurvesGeometry curves = create_basic_curves(100000, 100);

  IndexMaskMemory memory;
  IndexMask every_second = IndexMask::from_predicate(
      curves.points_range(), GrainSize(100), memory, [](const int i) {
        return bool(i % 2);
      });

  for (const int i : IndexRange(1000)) {
    CurvesGeometry copy = curves;
    const int expected_point_count = copy.points_num() + every_second.size();
    ed::curves::duplicate_points(copy, every_second);
    EXPECT_EQ(copy.points_num(), expected_point_count);
  }
}
```
|          |   main   | mask slices | slices & copy by ranges |
| -------- | -------- | ----------- | ----------------------- |
| full copy|  3346 ms | 2270 ms | 1614 ms |
| `i % 2`  |  8084 ms | 5918 ms | 5112 ms |
| `!((i % 10 == 0) or` <br/>`(i % 10 == 1) or` <br/>`(i % 10 == 2))` | 4522 ms | 2860 ms | 2343 ms|
| `(i % 10 == 0) or` <br/> `(i % 10 == 1) or` <br/> `(i % 10 == 2)`| 4088 ms | 1961 ms | 1639 ms|
| `IndexRange(50020, 70)` <br/> <sub>(one small range in the middle)</sub>| 1966 ms | 100 ms | ~75 ms |

Pull Request: https://projects.blender.org/blender/blender/pulls/133101
2025-01-30 17:19:16 +01:00
Harley Acheson
40eadc75be UI: Transform Feedback for Invalid States
This adds support for Transform MouseInputMode INPUT_ERROR using a new
transform cursor HLP_ERROR (dashed line ending with WM_CURSOR_STOP.
This is shown when attempting an object rotation or scale when
transforms are set to "Affect Only Locations". At this time the status
bar is also cleared and an warning message is shown.

Pull Request: https://projects.blender.org/blender/blender/pulls/132957
2025-01-30 17:11:14 +01:00
Philipp Oeser
fd9f046db2 ANIM: remove redundant BONE_SELECTED check
This is already included in the EBONE_EDITABLE macro

Pull Request: https://projects.blender.org/blender/blender/pulls/133661
2025-01-30 16:40:49 +01:00
Philipp Oeser
4fc6d7685b Fix #133635: "Move to Collection" acts on EditBones in hidden groups
Operators should not act on non-visible entities really.

Posemode already did the combination of "visible and selected" via
`FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN`, editmode didnt.

To resolve, add `EBONE_VISIBLE` as a condition (as done elsewhere).

Pull Request: https://projects.blender.org/blender/blender/pulls/133660
2025-01-30 16:40:21 +01:00
Jeroen Bakker
4dbb9b34c6 Fix: Vulkan: Compositor cryptomatte
When using cryptomatte the last identifier was never used due to a
memory alignment issue. Scalar types should not be aligned, but they
were.

Pull Request: https://projects.blender.org/blender/blender/pulls/133815
2025-01-30 15:51:09 +01:00
RedMser
032feaf65f Fix #133812: Strip color picker uses invalid icon enum
Regression in a9c87a15fc - missed "sequence" -> "strip" renaming.

Pull Request: https://projects.blender.org/blender/blender/pulls/133814
2025-01-30 15:45:58 +01:00