Commit Graph

150201 Commits

Author SHA1 Message Date
Pratik Borhade
2b0cc73ef6 Modifiers: Change softbody fuzzy default value
Set fuzzy=1 when softbody modifier is added. As of now, value is 0, this
raises concern of division by zero so bump it to 1.
Updated `softbody_test.blend` to fix the failing test.
Resolves #137849

Pull Request: https://projects.blender.org/blender/blender/pulls/137878
2025-05-30 06:32:08 +02:00
Campbell Barton
bd0855f443 Docs: update code layout diagram 2025-05-30 12:33:04 +10:00
Campbell Barton
60aede77af Fix use after free error rendering in background mode on Wayland
The event handing thread wasn't properly shutdown in background mode.

Resolve by disabling threaded event handling in background mode.
2025-05-30 12:32:06 +10:00
Campbell Barton
fbe28d16bd Cleanup: use a separate logging callback in background in Wayland 2025-05-30 12:07:40 +10:00
John Kiril Swenson
d3d4124ce6 Cleanup: VSE: Standardize "Crossfade" and "Gamma Crossfade" naming
Use these terms over "Cross" and "Gamma Cross" in the UI/RNA
when referring to effect strips.

Keep it as "Cross" for blend modes for now (which is in and of itself
a bit of a weird naming. In the future, we should consider unifying
our blend mode types with compositor ones for consistency).

Pull Request: https://projects.blender.org/blender/blender/pulls/139606
2025-05-30 03:41:10 +02:00
John Kiril Swenson
d90896ebc7 Fix: VSE: Add missing effect types to "change effect type" menu
PR #139514 just copied the "add effect" menu, but forgot the
other possible effect types (crossfade, gamma crossfade, adjustment).
2025-05-30 03:41:09 +02:00
John Kiril Swenson
47b881fc6f Fix: VSE: Reassign Inputs erroring
With the change to a new `strip_effect_get_new_inputs` prototype
in #138016, this call got overlooked. The bool would sneak in
as an `int` and silently fail.
2025-05-29 20:11:16 -05:00
Campbell Barton
50f3240abd Cleanup: spelling & duplicate terms (check_spelling.py) 2025-05-30 11:03:56 +10:00
Sean Kim
9ecee59ee7 Fix: Sculpt Filter tools may not initialize radius
Introduced in 6d0c33e8e7

Pull Request: https://projects.blender.org/blender/blender/pulls/139611
2025-05-30 03:01:51 +02:00
Harley Acheson
370d8956ae Fix #137735: Scale Icon Border Intensity by Icon Alpha
When an icon is drawn with both lowered opacity and a border shadow
(used to increased contrast in Light theme), it will look darker
because more of the dark shadow is visible through the icon. This PR
fixes this by scaling the shadow by the opacity.

Pull Request: https://projects.blender.org/blender/blender/pulls/139610
2025-05-30 02:48:07 +02:00
Sean Kim
af31eeb900 Sculpt: Lower Multires leaf node limit to 800
In a prior commit, the Mesh Paint BVH leaf node limit was reduced from
10000 faces to 2500 faces. This commit makes a proportional change
for the Multires paint BVH.

In performance testing of just the brush evaluation, this change
represents a 3x speedup (from 0.6326s to 0.2135s) on a Multires grid
with 25m vertices at multires level 5.

In a simulated brush stroke testing similar to what a user would do,
on a grid of 6m vertices at multires level 5 this change equals a 1.4x
improvement from 41.8 to 58.6 FPS.

See the related PR for the raw data and testing methodology.

Related to #137871

Pull Request: https://projects.blender.org/blender/blender/pulls/139311
2025-05-29 21:45:17 +02:00
Hans Goudey
91803e130f Cleanup: Grammar: Fix uses of "for e.g."
e.g. stands for "exempli gratia" in Latin which means "for example".
The best way to make sure it makes sense when writing is to just expand
it to "for example". In these cases where the text was "for e.g.", that
leaves us with "for for example" which makes no sense. This commit fixes
all 110 cases, mostly just just replacing the words with "for example",
but also restructuring the text a bit more in a few cases, mostly by
moving "e.g." to the beginning of a list in parentheses.

Pull Request: https://projects.blender.org/blender/blender/pulls/139596
2025-05-29 21:21:18 +02:00
Hans Goudey
5747f839e8 Cleanup: Grammar: Fix uses of "it's own" 2025-05-29 14:41:20 -04:00
John Kiril Swenson
1834f9f200 VSE: Improve "Change Effect Type" operator
- Previously, effects could be changed into types that take different
amount of inputs, e.g. from "add" to "glow", which led to undefined
and glitchy behavior (unreported bug). Fix by requiring same input count
for new effect.
- Previously, strip names were not updated when changing effect type,
which tended to be confusing. Now, if the default name was not changed,
update to the new effect type name.
- Remove "effect strip" menu from color and text strips. Although they
are effects internally, to a user, this is not clear, and providing the
option to modify effect inputs in these cases doesn't really make sense.

Pull Request: https://projects.blender.org/blender/blender/pulls/139514
2025-05-29 20:28:20 +02:00
Sean Kim
53c922e30d Fix: Cursor options display inactive in Sculpt Mode
Prior to this commit, the cursor overlay options were tied to the
`has_overlay` setting for brushes. This check used the `mtex` property
to examine the mapping mode of the associated texture.

This should not apply to the overall cursor overlay settings, as they
are not dependent upon a texture being loaded.

Pull Request: https://projects.blender.org/blender/blender/pulls/139567
2025-05-29 20:04:42 +02:00
Sean Kim
5402ce3929 Cleanup: Remove unnecessary qualifiers in BKE_paint.hh
Pull Request: https://projects.blender.org/blender/blender/pulls/139571
2025-05-29 20:02:32 +02:00
Sean Kim
000c635542 Cleanup: Remove unnecessary const in BKE_brush.hh
Pull Request: https://projects.blender.org/blender/blender/pulls/139570
2025-05-29 20:01:50 +02:00
Miguel Pozo
2db0b92280 GPU: Add CompilationPriority
Allow adding compilation batches to different priority queues.
Set priorities so static shaders are always compiled first,
then materials, and optimized materials last.

Pull Request: https://projects.blender.org/blender/blender/pulls/139456
2025-05-29 19:43:02 +02:00
Richard Antalik
7169ee7850 VSE: Scene strip invalidation
Previously there was no mechanism to invalidate scene strip cache, when
changes were made to scene that the strip renders. Because of this, the
cache had to be cleared manually, even for other strips.

Strip invalidation is performed from function
`ED_render_id_flush_update`.
Recalc flags like selection or frame change are ignored as they are
unlikely to influence the rendered image.
When some ID is changed, all scene strips using
`DEGEditorUpdateContext::scene` will be invalidated.

Limitations:
- Because frame change is ignored, changes to physics caches would not
invalidate VSE strips
- Only active scene will be invalidated this way. So if an object is
linked to 2 scenes, inactive scene cache would be invalid
- If animated object is moved, and there is VSE preview to be updated
Scene re-rendering in VSE would cause object to snap to its evaluated
position. This is because scene frame is changed by VSE. Reported in
#139501.

To refresh VSE preview after cache is invalidated, relatively big chunk
of code was copied from `view3d_main_region_listener` to VSE preview
listener. Cases that would not result in visual changes like selection
were excluded.

Fixes #113137.

Pull Request: https://projects.blender.org/blender/blender/pulls/138231
2025-05-29 19:08:32 +02:00
Harley Acheson
b26c2c1b38 Fix #139248: Update IME Data with GHOST_kEventImeComposition Event
Before e4aa758d70 we kept a pointer to ghost IME data, but with that
change we instead maintain a local copy of that data instead. This
means that we have a copy of it with GHOST_kEventImeCompositionStart,
but we don't update our copy when we get GHOST_kEventImeComposition.
This is where (at least on Windows) when we get the composition result,
the final string to be inserted.

Pull Request: https://projects.blender.org/blender/blender/pulls/139557
2025-05-29 18:40:51 +02:00
Clément Foucault
9a87594e93 Fix #138920: EEVEE: Crash when switching workspace with world volume
This was caused by the volume module not being available in
`begin_sync`.

The fix is to split `modules_init` into `init` and `begin_sync`
to always init the modules when creating the `DRWContext`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139442
2025-05-29 17:08:27 +02:00
Aras Pranckevicius
4a328b5a63 Nodes: Voronoi node CPU optimizations
Several small speedups for Voronoi node (no behavior change). This
affects Cycles and CPU execution of Voronoi node e.g. in Compositor.

- F1 mode: when evaluating distance for Voronoi cells, use a faster
  distance estimation, and only do final distance calculation on the
  resulting closest cell. This is only really relevant for the default
  Euclidian distance, where this saves a square root per evaluated cell
  (in 3D Voronoi case saves 26 square roots; in 4D case saves 80 square
  roots).
- N-Sphere Radius mode: speedup by doing squared distance calculations.
  We only need to find the closest one, so again doing the square root
  per cell is not needed here.

Something like 5%-10% speedup for F1 3D Voronoi; more performance details
in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/139490
2025-05-29 15:40:31 +02:00
Jeroen Bakker
c56a855b9f Fix #139565: PyGPU: Add builtin point shaders
This PR adds builtin shaders for drawing points. Using `FLAT_COLOR`,
`SMOOTH_COLOR`, `UNIFORM_COLOR` can lead to undesired behavior
on Metal and Vulkan backends. To ensure future compatibility this PR
adds `POINT_FLAT_COLOR` and `POINT_UNIFORM_COLOR`.

The point size can be set using `gpu.state.point_size_set`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139583
2025-05-29 14:36:32 +02:00
Jacques Lucke
fd58d730b0 Fix #139516: crash when enabling shader node previews 2025-05-29 13:56:28 +02:00
Omar Emara
43110fc7a3 Compositor: Take virtual sockets into consideration
This patch takes virtual sockets into consideration in the compositor
code base. This mostly involves ignoring them as if they were
unavailable.

This is needed for use with nodes that use Extend sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/139582
2025-05-29 13:32:30 +02:00
Jacques Lucke
367b7b240f Nodes: support creating wrapper node group that keeps original interface
Previously, when using `ctrl+G` on a single node, the newly created node group
always had a flat list of inputs and outputs. This is somewhat annoying when the
node has a lot of inputs that were already organized in panels.

This patch makes it so that when grouping a single node, it will attempt to keep
the same node interface as the original node. This works for group nodes but
also for built-in nodes. For example, when creating a group from the Principled
BSDF node, the group will still have all the same panels. Default values are
taken from the node that is being grouped.

When grouping more than one node, the behavior is exactly the same as before. In
this case there isn't really an obvious way for how to create panels
automatically.

Internally, this works by taking by creating the new node group directly from
the node declaration.

Pull Request: https://projects.blender.org/blender/blender/pulls/139351
2025-05-29 13:32:02 +02:00
Jacques Lucke
182797ea61 Geometry Nodes: new Format String node
This adds a new Format String node which simplifies constructing strings from
multiple values. The node takes a format string and a dynamic number of
additional parameters as input. The format string determines how the other
inputs are inserted into the string. Only integer, float and string inputs are
supported for now.

It supports two different format syntaxes:
* Python compatible format syntax which also mostly matches the behavior of the
  `fmt` C++ library. Most of this is supported, but there are some small
  limitations.
* Syntax of the form `###.##` where each `#` stands for a digit. This is the
  syntax that was introduced in #134860.

This node greatly simplifies common string operations which would have required
potentially many nodes before to convert numbers to strings and to concatenate
them. It also makes new conversions possible that were not supported before.
This node can also be used to insert e.g. frame numbers into a file path which
was surprisingly complex before.

This node has special behavior for the name of new inputs. For the purpose of
the node, the name of the inputs must be valid identifiers and it's usually
helpful when they are short. New names are therefore initialized to be single
characters. If possible, the first character of the linked input is used. This
works well when connecting e.g. a Separate Vector/Color node. Otherwise, inputs
are named `a` to `z` by default. If that's not possible, the source socket name
is used instead (converted to be a valid identifier). If that still doesn't
work, the name is made unique using the normal `.001` mechanism except that `_`
instead of `.` is used as separator to make the name a valid identifier.

Python Syntax references:
* Python: https://docs.python.org/3/library/string.html#formatspec
* `fmt`: https://fmt.dev/latest/syntax/

More detailed notes about compatibility with the above syntax specifications:
* Conversion using e.g. `!r` like in Python is not supported (maybe the future).
* Sub-attribute access like `{vector.x}` is not supported (maybe the future).
* Using `%` like in Python is not supported (maybe in future).
* Using `#` for an alternate form is not supported. This might help in the
  future to make the syntax compatible with #134860.
* Using `L` like in the `fmt` library is not supported because it depends on the
  locale which is not good for determinism.
* Grouping with e.g. thousands separators using e.g. `,` or `_` like in Python
  is not supported (maybe in future). Need to think about the locale here too.
* Mixing of unnamed (`{}`) and named (`{x} or {0}`) specifiers is allowed.
  However, all unnamed specifiers must come before any named specifier.

The implementation uses the `fmt` library for the actual formatting. However,
the inputs are preprocessed to give us more control over the exact supported
syntax and error messages. The code is already somewhat written so that many
strings could be formatted with the same format but that's not actually used yet
because we don't have string fields yet.

Error messages are propagated using a new mechanism that allows a limited form
of error propagation from multi-functions to the node that evaluates them.
Currently, this only works in fairly limited circumstances, e.g. it does not
work during field evaluation. Since this node is never part of field evaluation
yet, that limitation seems ok, but it's something to work on at some point.
Properly supporting that requires some more changes to propagate enough context
information everywhere. Also showing errors of field evaluation on the field
node itself (instead of on the evaluation node) requires even more work because
our current logging system is not setup to support that yet.

This node comes with a few new requirements for the socket items system: names
must be valid identifiers and they are initialized in a non-trivial way.
Overall, this was fairly straight forward to implement but currently it requires
to adding a bunch of new members to all the accessors that don't really need it.
This is something that we should simplify at some point even if I'm not entirely
sure how yet. The same new requirements used in this node would probably also
exist in a potential future expression node.

Pull Request: https://projects.blender.org/blender/blender/pulls/138860
2025-05-29 13:17:03 +02:00
Jeroen Bakker
cd3bd7774f Fix #139546: Vulkan: Race condition during rendering resulting in a stall
Race condition between the main thread and worker thread. In this case
the worker thread was waiting for a device idle, but the main thread was
waiting on a specific timeline. As long as the timeline didn't pass the
device was locked.

Releaved the race condition to check on queue idle as the timeline event
isn't part of the queue.

On windows drivers could be reset and could lead to other crashes as handles
were not used anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/139579
2025-05-29 12:13:43 +02:00
Jeroen Bakker
c8dd396f54 Cleanup: Vulkan: Silence logging
This change will move some detailed logging to a higher level as it
isn't important for issue tracking.

Pull Request: https://projects.blender.org/blender/blender/pulls/139575
2025-05-29 11:13:25 +02:00
Jeroen Bakker
283a267c13 Fix #139558: Incorrect shader when using edge slide even
In this case a triangle shader was used to render points.

This change entails:
- Using point shaders in this case
- Add support for `GPU_point_size` to update the uniform of the point
  shader.

Pull Request: https://projects.blender.org/blender/blender/pulls/139574
2025-05-29 10:12:33 +02:00
Hans Goudey
11dc71b258 Spreadsheet: Add option to display internal attributes
Previously the only way to see these attributes and their values
was the Python API. It's helpful for both users and developers to
be able to know all the data attached to the geometry.

This commit adds an option to the spreadsheet's "View" menu
to display attributes starting with a period that are normally hidden.
The option is off by default. Anonymous attributes are still hidden.

---

![image.png](/attachments/3fbb8544-c13d-469c-ae7d-3ade68b0bcb3)

Pull Request: https://projects.blender.org/blender/blender/pulls/139559
2025-05-29 04:12:28 +02:00
Hans Goudey
a7e3a81c84 Cleanup: Use functional style case for eCustomDataType 2025-05-28 22:05:03 -04:00
Campbell Barton
ebca01274f Cleanup: unused parameter warning 2025-05-29 11:01:29 +10:00
Campbell Barton
479d1f1d16 Cleanup: use doxygen doc-strings, spelling (make check_spelling_*) 2025-05-29 11:00:53 +10:00
Sean Kim
71330894b7 Cleanup: Remove unused variables in sculpt_undo.cc
Previously, the undo type was stored at the node level, so undo pushes
inside sculpt mode that didn't need nodes still appended this data so
that they could be appropriately filtered out. This commit removes
instances where this was the case and clarifies other checks that used
the vector of undo nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/130479
2025-05-29 00:57:44 +02:00
Ray Molenkamp
0b6fd93069 libs: move wintab out of the lib dir into /extern
Almost all content in the libdir we can regenerate, wintab however
is not one of them, and if you generate a new lib folder it's one
of the things you have to manually copy back into place.

this PR moves it out of the libdir and into /extern

Pull Request: https://projects.blender.org/blender/blender/pulls/128873
2025-05-29 00:52:57 +02:00
Ray Molenkamp
b178a0b298 deps: Bump zstd to 1.5.6
Otherwise the python bindings throw an error while
loading.
2025-05-28 13:57:59 -06:00
Hans Goudey
c725bf324d Cleanup: Use functional style cast for node socket type enum 2025-05-28 15:47:26 -04:00
Harley Acheson
fbace1066d Fix #139157: Fix Movement of Numbers in animation editors
Both horizontal and vertical scale indicators rely on string measuring
for proper positioning. But in order to always do this reliably the
font's size needs to be set explicitly. Otherwise the font size could
be incorrect from prior use so the measurement is wrong, but then the
size is correctly set when drawing occurs. It draws at the right size
but at wrong position.

Pull Request: https://projects.blender.org/blender/blender/pulls/139549
2025-05-28 21:39:50 +02:00
Sean Kim
5de2d48921 Cleanup: Use C++ style casts for Brush type
In most cases this is a simple switch for `reinterpret_cast` or
`static_cast`, but for `BKE_paint_brush` and `BKE_paint_eraser_brush`
code is duplicated to avoid a `const_cast`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139119
2025-05-28 21:37:12 +02:00
Clément Foucault
7245262de8 GPU: Metal: Add --profile-gpu support for CPU timing
The GPU implementation is a bit too complex
to implement for now.

As we are improving shader loading, having the
CPU timings is already helpful.

Note that `Map<size_t, int>` does not compile
on Clang.

This is exposing the `--profile-gpu` option on
all backends as the vulkan backend should follow
shortly.

Pull Request: https://projects.blender.org/blender/blender/pulls/139551
2025-05-28 21:08:38 +02:00
Sebastian Parborg
5106c4e655 JACK: Fix a mutex deadlock when trying to start/stop playback 2025-05-28 19:32:34 +02:00
Jesse Yurkovich
8d22407ca0 Fix: USD: Set midlevel and scale inputs for constant displacement
Explicitly set the Midlevel and Scale values for Displacement material
nodes during Import. This is necessary for "constant" displacement,
where the incoming UsdPreviewSurface does not have midlevel or scale
data associated with any part of the node graph. We default to Midlevel
and Scale values of 0.5 and 1.0 respectively; as that's what the prior
code assumed, and will closely match what is seen in `usdview`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139510
2025-05-28 19:23:19 +02:00
Miguel Pozo
cfa8c9d4ad Fix: Core: VectorList iterator after clear
Check for `used_vectors_` instead of the allocated size.
Improve iterator tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/139541
2025-05-28 18:59:44 +02:00
Ray Molenkamp
5c98be4940 deps: Fix typo in DPCPP_SPIRV_HEADERS_FILE
caused a build error due to a hash mismatch with a previous
copy of this file I had.
2025-05-28 10:49:55 -06:00
Lukas Tönne
2a317bad3e Fix #139471: Grease Pencil: Trace materials must be created on main thread
Creating materials in worker threads does not work, this relies on BKE functions
which must only be called from the main thread. Create the foreground/background
materials in advance before starting the trace job.

Pull Request: https://projects.blender.org/blender/blender/pulls/139532
2025-05-28 18:23:25 +02:00
Bastien Montagne
20eff58509 Fix: Assets Browser: asserts on unknown import method values.
Since code expects only known values of
`FileAssetSelectParams::import_method`, ensure forward compatibility on
file read by defaulting to `FILE_ASSET_IMPORT_FOLLOW_PREFS` when the
value is unkown to the current code.

------

Found out while working on forward compatibility for embedded linked IDs
project, which introduces a new 'Link Embed' import method.

Pull Request: https://projects.blender.org/blender/blender/pulls/139537
2025-05-28 17:45:31 +02:00
Bastien Montagne
3f97206781 Cleanup: Fix incorrect reference to MAX_ID_NAME-2 for Mask's layer name. 2025-05-28 17:39:02 +02:00
Bastien Montagne
ff63f81eb4 Fix: BLO: Invalid handling of duplicated libraries in readfile code.
The issue was the usage of `change_link_placeholder_to_real_ID_pointer`
to remap the removed duplicate Library ID pointer to its first instance.

Library ID pointers are _not_ placeholder ones, and therefore the check
on entries in `change_link_placeholder_to_real_ID_pointer_fd` would
fail, leading to never actually remapping this removed Library ID
pointer.

Added a dedicated separate util functions for this usage, as it is
important to keep it clearly distinct from the more usual remapping of
placeholder IDs to their real linked counterparts.

-----

This issue was likely never noticed before, because:
* 'Standard' Library ID pointers are rare, nowadays they are mostly
  coming from the Outliner tree items. (`ID.lib` pointers and the like
  are set by readfile code outside of/before the lib-linking process.)
* Files with duplicate libraries should not be possible to create for
  quite a few years already.

Found out while working on forward compatibility for the Embedded Linked
IDs, since in this project 'duplicates' of libraries (from older code PoV)
are expected: the 'archive' Library IDs.
2025-05-28 17:10:21 +02:00
Philipp Oeser
5d7967fed8 Fix #139314: Copy Keyframes copies a frame if only a handle is selected
This might be up for debate, but for the purpose of copy/pasting
keyframes, I think including keyframes that only have a handle selected
is not what most users expect.

The more pressing issue of #139314 is probably already addressed with
!139349 (that one fixes cases where handles would be included in [box]
selection even though they are not visible), but handles -- e.g.
overshooting handles -- can easily get included in [box]selection
without the user actually wanting to copy/paste the whole keyframe.

This is now resolved by swapping the check for skipping a keyframe from
`BEZT_ISSEL_ANY` to `BEZT_ISSEL_IDX`.
Additionally, a bit of code was added so we can do the "early out" in
`copy_animedit_keys` under the same condition.

Pull Request: https://projects.blender.org/blender/blender/pulls/139352
2025-05-28 16:39:27 +02:00