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
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
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
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.
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
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
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
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
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
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
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
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
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.
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.
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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.
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.