Commit Graph

44530 Commits

Author SHA1 Message Date
Hans Goudey
cec874fed2 Fix: Add missing translation for UI text 2024-12-05 21:31:26 -05:00
Hans Goudey
f7089519e0 Cleanup: Remove unused UI function declaration 2024-12-05 21:31:25 -05:00
Harley Acheson
7c3db55b29 Refactor: Simplify Block Re-centering
PR #129125 allowed the movement of centered dialogs, like About and
Splash, without them snapping back to their original positions. But
that change was more complex than necessary. This returns
interface_region_popup.cc to exactly as it was before any of this, and
interface.cc gets simpler too. In a nutshell recentering these dialogs
is a lot easier that seemed at first.

Pull Request: https://projects.blender.org/blender/blender/pulls/131464
2024-12-06 00:57:32 +01:00
Sean Kim
9b9da3e5af Fix: Mesh Filter undo panel not undoing previous change
The `exec` callback was missing a call to `undo::push_end`, meaning that
using the undo panel would not undo the prior step, causing an
accumulative effect.

Pull Request: https://projects.blender.org/blender/blender/pulls/131466
2024-12-06 00:45:21 +01:00
Sean Kim
8d9bf47ba6 Sculpt: Prevent entering mode when object is invisible
This is already prevented in the UI in both the top left mode selector
and the pie menu, this commit adds an actual check to avoid being put
into an invalid state by another operator or script.

Pull Request: https://projects.blender.org/blender/blender/pulls/130769
2024-12-05 22:48:20 +01:00
Aras Pranckevicius
48c1157a41 Cleanup: compiler warning fix
size_t argument is %zu, not %zi
2024-12-05 20:31:15 +02:00
Falk David
949a7e6a60 Fix: Grease Pencil: Separate by Selection issues
Issues with the "Separate by selection" operator. Reported by the Blender studio.
There were multiple problems in this code.
1. When a new object is created, the parameters are not copied.
2. When a new layer in a new object is created, the parameters are not
   copied.
3. The code to transfer the layer attributes was not working correctly.

Fixed all the issues above. The layer attributes are now transfered once
after all layers have been added.

Pull Request: https://projects.blender.org/blender/blender/pulls/131449
2024-12-05 18:18:50 +01:00
Jacques Lucke
b36bf15e28 Geometry Nodes: improve detecting data-block dependencies
Previously, the data-block dependencies were always detected in
`update_depsgraph` in `MOD_nodes.cc`. This would only be called when something
called `DEG_relations_tag_update` before. We don't want to trigger a depsgraph
rebuild after each operation in the node editor, as that would be expensive.
However, that also meant that we often had to add data-block dependencies that
are not actually used, but might be used if the user changed e.g. a link. A
typical example for that is a object socket that has a default value, but the
socket is also linked.

Now, the dependencies referenced by the node tree are collected by the node tree
update code which runs after all changes. This way we can detect whether the
dependencies have changed. Only if they have changed, a depsgraph rebuild is
triggered. This now allows also taking into account the mute status of nodes and
whether an input is linked.

There are still more things that could be taken into account. Most obviously
whether a node is connected to an output. This can be done later. The most
tricky aspect here is probably that we also have to consider all viewer nodes as
output, because at the time the node runs, it's not known which viewer will
actually be used (which depends on other editors).

This also cleans up some special cases we had for e.g. the scene time node where
we always had to trigger a depsgraph rebuild when it was added/removed because
of its time dependence. This is now part of a more general system.

This fixes #109219.

Pull Request: https://projects.blender.org/blender/blender/pulls/131446
2024-12-05 18:02:14 +01:00
Christoph Lendenfeld
0ce1aa9ecd Fix #131198: Add missing redraw for ND_KEYFRAME_PROP
Tag Properties editor for redraw when it gets notification of
NC_ANIMATION | ND_KEYFRAME_PROP.

Pull Request: https://projects.blender.org/blender/blender/pulls/131440
2024-12-05 17:24:17 +01:00
Jacques Lucke
54111b4f08 Fix: Geometry Nodes: missing update tag after data-block drag&drop 2024-12-05 16:40:11 +01:00
Aras Pranckevicius
4343796050 Fix #78046: When adding content with too long file names to VSE, show error instead of silently not working
VSE can support file basenames of only up to 256 characters length (due
to limited capacity of StripElem::filename). When adding e.g. a movie
that has a longer file basename, it was silently truncating it. The
strip was added, it was just not actually working due to truncated
file basename. Instead of that, log actual error and fail the addition
operator.

The issue repro with "not working" file has basename of 351 length
(due to lots of "invisible zero width space" characters).

Pull Request: https://projects.blender.org/blender/blender/pulls/131417
2024-12-05 16:38:59 +01:00
YimingWu
9e72f28823 Fix: Grease Pencil: Show menu when invoking Move to Layer operator
The Move to Layer operator in grease pencil edit mode when invoked from
operator search directly will not show menu correctly, instead it tries
to execute directly without a target layer name set. This fix ensures
that when it happens the UI would show a menu instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/131437
2024-12-05 15:42:51 +01:00
Sybren A. Stüvel
81beebe4b8 Fix #131299: Grease Pencil: Moving keyframes doesn't update viewport
Grease Pencil animation data is stored in the object-data, not the
`AnimData` of the Grease Pencil ID. This meant that the object was
not properly tagged for an update, because the code assumed that
the object had an `adt`.

The fix calls `ANIM_id_update` to directly tag the Grease Pencil
ID for an update (which will also update the Grease Pencil frames
animation data).
2024-12-05 15:00:03 +01:00
Jacques Lucke
3bd79aaa78 Fix #121577: blank space in Group Output node properties 2024-12-05 13:11:22 +01:00
Christoph Lendenfeld
6d4cd2dc96 Fix #130061: Pose Sliding with no bones selected resets overlay flags
The issue was that the struct `tPoseSlideOp` tracks the
viewport overlay flags so they can be restored after the operator has run.
But the flag was stored at the end of `pose_slide_invoke_common` which
exits early if no keys are selected.
This then calls `pose_slide_exit` which sets the viewport flags to 0, because they were
never stored in the first place.

The fix is to move the storing of the flag up to `pose_slide_init` to ensure that it
is captured as soon as the struct is allocated.

Pull Request: https://projects.blender.org/blender/blender/pulls/131327
2024-12-05 12:47:04 +01:00
Christoph Lendenfeld
2536ddac0d Fix #123875: FCurve noise modifier producing values out of range
This patch adds an option to use the new perlin noise as a noise function for the FCurve modifier.
That fixes the issue of the old noise function which could produce values outside the -0.5/0.5 range (For a strength of 1).

The old way is still preserved and will be automatically used for old files.
Because of the different noise function, I've added two more parameters to the noise modifier.
The default values for those parameters are chosen to be as close to the original noise modifier as possible.
However the match is not 1:1

## Depth
With the new noise, the parameters for "Lacunarity" and "Roughness" are available to the user.
By default they are set in such a way that changing the "Depth" results in a similar noise pattern.

## Offset and Scale
The offset and scale parameters now behave differently. Before they would also shift the phase in some way, now all they do is shift or scale the noise.

## Amplitude

The biggest difference is in the amplitude of the noise.

Overall the amplitude is a lot smaller in general than with the legacy noise, but it does fix the issue of the amplitude reaching outside the -0.5/0.5 range.
By shifting the phase I was able to find points where the amplitude reaches 0.5 but never above that.

Pull Request: https://projects.blender.org/blender/blender/pulls/129535
2024-12-05 10:48:27 +01:00
Philipp Oeser
8044f531c7 Fix #131107: Grease Pencil: Crash doing Grease Pencil Surface Reproject
Implemented in 4291ab855c
Fixed in c20399442d (even though that commit introduced the crash)

The crash happens because we are dealing with multiple
`DrawingPlacement` (using the constructor from c20399442d which allows
for passing in cached depths) in **threads**. The depth_cache gets freed
in the destructor of  `DrawingPlacement` though, thus ruining the data
for a `DrawingPlacement` in another thread.

To resolve, pass in a copy of the depths.

Pull Request: https://projects.blender.org/blender/blender/pulls/131356
2024-12-05 10:35:24 +01:00
Lukas Tönne
03f2f1b5b3 Fix #130271: Flip the color threshold interpretation to match Blender 4.2
The color threshold in Blender 4.2 is interpreted to mean that colors above the
threshold are "background" and colors below threshold are "foreground".
This is arbitrary but works well for black-on-white drawings.

Pull Request: https://projects.blender.org/blender/blender/pulls/131324
2024-12-05 10:32:46 +01:00
Hans Goudey
cb94b62775 Fix #95139: Right click on sockets opens menu with "Edit Source"
We create invisible buttons for socket tooltips because sockets themselves
aren't buttons and because we don't have a special tooltip handler for the
node editor. Currently those buttons have an empty right click menu with
just the "Edit Source" operator. Changing to label buttons removes the
right click menu but keeps tooltips working.

This didn't work earlier because label buttons didn't have tooltips.
That has been implemented in the meantime.

Pull Request: https://projects.blender.org/blender/blender/pulls/131399
2024-12-04 21:56:38 +01:00
Harley Acheson
3f91350d4e Fix #78371: Allow Deleting Items When Measure On Gizmos Off
When using the "Measure" Tool with Gizmos turned off, trying to delete
anything will result in an error message instead.  When Gizmos are on
then view3d_ruler_remove_invoke will return OPERATOR_PASS_THROUGH if
no rulers are selected. This way you can delete other objects. But if
Gizmos are off then it returns OPERATOR_CANCELLED which stops in its
tracks. Return OPERATOR_PASS_THROUGH in this case instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/131340
2024-12-04 19:57:56 +01:00
Clément Foucault
c255178cc5 Selection: Remove usage of Depth picking for viewport selection
The option is already disregarded by the new viewport
selection code.

This only remove the usage of the flag and assume it is
always off.

The UI and DNA clearing needs to be done in another commit.
2024-12-04 19:18:14 +01:00
Hans Goudey
22c13cfd28 Cleanup: Avoid reformatting geometry nodes property names, use fmt 2024-12-04 12:38:00 -05:00
Hans Goudey
af79b4e7b5 Cleanup: Use constexpr for geometry nodes string, avoid .c_str() 2024-12-04 12:38:00 -05:00
Hans Goudey
d260ba0cdb Cleanup: Use C++ random number generator 2024-12-04 11:29:28 -05:00
Julian Eisel
91069ea674 Refactor: UI: Simplify screen refresh logic
Avoid extra parameter to force refresh a screen, only use the screen refresh
tag. Having both leads to unnecessarily complicated logic.

Also document behavior in function comment and make function name more clear.
2024-12-04 17:05:18 +01:00
Clément Foucault
5e4bba76d1 Fix #131363: Curves ignore Surface Object Setting
Depth only drawing was not always enabling the overlay engine
(now responsible for depth prepass). And the depth prepass
was not populated if overlays were turned off.
2024-12-04 17:05:03 +01:00
Hans Goudey
4ded260cf3 UI: Allow setting active modifier on linked object
The poll function doesn't apply here because it just checks for object
editability and edit mode, object types, and modifier types. We shouldn't
have a poll function at all because the hovered modifier might not be
part of the context.

Resolves #90008.

Pull Request: https://projects.blender.org/blender/blender/pulls/131384
2024-12-04 16:43:13 +01:00
Julian Eisel
63d759d6d4 Fix: UI: Failing assert when switching workspaces
172e9c5b83 attempted to move area type and region type initialization to
`ED_screens_init()` so it's done before region polls run (which depends on
region types). However this was only done for active workspaces, so when
changing workspaces region types may still be missing before region polling.

We could iterate all screens there instead, not just those from the active
workspace. But in the end I decided it's better to move this back to regular
screen refreshing, but before region polling. This way all this related logic
stays closer together. It still only runs on complete screen refreshes, so when
the screen layout changes generally.
2024-12-04 16:32:35 +01:00
Hans Goudey
f9b627d29c Mesh: Move custom normals to a generic attribute
Move `CD_CUSTOMLOOPNORMAL` to the newly added
`CD_PROP_INT16_2D` generic attribute type. This is similar to
previous commits moving specific custom data types.

The attribute name is `custom_normal`. When the attribute with
that name is on the face corner domain, the code will interpret it
as stored in the existing deformation-invariant spherical coordinate
space.

The API remains the same, with the additional opportunity to edit
custom normal data as an attribute directly (which admittedly is fairly
unintuitive currently).

See #130484.

Pull Request: https://projects.blender.org/blender/blender/pulls/130689
2024-12-04 16:06:36 +01:00
Sergey Sharybin
76d6d169ba Fix #124518: Crash modifying material and marking it as an asset in quick succession
The preview generation job is not safe from cases when the underlying data is
changed outside of the job.

Ideally we'd solve possible threading conflict by making the job somehow
smarter. Until then kill the preview job manually, following similar pattern
from other places (for example, lib_id_generate_preview_exec).

Pull Request: https://projects.blender.org/blender/blender/pulls/131372
2024-12-04 14:56:41 +01:00
Hans Goudey
504ac41ae7 Cleanup: Remove math include from two headers 2024-12-04 08:52:37 -05:00
Laurynas Duburas
7cc5918ade Fix #131038: Bezier strokes affect pivot of other strokes
Makes sure to select in Bezier handle layers only for Bezier curves.

Pull Request: https://projects.blender.org/blender/blender/pulls/131087
2024-12-04 14:02:17 +01:00
Hans Goudey
583ae8990c Sculpt: Optimize sculpt vertex neighbor storage
Currently we calculate neighbors for vertices in batches. The idea is
to access topology data all at once, storing the result in a local node-
sized vector that can fit in CPU caches. Currently we use
`Vector<Vector<int>>` for storing the neighbors, and that works well
enough when the number of neighbors fits into the inline buffer, but
whenever it doesn't it causes many vector reallocations and scatters
the neighbor storage in arbitrary memory locations.

This commit changes to using a `GroupedSpan` to store the neighbors, in
other words contiguous storage split into groups by an array of offset
integers. This reduces local per-vertex memory usage by 20 bytes and
makes memory access more predictable.

I observed a 1.39x performance improvement for the mesh smooth filter
on a large triangulated mesh, and a 1.14x improvement for a mesh of
mostly quads. In the brush benchmark on a quad mesh the difference I
observed is a small slowdown. I'm not sure why that happens but I trust
the results from the filter a bit more.

Resolves #130797.

Pull Request: https://projects.blender.org/blender/blender/pulls/130941
2024-12-04 14:00:37 +01:00
Aras Pranckevicius
aebd4a711c Fix: VSE cursor handling crash when there's no active tool
For me on Mac picking "Video Editing" template in startup dialog
now consistently crashes, due to bToolRef being null.
Looks like other code places check for tool being null before trying
to use it; `sequencer_main_cursor` however was not.

Pull Request: https://projects.blender.org/blender/blender/pulls/131358
2024-12-04 13:25:07 +01:00
Hans Goudey
024d7d12e2 Mesh: Move BVH storage to shared cache system
Avoid rebuilding BVH trees when meshes are copied.
Similar to the other uses of the shared cache system,
this can arbitrarily improve performance when meshes
are copied but not deformed and BVH building is the
main bottleneck. In a simple test file I got a 6x speedup.

The amount of code is also reduced and the system is
much simpler overall-- built out of common threading
patterns like `SharedCache` with its double-checked lock.
RAII is used in a few places to simplify memory management
too.

The downside is storing more `SharedCache` items in the
mesh runtime struct. That has a slight cost when copying
a small mesh many times, but we have ideas to improve that
in the future anyway (#104327).

Pull Request: https://projects.blender.org/blender/blender/pulls/130865
2024-12-04 00:17:17 +01:00
Sean Kim
d8bec5faee Fix #131139: Small brush radius and alpha texture degrades performance
The call to `sculpt_apply_texture` is not thread safe and as such is a
major bottleneck in brush stroke processing. In previous versions, we
avoided calculating this if the vertex position was outside of the brush
radius.

To fix this, we add a check for the factor already being 0 and prevent
further texture calculations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131256
2024-12-03 21:52:50 +01:00
Julian Eisel
7d4190a8f3 Fix startup crash when running in background mode after 172e9c5b83
Previously area & region types were not set when in background mode,
with 172e9c5b83 that changed. Apparently this causes a bunch of logic to
run that shouldn't run in background mode. So make sure we don't set the
types in background mode. Also don't run region polling in background
mode, since that would cause another crash if region types are not set
(as done in background mode).
2024-12-03 18:16:07 +01:00
Julian Eisel
172e9c5b83 Fix #130583: Crash opening a file when asset shelf is set for non-paint modes
The region type isn't set yet when polling regions just after file read. As a
result, the polling state cannot be evaluated correctly, and `init()` may end
up being called without the previous required call to `on_poll_success()`.

Ensure the region type is set earlier, right at the beginning of screen
initialization after file read. This way all further area/region
referesh/re-init (confusingly called "init") logic can assume it's set.

Pull Request: https://projects.blender.org/blender/blender/pulls/131050
2024-12-03 16:57:38 +01:00
Sebastian Parborg
d7140a599d Fix: Make sure Blender doesn't seek an extra time after starting to playback 2024-12-03 16:25:59 +01:00
Sebastian Parborg
6d1bc2feb1 Fix: remove uneeded A/V sync frame interpolation
This was trying to smooth out the playback but could instead lead to
worse frame pacing. It was also masking some bugs in the PulseAudio
backend that has been fixed.
2024-12-03 16:25:59 +01:00
Sebastian Parborg
32a26b8e19 Fix: Properly reset the audio devices when changing settings
Previously changing audio devices or settings while Blender was playing
back could lead to crashes or the playback state between Blender and
Audaspace de-syncing.
2024-12-03 16:25:59 +01:00
Falk David
a265b591be Python: Add API function to reorder curves
The order of curves in a Grease Pencil drawing defines the
order in wich they are rendered, so it's important to be
able to change the order. Currently, there is not easy way
to do this from python.

This adds a new `reorder_curves` and `reorder_strokes`
function to reorder the curves in the curves geometry.

The function takes in an array of indices that are the
new indices for the curves (e.g. an index map).

`reorder_curves(new_indices=[...])`

Pull Request: https://projects.blender.org/blender/blender/pulls/130331
2024-12-03 16:23:31 +01:00
Clément Foucault
62897317bd DRW: Remove Basic engine
All remaining shaders were moved to overlay.

The basic engine is not used anymore since
all selection and depth picking happens inside
overlay engine.
2024-12-03 16:11:31 +01:00
Julian Eisel
d9eb1d7155 Fix #130758: UI: Spreadsheet: Animation update does not affect tree view
Redraw was not triggered for the region containing the tree-views. Ensure it's
handled by the editor redrawing logic for animation playback.

Pull Request: https://projects.blender.org/blender/blender/pulls/131303
2024-12-03 14:15:02 +01:00
Laurynas Duburas
b13e085109 OBJ Import: Improved NURBS curve support
Adds support of NURBS weights or "rat bspline" in OBJ terms.
Tries to guess Blender knot mode better:

- Detects and closes loops. This decision is based on geometry only. No metadata is provided in OBJ for this, so importer has checkbox to disable this feature.
- Bezier knot mode allows to import circles and circular arcs.

Pull Request: https://projects.blender.org/blender/blender/pulls/131169
2024-12-03 13:16:16 +01:00
Pratik Borhade
3b303bed34 Fix: Grease Pencil: Remove group crash when tab is pinned
Missed in bd4f7acce5.

Pull Request: https://projects.blender.org/blender/blender/pulls/131295
2024-12-03 12:10:01 +01:00
Jacques Lucke
5e66ece252 Fix #131258: hidden sockets add padding to nodes 2024-12-03 10:08:59 +01:00
Harley Acheson
5d05c36fc7 UI: Fix Broken Menus after #129125
Copy and Paste error resulted in UI_block_end_ex
being called twice.  Remove the first.

Pull Request: https://projects.blender.org/blender/blender/pulls/131275
2024-12-03 02:53:38 +01:00
Campbell Barton
ababc2e01b Fix #120778: depth navigation ignores camera & light objects
Restore overlay depth drawing which was removed in [0].
For viewport navigation this is useful. Disable overlays
for other operations such as painting & object placement.

Also disable color drawing in the overlay_next engine drawing
when drawing depth, since it caused the viewport to show a
checkered backdrop.

Details:

A boolean argument has been added to ED_view3d_depth_override instead
of new enums in eV3DDepthOverrideMode since mixing object-filtering
and draw-type in the one enum gets verbose & awkward, where most
existing enums would have needed to include NO_OVERLAY in their name.

V3D_DEPTH_NO_OVERLAYS has been renamed to V3D_DEPTH_ALL,
the caller must pass in use_overlay as false.

[0]: 5fea1eda36
2024-12-03 11:00:27 +11:00
Harley Acheson
154ab16ee2 Fix #128419: Allow the Positioning of Centered Dialogs
Some popups are positioned centered in the window, like "Splash",
"About", and the large confirmations. But when you drag these to
a different location they will snap back when there is any window
interaction.  This PR allows you to move these popups and they will
stay in the new location.

Pull Request: https://projects.blender.org/blender/blender/pulls/129125
2024-12-02 22:01:05 +01:00