Commit Graph

117158 Commits

Author SHA1 Message Date
Brecht Van Lommel
3af82d2ea0 Fix: Preserving linked editable asset datablock fails with embedded ID
This is needed to make materials work with this system.

Pull Request: https://projects.blender.org/blender/blender/pulls/134226
2025-02-18 19:46:07 +01:00
Harley Acheson
35d14d578c Fix #133413: Don't Use Fallback for Sequencer Text Using Custom Fonts
If a sequencer text strip is using a custom font (not the default one)
then don't use the fallback font. This adds a new font flag to disable
the use of fallback.

Pull Request: https://projects.blender.org/blender/blender/pulls/133510
2025-02-18 19:05:34 +01:00
Richard Antalik
71e2e509ec Fix #134708: Audio render does not change file extension
Caused by case sensitive string comparison between RNA enum
name and pre-defined array with extensions.

The array with extensions was also missing ".aac" string.

Pull Request: https://projects.blender.org/blender/blender/pulls/134761
2025-02-18 18:31:51 +01:00
Hans Goudey
4b6a212986 Cleanup: Formatting 2025-02-18 11:30:17 -05:00
Hans Goudey
d0a89a0950 Fix #134707: Dynamic paint brush object movement ignored
Caused by bcfe4c34da.

The code was missing a dirty tag for the positions.
2025-02-18 10:54:41 -05:00
Sybren A. Stüvel
a228f150b3 Fix: compiler warning on Windows about an always-true check on enum value
Remove an overly-careful check on an enum value being greater than zero.
The check was added back in the day when this value was declared as
`int` and thus could easily be assigned anything.

The check for the upper limit was kept, and augmented with a
`BLI_assert()` so that failures here will actually go noticed and can
get fixed.

No actually functional changes. The data being checked is purely
runtime, and is assumed to be generated correctly already.

Pull Request: https://projects.blender.org/blender/blender/pulls/134736
2025-02-18 16:05:07 +01:00
Sybren A. Stüvel
2393d498cb Anim: add RNA function Action.fcurve_ensure_for_datablock(...)
Expose the convenience function `blender::animrig::action_fcurve_ensure()`
to RNA as `Action.fcurve_ensure_for_datablock(...)`.

The function requires that the Action is already assigned to the
data-block. It then takes care of slot assignment / creation, as well as
the creation of a layer and a keyframe strip.

This function call:

```python
fcurve = action.fcurve_ensure_for_datablock(ob_cube, "location", index=2)
```

effectively performs this logic:

```python
# Ensure the slot exists and is assigned:
slot = ob_cube.animation_data.slot
if not slot:
    slot = find_slot_for_keying(action)
if not slot:
    slot = action.slots.new(ob_cube.name)
ob_cube.animation_data.slot = slot

# Ensure a layer exists:
if action.layers:
    layer = action.layers[0]
else:
    layer = action.layers.new("Layer")

# Ensure a keyframe strip exists:
if layer.strips:
    strip = layer.strips[0]
else:
    strip = layer.strips.new('KEYFRAME')

# Ensure the channelbag exists:
channelbag = strip.channelbag(slot, ensure=True)

# Ensure the F-Curve exists:
fcurve = channelbag.fcurves.find("location", index=1)
if not fcurve:
    fcurve = channelbag.fcurves.new("location", index=1)
```

Here `find_slot_for_keying()` represents the logic that's also used when
creating keys via the user interface or the `bpy_struct.keyframe_insert()`
function.

Pull Request: https://projects.blender.org/blender/blender/pulls/134686
2025-02-18 16:04:00 +01:00
Sybren A. Stüvel
ca388fe313 Anim: update Action RNA descriptions to clarify legacy status
Update the Action RNA descriptions, to clarify which parts of the API are
considered legacy. These will only act on the action's first slot, in an
attempt to be backward-compatible with the pre-4.4 (non-slotted) actions.

No actual functional changes, just a change in the descriptions.

Pull Request: https://projects.blender.org/blender/blender/pulls/134683
2025-02-18 16:03:29 +01:00
Julian Eisel
2e28865ece Fix (unreported): Mismatching MEM_new/MEM_freeN on button handling data
New version of b22670d927 (which was reverted with 9d33dd88d5).

I rather keep `uiHandleButtonData` private to the handling code. It
does the allocation as part of its implementation details, so it should
also handle freeing.
2025-02-18 15:57:38 +01:00
Bastien Montagne
9d33dd88d5 Revert "Fix (unreported) invalid mismatch MEM_new/MEM_freeN on but->active."
This reverts commit b22670d927.
2025-02-18 15:39:18 +01:00
Bastien Montagne
b22670d927 Fix (unreported) invalid mismatch MEM_new/MEM_freeN on but->active.
Found by @brecht while reviewing !134463.
2025-02-18 15:10:39 +01:00
Bastien Montagne
ba1db8392b Fix (unreported) potential memory leak in IMBuf.
Found by @brecht while reviewing !134463.
2025-02-18 14:57:01 +01:00
Julian Eisel
fa4026f2bf Revert "Fix #130372: Implements memory of the previous state of eSpace_Types."
This reverts commit afec64739a.

The commit introduces a regression where opening the Asset Browser opens
the File Browser instead, same for other editor sub-types, see
blender/blender#134630.
blender/blender!134642 proposes a different solution and reverts this,
which I prefer too. Better to the revert separately from trying a
different fix for the initial bug, makes reviewing easier too.
2025-02-18 14:09:42 +01:00
Brecht Van Lommel
4e02acf2ba Fix #134607: Sequencer render animation preview not working
This main thread check was introduced in 4536a4c610. At the time OpenGL
only ever worked in the main thread, but that limitation was lifted in
Blender 2.80.

With this operator being converted to use the jobs system, it now needs
to work in non-main threads. Note that this code does not run in parallel
with main thread drawing anyway, because of WM_job_main_thread_lock_acquire
and draw manager locks. What changed is that we can now activate OpenGL
contexts on other threads.

Pull Request: https://projects.blender.org/blender/blender/pulls/134696
2025-02-18 13:21:02 +01:00
Pratik Borhade
42ce049194 Fix: Grease Pencil: vgroup_select operator not working
Mistake in 8c01a59411. Jump to next drawing instead of
exiting the loop when valid group with deformverts is not found.
Found this bug during !134695

Pull Request: https://projects.blender.org/blender/blender/pulls/134734
2025-02-18 11:02:55 +01:00
Pratik Borhade
179169d6c7 Fix #134505: Bevel redo panel closes when defining profile
Caused by 1bde901bf2
`UI_BTYPE_CURVEPROFILE` button has undo flag set. see button-layout in:
`edbm_bevel_ui() -> uiTemplateCurveProfile()`.

This  forces an undo push with the help of `ui_apply_but_undo/ui_apply_but_funcs_after`.
To handle the situation, skip undo push for buttons in hud region.

Pull Request: https://projects.blender.org/blender/blender/pulls/134552
2025-02-18 10:43:51 +01:00
Christoph Lendenfeld
996d19d4b3 Fix #129967: Annotations in the VSE not showing in Dope Sheet
The issue was that with the move to Grease Pencil v3,
annotations and normal GP use different IDs and support to show annotations
wasn't added back in.

This makes it so annotation keys are shown if "Only Show Selected" is disabled,
which works in the Dope Sheet and in the timeline.

In order to not show annotations of the scene twice, the scene-specific code is removed.
The annotations are now shown in a more generic way.

Pull Request: https://projects.blender.org/blender/blender/pulls/134565
2025-02-18 10:33:53 +01:00
Pratik Borhade
19631cae8a Fix #134428: Switching Animation Slots does not update node UI
Node region is not tagged to redraw when animation slot is changed.
`action_slot` RNA prop has `NC_ANIMATION`notifier set, use the same in
`node_region_listener` to tag region redraw.

Pull Request: https://projects.blender.org/blender/blender/pulls/134435
2025-02-18 10:33:23 +01:00
Pratik Borhade
73a9a024f9 Fix #134380: Error adding a torus after hiding a collection
This reverts 06a2617107.
Commit has introduced few errors from user perspective (#134277) and
python side (#134380). Best to revert it now then handle the bug fixes later.

The error in #134380 was due to `context.layer_collection` and
`active_layer_collection` returning excluded collection.

Pull Request: https://projects.blender.org/blender/blender/pulls/134546
2025-02-18 10:05:59 +01:00
Harley Acheson
9aeb97ccea Cleanup: Improved Comments in ui_def_but_rna__menu
Nothing but improvements to comments in this area of code to better
explain the complexity of Emum list row and column calculation. These
things change wrapping and column count to suit available space and
needs better explanation.

Pull Request: https://projects.blender.org/blender/blender/pulls/134719
2025-02-18 05:26:12 +01:00
Harley Acheson
b39bb42b3a Fix #134271: Reflow Non-Categorized Enum Lists Only If Necessary
For non-categorized lists, rather than always trying to find optimal
rows and columns, revert to prior behavior and only reflow if needed,
when the calculated rows are greater than maximum rows. This is less
disruptive, has less changes at small sizes where this doesn't matter.
Yet still does the job when things get too large to fit, or the list
is very long.

Pull Request: https://projects.blender.org/blender/blender/pulls/134713
2025-02-18 03:12:10 +01:00
Jason C. Wenger
6a4e7edf8a Fix BMesh split-op failing to output boundary & isovert_map slots
These were defined but never written to.

Part of !129318.
2025-02-18 12:09:05 +11:00
Harley Acheson
37c0b2c47d Fix #134592: Node Editor space_*_get Unregistered Tree Type Returns
When needing a friendly title and icon for windows and screen areas we
use SpaceType callbacks. For Node editors this could crash for custom
node trees that are unregistered. node_tree_type_find returns nullptr
since this custom tree type is not in the map. In this case just return
translated "Node Editor".

Pull Request: https://projects.blender.org/blender/blender/pulls/134692
2025-02-17 20:03:22 +01:00
Guillermo Venegas
f0d6391bd9 Fix: quiet warning const qualifier is applied to a function type
This avoids to adding const to the function type in a function pointer
while enabling `Span<FunctionType*>(Span<FunctionType*>)` ctor.

`Span<const FunctionType*>` should be considered invalid.

The warning: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4180?view=msvc-170

Pull Request: https://projects.blender.org/blender/blender/pulls/134425
2025-02-17 16:28:56 +01:00
Omar Emara
003fb98f9d Fix #134567: Compositor memory leak in some setups
The compositor leaks memory in certain setups where a transformed result
is linked to two inputs in the same pixel node. This happens due to an
overestimation in the computation of reference counts of those results.
Since pixel operations might share the same input for multiple links in
the node tree, the reference count should be corrected to take that
sharing into account.

This sharing was previously accounted for as part of releasing inputs in
the pixel operation, but input processors didn't take that into account,
so the realize on domain input processor would leak memory. So to fix
this, we correct the reference count at the evaluator level instead,
such that input processors can safely operate on the correct reference
count.

Pull Request: https://projects.blender.org/blender/blender/pulls/134666
2025-02-17 15:55:22 +01:00
Jeroen Bakker
ed5b077f92 Fix #134634: Overlay: Mask not drawing on top of render result/viewer
Logical error in the overlay engine. Moved mask drawing before the early
exit for viewer/render results.

Pull Request: https://projects.blender.org/blender/blender/pulls/134660
2025-02-17 14:14:12 +01:00
Jacques Lucke
78b5c47c46 Fix #134669: crash because of dangling socket declaration pointer 2025-02-17 12:37:23 +01:00
Andrej730
b9bbf48841 Fix: PyDocs typing issue with lists
Fixed use of lists using multiple arguments - `list` only
support a single argument.

Noticed working with fake-bpy-module - providing multiple
arguments to `list` resulted in typing error (e.g. "Too many type
arguments provided for "list"; expected 1 but received 2").

Pull Request: https://projects.blender.org/blender/blender/pulls/134663
2025-02-17 10:58:11 +01:00
Falk David
1a071ef755 Fix #134490: Grease Pencil: Clone brush in sculpt mode not working
The main issue was that the code was using
`foreach_editable_drawing_with_automask` which shouldn't have been
the case since there is no "masking" to be done when pasting strokes.

Additionally the code was computing the view position of every
pasted point and then computing the offset to move the points to the
mouse position.

Instead, we compute the center of the 3d bounds of the pasted strokes
and then project only the center to the view. From there we can offset
all the points to move them under the mouse cursor.

It's a bit weird to do this projection of the center to the view and
I believe we mainly do it to reuse the `DeltaProjectionFunc`.
There are cases where the projection of the center to the view will fail
which can lead to unexpected behavior on the user end. For now we
just leave the pasted strokes where they were copied from, which
isn't ideal. But this can be improved later.

Pull Request: https://projects.blender.org/blender/blender/pulls/134589
2025-02-17 10:38:02 +01:00
Jeroen Bakker
0faba244a5 Fix: Vulkan: Async readback of storage buffers
The vulkan backend was implemented with async in mind, however the one place
where Blender uses for async was implemented blocking. This PR splits the
readback into flushing the command and waiting for readback.

**Performance**

Improvement of animation playback performance of shader balls.blend is around 10%.
Shader balls.blend frame: 1-100, 10 x animation playback

| Branch               | Total time | Average time |
| -------------------- | ---------- | ------------ |
| blender-v4.4-release | 26851 ms   | 2685 ms      |
| This PR              | 23675 ms   | 2367 ms      |

Pull Request: https://projects.blender.org/blender/blender/pulls/134227
2025-02-17 08:58:06 +01:00
Campbell Barton
665b4dfbad Fix IDProperty comparison warning in debug mode
The warning to check if two numbers are nearly equal when comparing
floats didn't take negative numbers into account, causing -1.0 & 0.0
for e.g. to be considered not equal but close.
This also resolves a divide by zero.
2025-02-16 20:56:07 +11:00
Campbell Barton
a80bd2744d Fix incorrect null checks in animadata::find_related_ids 2025-02-16 19:39:44 +11:00
Pratik Borhade
9dddef9581 Fix #134316: Color being sampled from hidden faces in texture paint
If face that has been hit is hidden, skip sampling from the face,
instead use current pixel color.

Pull Request: https://projects.blender.org/blender/blender/pulls/134321
2025-02-16 08:58:52 +01:00
Campbell Barton
c80980d10b Fix #125376: Standalone bpy module can crash on exit 2025-02-16 18:27:02 +11:00
Campbell Barton
78ccea432f UI: correct array size check for colors
Allow arrays to be larger than 4.

Related to #134537.
2025-02-16 17:14:12 +11:00
Hans Goudey
77ed7bfca5 Fix: Incorrect selection field type in Set Selection node
The selection can be float or boolean for these geometry types.
At the very least this caused asserts in debug builds.
2025-02-14 15:43:19 -05:00
Hans Goudey
76794727d6 Fix: Spreadsheet point cloud selection filter with no attribute wrong
This shouldn't really affect the release since original point cloud data is hidden
but it might and the fix is trivial anyway: everything is selected when there's no
attribute, just like curves.
2025-02-14 15:42:23 -05:00
Harley Acheson
99d028cd7d Fix #134492: Do Not Assign Toggle Accelerators on First Pass
With ba9417470e we are assigning keyboard accelerator shortcuts to
menu items containing toggles. This PR makes the assignment to these
new items not occur on the first pass of doing so. This is less
disruptive in that first-letter shortcuts will remain the same from
prior versions, with only mid-word shortcuts possibly changing.

Pull Request: https://projects.blender.org/blender/blender/pulls/134526
2025-02-14 18:41:33 +01:00
Bastien Montagne
69f7530f7a Fix (unreported) invalid C-style allocation of non-trivial C++ data. 2025-02-14 18:39:24 +01:00
Falk David
bd5023349a Fix: Grease Pencil: Points copied from same stroke were not split
When copying (`Ctrl+C`) some ranges of points in the same stroke,
the points would still be copied as one stroke and not split into
multiple strokes.

This was a regression in behavior from 4.2.

Now we use the `remove_points_and_split` to split the selected
points into individual strokes.
2025-02-14 18:26:13 +01:00
Jacques Lucke
bb715caf94 Fix #134100: hair curves disappear when adding new curves without radius interpolation
The issue is that the existing curves did not have an explicitly set radius.
When adding new curves with an explicit radius, the radius of the old curves was
initialized to 0 and thus becoming invisible. This patch changes it so that all
the existing curves do get a default radius. The `radius_for_write` methods is
currently only used in places that overwrite the entire array, so adding the
default there shouldn't affect anything unintentionally.

Pull Request: https://projects.blender.org/blender/blender/pulls/134445
2025-02-14 17:41:59 +01:00
Bastien Montagne
bbebf72a33 Cleanup: Add explicit defaults to MEM_new-allocated structs with no constructors.
While not strictly needed (currently!), relying on C++ 'default
initialization' is fragile and unreliable.
2025-02-14 17:07:23 +01:00
Bastien Montagne
7000c392ff Cleanup: Add explicit defaults to MEM_new-allocated structs with no constructors.
While not strictly needed (currently!), relying on C++ 'default
initialization' is fragile and unreliable.
2025-02-14 17:07:23 +01:00
Falk David
2cc6f7bbb5 Fix #133339: Grease Pencil: Ensure span attribute writers are valid
When calling the `lookup_or_add` functions on `MutableAttributeAccessor`
we need to make sure that the writer is actually created and the call
did not fail.

This fixes many of the instances where we would use an unchecked
attribute writer and potentially crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/134413
2025-02-14 15:54:20 +01:00
Sybren A. Stüvel
62c21a0800 Fix: NLA Track Solo flag handling, in depsgraph and F-Curve iteration
This fixes the (unreported) issue where solo'ing an NLA track would only
play back animation when _any_ of the tracks were unmuted.

Some code considered a track to be muted when its `NLATRACK_MUTED` flag
was set regardless of the `NLATRACK_SOLO` flag, whereas other code did
consider the `NLATRACK_SOLO` flag.

Now all the code is consistent with what actual animation evaluation is
doing.

Pull Request: https://projects.blender.org/blender/blender/pulls/134500
2025-02-14 13:55:44 +01:00
Campbell Barton
79627e353d Fix #134537: Crash accessing colors in the UI with more than 4 elements
The UI code assumed buttons had no more than 4 elements
however Python scripts may define larger array sizes.

Resolve the bug by adding functions for array access that take an
array size limit to prevent buffer overflows (read & write).

Note that this only adds the "float" versions of these functions,
for completeness int & boolean can be supported as a separate commit.
2025-02-14 23:33:54 +11:00
Bastien Montagne
248d858475 Fix (unreported) invalid C-style allocation of non-trivial C++ data.
A bit less trivial than usual, since it was an 'array' of non-trivial
structs. Used a `blender::Array` instead.

NOTE: keeping changes to a minimum, there is much to refactor and
cleanup in this code.
2025-02-14 12:59:54 +01:00
Sybren A. Stüvel
c74f9e65ec Fix #134190: NLA track not evaluating when toggling its 'mute' setting
Add a new callback `setting_post_update` to the `bAnimChannelType`
that gets called after that setting was altered via the channel list
buttons and via `ANIM_channel_setting_set()`.

This is used when changing the NLA track SOLO and MUTE options, to
ensure that the dependency graph relationships get rebuilt.

This fixes #134190.

Pull Request: https://projects.blender.org/blender/blender/pulls/134347
2025-02-14 12:52:02 +01:00
Bastien Montagne
194e233d86 Fix (unreported) more invalid C-style allocation of non-trivial C++ data. 2025-02-14 12:23:38 +01:00
Ankit Meel
13c3d95f52 Xcode/thumbnailer: rebuild error due to rpath
Fix duplicate rpath error on rebuild by using CMake target
property.

Pull Request: https://projects.blender.org/blender/blender/pulls/134527
2025-02-14 10:46:48 +01:00