Commit Graph

117359 Commits

Author SHA1 Message Date
YimingWu
d443932c73 Fix #135728: Grease Pencil: Correct point count in length modifier
In Grease Pencil length modifier, if a stroke is not filtered, it
may not have a valid point count/offset. This fix ensures that we
get valid point count by copying it beforehand.

Pull Request: https://projects.blender.org/blender/blender/pulls/135733
2025-03-10 14:54:28 +01:00
Sybren A. Stüvel
955e02c90d Fix: Duplicating a Scene does not remove animation from slotted actions
When duplicating a scene in any way other than Full Copy, the VSE data
is (apparently) not copied along. To prevent dangling F-Curves, any
animation of sequencer strips is removed. This is now done correctly for
slotted Actions, instead of looping over the legacy `action->curves`
field.

Also the F-Curve RNA path that's being tested for is updated. Instead of
deleting all F-Curves with `sequences` in the name, the code now
correctly looks for `sequence_editor.strips_all`.

Pull Request: https://projects.blender.org/blender/blender/pulls/135576
2025-03-10 14:49:12 +01:00
Sybren A. Stüvel
216964c697 Fix: Crash when scene has F-Curves for VSE sequencer strips, but no VSE
Fix a crash when the Scene's Action has F-Curves targeting the VSE
sequencer strips, but the scene has no VSE data at all.

This issue occurs in the following way:

- Scene uses VSE, with an animated strip.
- Duplicate the scene using Linked Copy. This does _not_ copy the VSE
  into the duplicate scene, but does include its animation (due to a bug
  for which a fix is coming).
- Ensure the Dope Sheet is visible & showing the scene animation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135576
2025-03-10 14:49:03 +01:00
Hans Goudey
c52da69dfb Fix #135643: Node ungroup operator doesn't move frame nodes
Caused by 4bf34d9591.

Nodes within frames were ignored because previously their location was
relative to the frame, so moving both the frame and the node would cause
"double" movement. Now each node location is independent.
2025-03-10 09:32:12 -04:00
Clément Foucault
690a165630 Fix #135652: Overlay: Overlays draw in front of mesh in Paint modes
This was caused by a missing prepass.
Only early out if drawing the prepass, otherwise, run all checks.
This is much safer.
2025-03-10 13:07:35 +01:00
YimingWu
c31c2656e4 Fix #135673: Grease Pencil: Dash modifier deletes unfiltered strokes
Grease Pencil dash modifier wasn't merging strokes from strokes that are
unfiltered, resulted in only filtered strokes being shown afterwards.
This fix joins generated strokes with what's left behind so there's no
stroke missing.

Pull Request: https://projects.blender.org/blender/blender/pulls/135705
2025-03-10 19:59:14 +08:00
Lucas
de90eb9c91 Grease Pencil: Reduce size of primary gizmo on line primitives
Reduce size of last endpoint gizmo on line primitives `size_primary` 8.0f
to be the same size of `size_tertiary` 3.0f. Circle and Box primitives are
unchanged as they don't have endpoints and a bigger gizmo doesn't affect
visibility. Motivation for this change is to increase visibility of the endpoint
while drawing since the default is too big for these type of lines and it
blocks the view of it.

Pull Request: https://projects.blender.org/blender/blender/pulls/135658
2025-03-10 12:53:22 +01:00
Julian Eisel
df4345dbaa Fix #135655: Crash when setting Interpolate Sequences curve
The curve widget in the redo popup would sent an undo push which it
shouldn't really. Since 1bde901bf2 such undo pushes will lead to
clearing of the last operation data, which is exactly what the redo
popup displays.

Buttons in operator redo UIs shouldn't send undo pushes. 179169d6c7
disabled them for the "Adjust Last Operation" panel, but not for this
redo popup. In fact there was other code to disable undo for these
buttons, but 2d2f23de10 put this into a wrongly scoped conditional
branch, so it was only executed on the first full redraw.

We can revert 179169d6c7 too now (confirmed already), but I'll do that
separately and not in the release branch.

Confirmed that the following related issues are all (still) fixed with
this:
- #55348
- #134505
- #135655

Pull Request: https://projects.blender.org/blender/blender/pulls/135730
2025-03-10 12:43:43 +01:00
Omar Emara
c14706e5c9 Fix #135647: Compositor viewer doesn't update on render
Since the introduction of e53ac805af, viewer and previews were not
computed when rendering, because we assumed those would only be useful
during interactive compositing. But we received multiple reports that
this is broken. So users generally expect rendering to compute viewers
and previews.

This patch makes a distinction between background rendering and F12
renders, where the latter computes viewer and previews. This should not
have significant effect on the render time, because typically viewer
results are already computed as part of computing composite results.

Pull Request: https://projects.blender.org/blender/blender/pulls/135723
2025-03-10 12:31:00 +01:00
Campbell Barton
0f13ef0bee Fix potential memory allocation mismatch from struct naming collision
Use anonymous namespace to prevent naming collision allocating
structs of the same name.

Should resolve #134419 although I was unable to redo this bug.

Ref !135726
2025-03-10 22:14:17 +11:00
Philipp Oeser
b0ada86be4 Fix #135710: Grease Pencil: Envelope modifier crash on material influence
Code was reading uninitialized data.

Therefor, initialize two arrays to 0 (since values would only be set for
stuff in curves_mask)

Pull Request: https://projects.blender.org/blender/blender/pulls/135718
2025-03-10 12:03:12 +01:00
Lukas Tönne
6d75a43895 Fix #135689: Grease Pencil: Interpolation crash with single-point curves
In the case of interpolating from a single-point curve to a larger curve
the interpolation tool did not fill the destination indices and factors
arrays, because the "segments" count is zero.

Handle this as a special case to avoid breaking assumptions in the rest
of the sampling code.

Pull Request: https://projects.blender.org/blender/blender/pulls/135720
2025-03-10 11:07:55 +01:00
Pratik Borhade
042f8a1dc1 Fix #135606: Grease Pencil: Gesture selection not deselcting when clicking in empty space
Points are actually deselected, but the viewport is not updated.
Set `changed` variable to `true` to send update calls.

Pull Request: https://projects.blender.org/blender/blender/pulls/135708
2025-03-10 11:06:21 +01:00
Falk David
785c9c9720 Fix #135273: Grease Pencil: Crash when disabling mutliframe editing
The issue was that the multiframe editing toggle is a tool setting and not
stored in the object data anymore (which was changed in 4.3 so that users
don't have to toggle it in every object).

The batch caches of all Grease Pencils will include the multiframes even
when they are not active.
This leads to the issue that inactive objects don't rebuild their batch cache
when the setting is toggled and we access memory that is out of bounds.

To fix this (for now), toggling the multiframe setting tags all the Grease Pencil
IDs for an update. Obviously this is less than ideal, but the safest option as
of right now.

In the future, we should create a batch cache for each frame.
Then the render engine can request each frame when it's needed,
and we no longer need to tag all the objects for an update when
the setting changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/135636
2025-03-10 11:03:36 +01:00
YimingWu
df942ecaca Fix #135607: Grease Pencil: Auto keying not working when using trim tool
Auto key support was missing. This PR implmented this feature
back so it's consistent with what we have in Blender 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/135609
2025-03-10 10:53:01 +01:00
Jeroen Bakker
eceb81b21f GPU: Remove RDNA2 shader viewport workaround
It has been confirmed that the latest release of AMD drivers has fixed
issues for both OpenGL and Vulkan. Users should use AMD driver 25.3.1
or later. Removing the workaround as it has performance penalties on
RDNA2 based GPUs.

Reference: #135516
Pull Request: https://projects.blender.org/blender/blender/pulls/135630
2025-03-10 07:22:02 +01:00
Campbell Barton
c1d92cb014 Cleanup: quiet unused variable warning 2025-03-10 17:18:30 +11:00
YimingWu
e781bd7e11 Fix #135439: Grease Pencil: Prevent deleting groups with animated visibility
Previously in 6f80d722c6 there was a fix for
not removing layers from evaluated data when their visibility is animated,
however it overlooked that the same thing could happen to layer groups.
This fix basically duplicated the same check for layer groups.

Pull Request: https://projects.blender.org/blender/blender/pulls/135450
2025-03-10 04:29:15 +01:00
Germano Cavalcante
bd9dce74c0 Fix #135564: 'Cycle edges' on the Knife tool not working
Due to recent code changes, `knife_calculate_snap_ref_edges` relied on
the (not yet computed) `kcd->curr.mval` to compute the raycast ray.

The solution is to pass the computed ray right before.

Also `knife_snap_update_from_mval` is now called on the modal to update
the edge as soon as the button is pressed.

Pull Request: https://projects.blender.org/blender/blender/pulls/135649
2025-03-08 14:16:34 +01:00
Hans Goudey
3f87120ccf Fix #135633: Freeze/crash using a specific Geometry Node group as modifier
`interface_input_index` was called for an output socket. Also filter out inputs
that aren't exposed in the modifier, similar to a few lines above.

Pull Request: https://projects.blender.org/blender/blender/pulls/135641
2025-03-07 18:46:53 +01:00
Campbell Barton
967fb3ae4c Fix: Grease Pencil: Crash running operators that require a 3D viewport
Correct the poll functions for reproject & texture gradient.

Pull Request: https://projects.blender.org/blender/blender/pulls/135618
2025-03-07 18:13:20 +01:00
Philipp Oeser
a568890515 Fix #135601: prop_tabs_enum No Longer Displays Text of Enum
Caused by 21aef81714

Now, pass along `uiname` as `std::optional<StringRef>` early on (and use
`std::nullopt`).

Without this, the `(!uiname || !uiname->is_empty())` condition in
`ui_item_enum_expand_elem_exec` wont be true, resulting in the empty
label.

Pull Request: https://projects.blender.org/blender/blender/pulls/135621
2025-03-07 17:53:54 +01:00
Philipp Oeser
62fcd012cf Fix #135582: Crash box selecting in sequence editor without a sequence
Caused by f98b01e492

The issue of uninitialized `Editing` (in new scenes) has come up before,
see e.g. https://projects.blender.org/blender/blender/issues/
118633#issuecomment-1134447

So it is not uncommon to guard against `Editing` being null, same is now
done here

Pull Request: https://projects.blender.org/blender/blender/pulls/135623
2025-03-07 17:53:43 +01:00
Philipp Oeser
8beb695b7f Fix #135625: Grease Pencil: Unavailable Masks operators not grayed out
To resolve, add proper poll functions checking the needed amount of
masks.

Pull Request: https://projects.blender.org/blender/blender/pulls/135629
2025-03-07 17:53:30 +01:00
Falk David
a904d3a1b2 Fix #135539: Grease Pencil: Depth placement not working in rendered mode
The issue was happening because the `is_render_depth_available`
state flag was false leading to the depths being cleared.

When we use `is_depth_only_drawing`, we expect
that the depth is valid because the Grease Pencil
engine will write them.

Pull Request: https://projects.blender.org/blender/blender/pulls/135619
2025-03-07 16:17:15 +01:00
YimingWu
308e81fd8a Fix #135438: Prevent vertex group name collision when renaming bones.
When renaming bones, vertex groups that has the same name as the old
name of the bone will be renamed to the new name, but this may cause
name collision in the vertex group list. When this happens, we should
not change the vertex group's name. Now a warning message will show.

Pull Request: https://projects.blender.org/blender/blender/pulls/135492
2025-03-07 12:52:09 +01:00
YimingWu
8ebeafa6b9 Fix #135586: Grease Pencil: Crash in length modifier extending curves
Previously in 43fde8c39c the point span
for calling `extend_curves_straight` was set to a fixed `{1}` with only
1 element, this causes index access to go out of range, which is the
cause of crash #135586. However there are some other issues within the
code path, mainly:

- The meaning of `start/end_points` are unclear
- Behaviour of extending a 2-point stroke is undefined

This PR clarifies these by adding some comments and change a bit of the
logic in the code so it's more understandable.

Pull Request: https://projects.blender.org/blender/blender/pulls/135608
2025-03-07 11:24:21 +01:00
Sybren A. Stüvel
b71fed904b Cleanup: Remove F-Curve handling from undo in Curve edit mode
This commit removes the F-Curve handling from the legacy Curve edit mode
undo code.

The legacy Curve edit mode uses the per-mode undo system. This tried to
deal with changes in the animation data as well, but did so in a very
limited way. Only F-Curves were copied & restored, which means the
Action Groups were effectively deleted as soon as you undo something.
Furthermore, the code wasn't updated for slotted Actions yet, so
effectively it was a no-op, because it only saw the always-empty legacy
`Action::curves` field.

Fixing this properly would mean discarding this undo code, and moving to
the global undo system, as the animation editors allow changing the
animation of anything in the scene, not just the Curve data-block that
is being edited. Since the legacy curve ID type is, well, legacy, I
don't think it's worth going this route.

This is a non-functional change, as `action->curves` is always empty,
and so nothing was backed up or restored anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/135585
2025-03-07 10:40:16 +01:00
Campbell Barton
5849d9aec3 Fix crash using transform with grease pencil without an "area" 2025-03-07 20:11:51 +11:00
Philipp Oeser
084cb40e98 Fix #108722 : Measures not cleared when removing annotation layer
Removing the layer would leave the ruler gizmos on screen, only way to
update was changing to another tool and back. Now remove all
corresponding gizmo ruler items found (also in different windows/scenes)
when removing the ruler annotation layer.

Also add a proper notifier that grease pencil was edited (this way we
also get immediate update when a ruler annotation layer was added --
which was also missing).

Pull Request: https://projects.blender.org/blender/blender/pulls/135571
2025-03-07 09:52:01 +01:00
Philipp Oeser
d18fe0c575 Fix #135523: Calculate Motion Paths ignores Selected Keys option
Since the switch to slotted actions, we cannot solely rely on the
Listbase of `curves` (this is for legacy actions only), but need to
consider Channelbag for new slotted actions. There is
`assigned_action_has_keyframes` that handles both of these
and would also early out if we have no keyframes to process,
so use it.

Pull Request: https://projects.blender.org/blender/blender/pulls/135566
2025-03-07 08:35:17 +01:00
Philipp Oeser
cf95ff1a6e Fix #129782: ActionSlot channels in Action Editor mode lack background
This was introduced in 1d2cea1e3e

It was not using any `draw_backdrop` callback though, which is now
added.

Main point of discussion is probably if we want to use `Dope Sheet
Channel` theming (which is only used for `Object` and `Scene` channels
atm., also referred to as "root" in code) or the `Dope Sheet Sub-
channel` theming (which is now used for all kinds things - object data,
but also actions..., also referred to as "dataexpand" in code)

Given the similarity to actions, one might lean towards "Sub", but otoh
that channel occupies a "root" channel in the action editor mode. If I
understand correctly, an `ActionSlot` is also mostly used to "separate"
different objects in the same action, so that then makes an ActionSlot
actually more similar to how the "root" channel is used for `Object` and
`Scene` in dopesheet mode.

This is why this PR makes an `ActionSlot` use the "root" theming.

NOTE: we also might want to revisit the naming in code (suggestion would
be TH_DOPESHEET_CHANNELOB > TH_DOPESHEET_CHANNELROOT,
TH_DOPESHEET_CHANNELSUBOB >TH_DOPESHEET_CHANNELSUBOB), but that is for
another time...

Pull Request: https://projects.blender.org/blender/blender/pulls/135506
2025-03-07 08:35:02 +01:00
Campbell Barton
f6d730d6e6 Fix "Image from View" ignored filepath property
Assign the filepath from the operator to the generated image.
2025-03-07 15:49:39 +11:00
Campbell Barton
f7ba05991f Fix uninitialized return value from constraint operators
The utility function edit_constraint_invoke_properties could return
false without setting the return value, causing the operators invoke
function to return an uninitialized flag.
2025-03-07 15:16:51 +11:00
Campbell Barton
f9c1475020 Fix crash adding a view layer without an active window
Resolve regression in [0].

This is most likely to occur when called from Python.

[0]: d1972e50cb
2025-03-07 15:15:15 +11:00
Jesse Yurkovich
0a16ba9911 Fix #135502: Handle Alembic attribute size mismatch when reading points
The Alembic file in the issue had 0 points, and 4 widths, defined for
frame 33 which is certainly incorrect from whichever software produced
said file. However, our import code should have proper guards in place
to more gracefully handle the situation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135548
2025-03-06 20:54:53 +01:00
Jesse Yurkovich
3a0e4fe316 Fix #134039: Alembic procedural proxy mesh should be owned by GeometrySet
When using Alembic procedurals, the Mesh Sequence Cache attempts to
replace the original geometry with a plain old cube. However, it never
frees this new cube geometry. Transfer ownership to the underlying
GeometrySet instead.

Investigating the scenario also showed that the `~AlembicProcedural`
dtor was removing an item from the `nodes` vector while iterating over
it, which triggers debug asserts on at least MSVC. I believe the removal
is unnecessary since this is the dtor and ASAN appears clean now.

Pull Request: https://projects.blender.org/blender/blender/pulls/134085
2025-03-06 20:53:52 +01:00
Julian Eisel
b9907cb60b Fix #134418: Double clicking a file crashes Blender if load UI is off
Screen initialization is more context dependent than it used to be
because of region polling, so the context needs to be set up correctly.
Here was a case where the initialized window/screen passed to polling
didn't match what's in context (UI context was unset in fact).

Some asserts could be added to ensure data passed to screen
initialization matches context, but can do that separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/135568
2025-03-06 19:01:10 +01:00
Clément Foucault
b4a1a140d7 Fix #134509: GPU: Node editor links are invisible on Intel GPU
This bug also affects integrated GPU as well.
Remove the GPU familly check.
2025-03-06 18:48:56 +01:00
Hans Goudey
4fd96e61d5 Fix: Missing cache invalidation in grease pencil transform operator 2025-03-06 12:40:46 -05:00
Falk David
5f464b2de0 Fix #135235: Grease Pencil: Crash when removing layers in python API
When iterating over the layers in a Grease Pencil object,
removing the layers can lead to crashes.

This PR is a better alternative to !135253.

Instead of checking if the layer is valid, simply fetch the latest layer
cache for each iteration and check if the index is valid.

This means that we will skip over layers if they get removed during
iteration, but we no longer can crash. If users want to remove multiple
layers at once, it's better to do this in two passes. E.g. by first
collecting the names of the layers to remove, iterating over
these names and then removing the layers by getting it by its name.

Pull Request: https://projects.blender.org/blender/blender/pulls/135574
2025-03-06 16:30:35 +01:00
YimingWu
e0f5ce46b7 Fix #134599: Grease Pencil: Connect edges when converting from mesh
The Mesh to Grease Pencil conversion would convert every edge into a stroke.
This was not the case prior to Blender 4.3. Edges with no branches would be
converted into a single stroke instead of mutliple ones.

This fix uses `geometry::mesh_to_curve_convert` from geometry nodes to
achieve more optimal result with edges connected into one stroke when
possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/135557
2025-03-06 16:29:14 +01:00
Jeroen Bakker
37d781aa2a Fix #135516: Vulkan: Shader output viewport broken on RDNA2
When using the official RDNA2 driver +vulkan we see the same issue we
as #123787. Adding the same workaround to vulkan as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/135565
2025-03-06 16:28:47 +01:00
Christoph Lendenfeld
b834ca4fb1 Fix: Custom Properties named identical to existing properties fails to key
When inserting keys in the viewport by pressing `I`,
certain custom properties would not get keyed if their name
was identical to existing properties (for example `scale`).

That was because we use the name of the property to resolve
an rna path and check if the path resolved. This was of course
true in the described case and the square brackets would never be added.
The solution is to check for `RNA_property_is_runtime` which is false
for properties defined inside Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/135304
2025-03-06 15:52:29 +01:00
Sybren A. Stüvel
16d819caa9 Fix: Reorder versioning of legacy Grease Pencil and Actions
The versioning of legacy-to-modern Grease Pencil is using slotted
Actions (because that's the current animation API), and therefore
assumes that the Action & Slot assignments have been versioned as well.
The latter now actually happens before the former, so that assumption is
now actually valid.

Pull Request: https://projects.blender.org/blender/blender/pulls/135466
2025-03-06 14:12:17 +01:00
Jacques Lucke
e726357962 Fix: Geometry Nodes: bad attribute propagation with multiple group outputs and warning node
The issue was that sometimes the group inputs of a node group were shuffled
around unexpectedly and thus inputs were passed to the wrong sockets.

The `or_socket_usages` function sorts the given span so that the key is more
likely to be reused, reducing the number of nodes inserted in the graph.  The
issue was that `build_warning_node` passes `group_output_used_sockets_` into the
function the order of which is important. It thus should not be reordered.

The fix is to just never reorder the span passed to `or_socket_usages` but to
make a local copy instead which can be sorted without problems. Often this copy
is done already anyway when the span is inserted into
`graph_params.socket_usages_combination_cache` as `Vector`.

This fix also makes an assumption about `Map.lookup_or_add_cb` which was not
documented before. Namely it assumes that the key is moved into the map only
after the callback has been called. This behavior is now documented and there is
a unit test for it.

Pull Request: https://projects.blender.org/blender/blender/pulls/135528
2025-03-06 09:47:44 +01:00
Campbell Barton
093178342d Fix crashes running Pose Slide operators without a 3D view or area
Only some of the operator logic checked for a valid area
which was assumed to be a 3D viewport which isn't necessarily the case.
2025-03-06 16:33:29 +11:00
Campbell Barton
fa6975b440 Fix crash calling "Set Active Modifier" without an active object 2025-03-06 15:47:16 +11:00
Campbell Barton
64ec0b3589 Fix assert in vertex weight smooth with mirror enabled
Vertex weight smooth was running on meshes without any vertex groups
the operation to apply the weights to mirrored vertices was asserting
in this case.

Resolve by only operating on meshes with vertex groups,
also add a warning when no objects were changed.
2025-03-06 13:37:38 +11:00
Campbell Barton
f6f53551ff Fix invalid tessellation after vertex smooth with mirror enabled
Smoothing vertices with symmetry wasn't recalculating normals
before re-tessellating, meaning the faces would use an incorrect
2D projection for tessellation.

The error was exposed by an assert.
2025-03-06 12:48:39 +11:00