Commit Graph

117331 Commits

Author SHA1 Message Date
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
Harley Acheson
8d77e842e9 Fix #135097: BLF Control Characters in When Wrapping
With 4da5377e17 control characters are shown as space characters. But
word wrapping code will use the codepoint from the glyph if available,
which means a soft wrap on space instead of a hard wrap on line feed.
Just oversight, no need to use the glyph for that. In fact we always
want to deal with the character, not the visual representation of it.

Pull Request: https://projects.blender.org/blender/blender/pulls/135541
2025-03-06 01:38:59 +01:00
Campbell Barton
b85fc32cae Cleanup: spelling & repeated words in comments
Address warnings from check_spelling.py
2025-03-06 10:33:21 +11:00
Campbell Barton
2d705f90c2 PyAPI: disable assertion when building Blender as a Python module
When adding the assert I thought this wasn't happening on Linux
(since I'm unable to redo it locally).
However the builtbot hits this assert on Linux, causing tests to fail.

Resolves #135195
2025-03-06 10:17:37 +11:00
Hans Goudey
312516d53e Fix #135517: Geometry nodes convex hull imprecision
The equivalent operation in edit mode reused existing vertices
rather than taking the new positions from the convex hull output.
This commit implements the same behavior for the geometry node.

Pull Request: https://projects.blender.org/blender/blender/pulls/135536
2025-03-05 21:18:45 +01:00
Jesse Yurkovich
2d915869f7 Fix #135441: integer overflow with large displacement modifier image
The offset calculation would overflow inside `ibuf_get_color` given the
incoming arguments and image size.

Another similar problem, found from quick inspection, would occur inside
`ibuf_get_color_clip` as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/135476
2025-03-05 20:48:47 +01:00
Hans Goudey
23a97dd965 Fix #135520: Mesh edit mode "Frame Selected" crash in some cases
Caused by 839108f623.
Now, when there is no mapping available between the evaluated
mesh and the original, the evaluated mesh won't have the edit mesh
pointer set. Since this code really just cares about the original BMesh,
just retrieve it with the original object. This function expects an
evaluated object since `BKE_object_get_editmesh_eval_cage`
asserts for that laer on.
2025-03-05 14:36:28 -05:00
Harley Acheson
de3b5e691e Fix #135119: Always Clear Previous Area Subtype After Change
Area's butspacetype_subtype always needs to be cleared after switching
space and subtype, whether the space supports subtypes or not.
Otherwise an operation that only changes type (so assumed subtype of
zero) will use the area's previous subtype if it has subtypes. This is
restoring prior undocumented behavior, now with a nice comment.

Pull Request: https://projects.blender.org/blender/blender/pulls/135533
2025-03-05 20:11:00 +01:00
Miguel Pozo
6c697a48f4 Fix #135325: Overlay-Next: Replicate the old face x-ray behavior
Replicate the Overlay-Legacy behavior for selected face overlays in
X-Ray mode:

Use depth testing for `edit_mesh_faces_ps_` when X-Ray is fully opaque.

X-Ray is always considered fully opaque in Preview/Render mode since
X-Ray transparency is not supported.

Pull Request: https://projects.blender.org/blender/blender/pulls/135524
2025-03-05 16:42:59 +01:00
Clément Foucault
580c02c053 Fix #135497: Auto-Depth Operation are affecterd by Retopology offset
Setting the offset to 0 for these cases fixes the issue.
We still want to draw the edit face in this case to a be able
to zoom on the retopo surface. We just don't want the offset.

Pull Request: https://projects.blender.org/blender/blender/pulls/135511
2025-03-05 15:08:12 +01:00
Jonas Holzman
32f8863b0c Fix #134260: Color Picker components partially resetting when pressing Backspace
Previously, when pressing the Backspace key inside an open color picker,
the HSV and Hex field components would not refresh. Only the RGB
components would.

Fixed by calling the attached button function callbacks which propagates
the color changes to the other color picker buttons from the RGB values.

Pull Request: https://projects.blender.org/blender/blender/pulls/135131
2025-03-05 12:41:32 +01:00
Campbell Barton
f54eeaf2aa Fix #135490: Incorrect allocation size with MEM_new (naming collisions)
Resolve naming collisions for structs which could cause the wrong size
to be used allocating the `LaplacianSystem` when calculating mesh
weights from an armature.

Ref !135491
2025-03-05 22:26:55 +11:00
Falk David
a4ac52d0d0 Fix #135312: Grease Pencil: Crash when drawing while animation is playing
While we can avoid this crash by enforcing that the animation can't
play while drawing, this PR fixes the problem by remembering the
drawing that the operation was started on.

This seems like the right thing to do in general because there might be
other ways that the frame can be changed.

From my tests this seems to work even in cases where we use multi
frame editing.

Pull Request: https://projects.blender.org/blender/blender/pulls/135451
2025-03-05 12:21:28 +01:00
Sybren A. Stüvel
aada31c041 Anim: Fix issue where F-Curves were half-initialized when importing USD
Fix an issue where imported F-Curves were allocated but not zeroed out,
when importing skeletal animation from USD.

When growing the F-Curve array, `BKE_fcurve_bezt_resize()` will now zero
out new array elements, instead of leaving the initialisation to the
caller. There are many fields in `BezTriple`, and the caller is likely
to only set those that can be imported (like the keyframe coordinates &
handles).

This fixes an issue introduced in 857743db9d.

Pull Request: https://projects.blender.org/blender/blender/pulls/135448
2025-03-05 12:20:40 +01:00
Sybren A. Stüvel
a03077c22d UI: show '+ New' button in Action Slot selector when no slot is selected
In any Action Slot selector, when there is no slot selected yet, replace
the 'Duplicate' and 'Unassign' buttons with a large 'New' button. This
is consistent with the ID selector, which does the same thing.

Care is taken to ensure this is only applied to the use case of
selecting Action Slots, in order to minimize the UI changes in Blender
4.4.

The only other use case of `template_search()` that I could find, is the
View Layer selector in the top-right corner of the window. However, even
without the "_is this an Action Slot selector_" guard, it would not show
these changes, as Blender guarantees there is always a view layer
assigned. Add-ons may still use `template_search()` in other ways,
though, so it's still good to keep this guard in place.

Pull Request: https://projects.blender.org/blender/blender/pulls/135443
2025-03-05 12:20:11 +01:00
Clément Foucault
326ce59961 Fix #134509: GPU: Add workaround for Intel ARC nodelink driver bug
This disables the instancing optimization for this specific
hardware.

Pull Request: https://projects.blender.org/blender/blender/pulls/135458
2025-03-05 12:05:34 +01:00
Lukas Tönne
70473d7589 Fix: Grease Pencil forward declaration of RandomNumberGenerator.
This is a class, was forward-declared as struct.
2025-03-05 12:02:58 +01:00
Hans Goudey
b8d547ab1a Fix #134876: Wireframe overlay incorrectly skips some edit mode objects
The detection of when the wireframe is drawn by the edit mode overlays
instead was incorrect and didn't handle recent changes to avoid drawing
edit mode overlay data for invalid evaluated/original edit mesh mappings.
See code comments for more detail.

Pull Request: https://projects.blender.org/blender/blender/pulls/135402
2025-03-05 11:18:26 +01:00
Lukas Tönne
dc3a652d5b Fix #134606: Grease Pencil: Randomization of attributes in primitive tools
Primitive tools were not using the brush randomization options.

This moves the randomization functions into the editor utilities for Grease Pencil
and enables primitive curve generation to use them.

Pull Request: https://projects.blender.org/blender/blender/pulls/135454
2025-03-05 08:49:27 +01:00
YimingWu
8b8b0837a0 Fix #135002: Sculpt/Paint: Grease Pencil stabilization toggling during a stroke
Prior to 4.3, it is possible to toggle Stabilize Stroke during a Grease
Pencil stroke with shift key, however this is broken by brush system
changes. Now this behaviour is re-implemented.

Note: Shift-toggling of Stabilize Stroke is only for Grease Pencil for
now, as mesh sculpt mode will use shift key for smooth brush instead of
pointer smoothing.

Pull Request: https://projects.blender.org/blender/blender/pulls/135024
2025-03-05 07:14:13 +01:00
Campbell Barton
b889cc66ca Unbreak building with CLANG & WITH_GMP=OFF 2025-03-05 13:18:29 +11:00
Harley Acheson
4da5377e17 Fix #135421: BLF Show Most Control Characters as Space
Prior versions of Blender showed control characters as spaces, but
since we recently made fallback optional they are no longer visible.
This is because with fallback we are guaranteed to return a glyph, but
without fallback the current font will not have entries for these. This
PR just shows them as spaces, just like before. But does not do so for
carriage return and line feed.

Pull Request: https://projects.blender.org/blender/blender/pulls/135484
2025-03-05 01:09:53 +01:00
Philipp Oeser
f3161149db Fix #135370: Crash when baking textures with a modified UV map
The report was storing a non-2D-Vector attribute with geometry nodes
over a valid UVMap, resulting in the evaluated mesh not having a valid
`CD_PROP_FLOAT2` layer anymore. There is already a check to early out
for the original mesh in case it has no UVs, but as mentioned, not for
the **evaluated** (cage/multi-no-res) mesh which is actually/rightfully
used to get the UVs.

To resolve, check again if we have UVs right after getting he mesh that
is actually used.
(we might even want to remove the first check, seems redundant now -
even though it would early out a bit sooner...)

Pull Request: https://projects.blender.org/blender/blender/pulls/135388
2025-03-04 18:24:39 +01:00
Harley Acheson
84123446e3 Fix #135324: Data-block selector icon drawn too big
DPI scaling was applied twice. Added an API comment to make this more
clear for the caller of the function. This is exactly the changes to
main committed in 47bbf3fcae, which is a
correction to 1f88645728.

Pull Request: https://projects.blender.org/blender/blender/pulls/135411
2025-03-04 18:11:00 +01:00
Julian Eisel
7e99e575a4 Fix: Fix most cases of asset browser preview flickering on undo/redo
Mitigates #93726.

With this asset previews will no longer flicker in the asset browser
on actions like undo, redo or when using "Adjust Last Operation" if
the asset library doesn't contain assets from the current file.

Previews of assets from the current file would have to be cleared on
undo & redo, because their memory location can change then. However the
file browser's data model didn't allow clearing just these previews, so
previews from external assets would have to be reloaded from disk too,
causing the flickering.

Noticed we can trivially skip clearing of previews if there are no
assets from the current file anyway. This mitigates the issue quite a
bit until preview handling is rewritten, see #122439.
2025-03-04 18:04:28 +01:00
Hans Goudey
ebb916aa1e Fix: Missing label for unassigned node tools menu
The label was visually missing in menu search.

Pull Request: https://projects.blender.org/blender/blender/pulls/135461
2025-03-04 17:35:54 +01:00
Julian Eisel
d0f5f3bd58 Fix #131307: Assert when creating a new brush asset
Adding a new asset will tag asset browsers to clear and reload the
assets from the current file. Since a859ed1130, such changes will also
clear all asset browsers showing the affected asset libraries. So the
clearing of current file assets would happen on an already cleared
asset/file list. This case wasn't considered before, so it would lead to
a failed but harmless assert. Handle this case properly.
2025-03-04 17:21:39 +01:00
Julian Eisel
9122f18393 Fix #135186: Asset browser empty after saving pose asset
Since a859ed1130, changes like adding an asset will cause all visible
asset browsers showing the affected asset library to be cleared. This
should cause the asset browser to trigger a re-load of the asset
libraries, but a logic error made only assets from the current file be
loaded instead of the full library.
2025-03-04 17:18:29 +01:00
Sybren A. Stüvel
f980f80dd4 Cleanup: add explanatory comment about action slot auto-assignment
Add more explanation to the current action slot auto-assignment logic.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/135445
2025-03-04 16:40:25 +01:00