Commit Graph

150077 Commits

Author SHA1 Message Date
Jacques Lucke
a33df684c4 Cleanup: Nodes: use StringRefNull in socket item accessors
This mainly helps avoid accidentally comparing char pointers instead of the
strings they point to.

Pull Request: https://projects.blender.org/blender/blender/pulls/138917
2025-05-15 08:41:21 +02:00
Omar Emara
79d37720de Nodes: Add Factor and Percentage subtypes for vector sockets
This patch adds support for the Factor and Percentage subtypes for
vector sockets. This is needed by the compositor, since it has some node
inputs that specify locations and sizes relative to image size, and
having factor and percentage subtypes for those improves the UX quite a
bit according to user feedback.

Pull Request: https://projects.blender.org/blender/blender/pulls/138805
2025-05-15 08:29:41 +02:00
Jacques Lucke
1a7b53ec0b Geometry Nodes: don't trigger evaluation when adding a frame
A frame never affects the computed output, so it can be added without
causing an evaluation.
2025-05-15 06:52:43 +02:00
Sean Kim
15c80a29a8 Cleanup: Various non-functional changes for sculpt raycast methods
* Removes `SculptSession` from being passed to the raycast callbacks,
  it was only used to determine the existence of the `StrokeCache` and
  has been replaced with a boolean.
* Use C++ math library where possible.
* Use const where possible.
* Moves most related `SCULPT_` prefixed methods into the corresponding
  namespace.
  * Renames `SCULPT_stroke_get_location` to `stroke_get_location_bvh`
    to avoid potential collisions in the `sculpt_paint` namespace with
    other editors & be more clear about the usage.

Pull Request: https://projects.blender.org/blender/blender/pulls/138796
2025-05-15 05:22:46 +02:00
Jacques Lucke
b84e790b81 Spreadsheet: show column name in column header tooltip
This is similar to how the value is shown when hovering over a value.
It's useful when the name does not fit into the column width.

Requested by Simon.
2025-05-15 05:15:54 +02:00
John Kiril Swenson
41781df1a6 Cleanup: VSE: Rename seq1 and seq2 references
This patch renames `seq1` and `seq2` to `input1` and `input2` in `Strip`
and `StripSelection` structs to consist with recent refactors in
#132179.  It also renames other instances of `seq1` and `seq2` (e.g.
local variables) to `strip1` and `strip2` instead.

There is only one small breaking change to the Python API with
`strips.new_effect()` taking in the new names now. There should be
no other functional changes involved.

Pull Request: https://projects.blender.org/blender/blender/pulls/138296
2025-05-15 05:01:39 +02:00
Sean Kim
0b6f774c90 Fix: Avoid precomputing factor cache in certain cases
When using the View Normal automasking mode, the per-vertex calculation
is not prohibitively expensive, unlike the topology and boundary modes.
Additionally, we do not populate the view normal values in the cache
when the brush stroke starts.

Pull Request: https://projects.blender.org/blender/blender/pulls/138906
2025-05-15 04:37:36 +02:00
Sean Kim
5d0df1f052 Cleanup: Move Surface Smooth brush initialization into brush file
Pull Request: https://projects.blender.org/blender/blender/pulls/138905
2025-05-15 04:36:51 +02:00
Campbell Barton
e97e9c2904 Cleanup: various non functional changes for C++ 2025-05-15 10:26:47 +10:00
Campbell Barton
3ec7748485 Cleanup: spelling in comments (make check_spelling_*)
Also replace term "playhead" with "current-frame".
2025-05-15 10:13:23 +10:00
Guillermo Venegas
351fbff95b Refactor: UI: Replace uiItemM_ptr and uiItemM with uiLayout::menu
This converts the public `uiItemM_ptr` and `uiItemM` functions
to an object oriented API (an `uiLayout::menu` overloads),
matching the python API.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138895
2025-05-14 23:22:56 +02:00
Sean Kim
8ce4d737fa Fix: Various brush features do not use sampled area normal
When performing a raycast into the paint BVH inside Sculpt Mode, there
are two possible values for the cursor's normal: the current vertex's
normal, or a sampled average of the normals in the cursor radius.

The "Grab Silhouette" option of the Grab brush and the "Area Normal"
option of brush automasking both use an initial normal value to
determine a relative influence factor. However, this normal was only
ever using the active vertex normal, not the sampled normal, leading to
a stronger than normal falloff on areas of a mesh that have a high
variance between individual vertex normals.

To further complicate matters, the "Area Normal" setting uses the
sampled normal when the Mesh Filter tool is used, but sculpt brushes
behave as described above. This commit aligns the behavior across all
tool types.

To fix this, check for the existence of this sampled normal when
populating the initial value and use it if found.

Pull Request: https://projects.blender.org/blender/blender/pulls/137692
2025-05-14 23:20:17 +02:00
Nicola
0cf8066284 Fix #138827: Line Project tool not working on scaled objects
Introduced with `a9e29bea94`

The normal wasn't normalized after being converted to object space.

Pull Request: https://projects.blender.org/blender/blender/pulls/138848
2025-05-14 23:08:21 +02:00
Sean Kim
2e3debc4ca Assets: Enable asset metadata operators for brush shelf context menu
Currently, depending on whether or not a brush asset is part of a
library, the context menu shown for it changes significantly.

To better support local brush asset modifications, and make the UI more
consistent, this commit exposes the following operators:

* `brush.asset_edit_metadata`
* `brush.asset_load_preview`
* `brush.asset_save`
* `brush.asset_revert`

Of these four operators, the first two are allowed to execute, whereas
the latter two are always disabled on local assets via the corresponding
`poll` methods, as neither is applicable for this usecase.

Related to #138105

Pull Request: https://projects.blender.org/blender/blender/pulls/138376
2025-05-14 23:01:31 +02:00
Jesse Yurkovich
5336246855 Fix: Call finish() for mutable attribute writers in new FBX importer
Otherwise the following is traced to the console:
```
Warning: Call `save()` to make sure that changes persist in all cases.
```

Pull Request: https://projects.blender.org/blender/blender/pulls/138893
2025-05-14 21:40:27 +02:00
Sean Kim
745582ee01 Fix #138851: Assert on entering Sculpting workspace
Introduced with 617858e453

Pull Request: https://projects.blender.org/blender/blender/pulls/138852
2025-05-14 20:47:31 +02:00
Philipp Oeser
b8d82c510f Fix #138782: "Set Origin > Geometry to Origin" can be inaccurate
"Origin to Geometry" was also affected

With very large meshes (report was about this failing for imported
terrain data), we lack precision in `BKE_mesh_center_median`.

First intuition was to just use doubles, but based on the work done
in !132759 to get a more numerically stable way to compute a mean,
we can use that instead.

So this PR moves `compute_sum` into `blender::array_utils`
and re-uses that for `BKE_mesh_center_median`

Pull Request: https://projects.blender.org/blender/blender/pulls/138813
2025-05-14 17:56:07 +02:00
RedMser
804449dfb0 Fix #128126: Hidden Node Groups not searchable in Add Node menu
Node groups are now hidden based on the "Show Hidden Files/Data-Blocks"
user preference, similar to how the ID selector search filters the
results based on the user preference.

Note that this PR does **not** change filtering behavior when the
setting is off and you search for a dot.

Pull Request: https://projects.blender.org/blender/blender/pulls/138878
2025-05-14 17:41:47 +02:00
quackarooni
dd698d4f24 Fix: Geometry Nodes: Asset catalog "Unassigned" does not show in menu
The Node Editor Add menu has filters for not drawing asset catalogs in
the root level. This is done so that catalogs that share names with
built-in menus are appended to said menus.

There is no "Unassigned" built-in menu, just a root level asset menu for
unassigned assets. This menu does not currently have the behavior to
support appending catalogs to it, so assigning assets to a catalog named
"Unassigned" renders said assets unaccessible in the Add Menu.

This patch removes that filter as it was deemed better to just allow the
user to have a root level catalog menu named "Unassigned" instead of
mushing it with the menu for unassigned assets.

Pull Request: https://projects.blender.org/blender/blender/pulls/138874
2025-05-14 16:50:29 +02:00
Pablo Vazquez
a97ce49298 Fix: Asset Browser: typo in Import Method popover 2025-05-14 16:37:54 +02:00
Aaron Carlisle
6329e00cd1 UI: Improvements to shading layout
Improve labels and UI consistency.

- Update color labels: Object, Wireframe, Background
- Rename 'Single' shading color to 'Custom'. Move to the end.
- Rename 'Viewport' color to 'Custom' for consistency.
- Fix alignment of Object Color item labels

Pull Request: https://projects.blender.org/blender/blender/pulls/137408
2025-05-14 16:24:51 +02:00
quackarooni
8f232517f0 Fix: Nodes: Missing builtin categories for handling asset catalogs
The current behavior for the Node Editor's Add menu is to list the
user's asset catalogs at the root level of the menu. However, an
exception is made if the catalog has the same name as a builtin menu.
In such case, the asset catalog is appended to that builtin menu,
instead of being drawn at the root level.

How this is currently implemented right now is to have a hard-coded set
of builtin menus in `add_menu_assets.cc`. Certain menus are missing from
this set, particularly newer ones, which may be an oversight during the
creation of these menus.

This patch adds those menus to that list, which are as follows:
- Input/Gizmo
- Input/Import
- Grease Pencil (and all its submenus)
- Texture (in Compositor Nodes)

Pull Request: https://projects.blender.org/blender/blender/pulls/138870
2025-05-14 16:12:29 +02:00
Hans Goudey
a224ba806d Mesh: Rewrite face corner normals calculation
This PR intends to replace the current face corner normals calculation.
Compared to the existing code it has a few benefits:
- It's much easier to understand.
- It doesn't require edges, ideally helping to remove them from caches
  and eventually to make them optional.
- It is completely multithreaded using the vert to face map, which is
  already used for vertex normals and domain interpolation. The previous
  code has a significant single threaded portion that scales with the
  size of the mesh.
- Lower peak memory usage: It doesn't require a temporary edge to corner
  map, the corner to face map, or a corner domain sized bit vector.
- The code sorting corners around a vertex should be easy to reuse.
- It's over twice as fast. On a test file with custom normals I observe
  an overall FPS increase of 2.56x, from 37 to 95.

Pull Request: https://projects.blender.org/blender/blender/pulls/138013
2025-05-14 15:35:48 +02:00
Jacques Lucke
4d2aa7d828 Fix #138769: crash when baking
The issue appears to have been that the same depsgraph is evaluated twice at the
same time. Once by the bake code in a background thread and once by gizmo
related event handler.

This patch fixes it by not running event handlers in locked regions. Generally,
accessing evaluated data while the interface is locked (and thus some baking is
usually going on), is not safe.

Pull Request: https://projects.blender.org/blender/blender/pulls/138806
2025-05-14 15:19:29 +02:00
Jacques Lucke
c77b93f49d Nodes: use modifier's persistent UID in context and viewer path
Previously, the modifier name was used to identify it in a compute context or
viewer path. Using `ModifierData.persistent_uid` (which was only introduced
later) has two main benefits: * It is stable even when the modifier name
changes. * It's cheaper and easier to work with since it's just an integer
instead of a string.

Note: Pinned viewer nodes will need to be re-pinned after the change.

Pull Request: https://projects.blender.org/blender/blender/pulls/138864
2025-05-14 15:18:36 +02:00
Hans Goudey
153abc372e GPU: Replace U32/I32 combination with GPU_FETCH_INT_TO_FLOAT in UI code
The conversion from int to float is not supported natively
so it ends up happening beforehand on the CPU or as a
step before the vertex buffer can be used. It's better to just
upload floats in the first place.

Related to:
- 1e1ac2bb9b
- 617858e453

Pull Request: https://projects.blender.org/blender/blender/pulls/138855
2025-05-14 15:15:21 +02:00
Aras Pranckevicius
919d2693c0 Build: expand Visual Studio natvis file
Expand the natvis file (which VS IDE debugger uses to visualize custom
data types) to handle:
- blender::Map with pointer keys
- blender::Set with both regular and pointer keys

Pull Request: https://projects.blender.org/blender/blender/pulls/138866
2025-05-14 14:45:40 +02:00
Jacques Lucke
fdfd1de9a8 Fix: Geometry Nodes: empty expanded menu entries in modifier
Work around an issue with expanded menus that exists for a long time
already. I briefly tried fixing it, but does not seem straight forward unfortunately
without breaking stuff.

Also see the comment in `ui_item_enum_expand_exec`.
2025-05-14 14:04:15 +02:00
Campbell Barton
2bc284975b Refactor: remove the do_history argument from UV selection functions
Storing the selection history complicated the selection functions,
especially for situations when functions were called indirectly &
multiple times.

Remove the argument in favor of explicit calls to store elements
in the selection history.

Needed to avoid even more complexity with UV sync-select: see #131642.
2025-05-14 11:48:42 +00:00
Campbell Barton
7da0ecccce GHOST/SDL: support horizontal scroll events 2025-05-14 21:48:41 +10:00
Habib Gahbiche
7a013aa9a3 Compositor: Add Glare types to search menu
Expose glare types (bloom, ghosts, streaks, fog glow and simple star)
in the search menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/138839
2025-05-14 13:42:48 +02:00
Jacques Lucke
afd760f2b7 UI: Ghost: support horizontal scrolling for 2D editors
Some mice have an additional horizontal scroll wheel. This patch adds support
for receiving such events. By default it is used to scroll 2D editors left and right.

I originally developed this because I was missing it in the spreadsheet, but it
seems to be useful in many other editors too.

It's supported on Linux (Wayland), Windows and macos.

Pull Request: https://projects.blender.org/blender/blender/pulls/138758
2025-05-14 13:33:10 +02:00
Campbell Barton
d2bd988978 Fix build error, missing reference to INT_MIN
Prefer std::numeric_limits.
2025-05-14 21:26:39 +10:00
Aras Pranckevicius
9e4c26574a VSE: new cache implementation
Rework internals of how VSE caching is done. Primarily to make all the
caching logic more understandable from development point of view, but
also has several user visible implications (more details in the PR):
- Simpler and fewer caching UI options,
- Disk cache is gone (primary reason: proxies are kinda the same thing),
- VSE cache size set in preferences is actual size used for VSE caches
  now (previously caching stopped as soon as whole Blender used that
  much memory, even if some memory usage was not about VSE at all),
- Certain scenarios of cache invalidation are faster now.

Pull Request: https://projects.blender.org/blender/blender/pulls/137926
2025-05-14 12:59:46 +02:00
Pratik Borhade
4627e0d3d0 Fix #138168: Weightpainting: Smooth Operator does not respect locked flag
`BKE_object_defgroup_subset_from_select_type` does not consider locked
status of vertex group, ends up smoothing all vgroup when `deform pose bones`
is selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/138435
2025-05-14 11:42:15 +02:00
Jacques Lucke
6d9b9dd2c3 Refactor: Functions: extract user data to separate header
Previously, the `UserData` and `LocalUserData` classes were only supposed to be
used by the lazy-function system. However, they are generic enough so that they
can also be used by the multi-function system. Therefore, this patch extracts
them into a separate header that can be used in both evaluation systems.

I'm doing this in preparation for being able to pass the geometry nodes logger
to multi-functions, to be able to report errors from there.

Pull Request: https://projects.blender.org/blender/blender/pulls/138861
2025-05-14 10:54:28 +02:00
Jacques Lucke
4a50809daf Cleanup: Geometry Nodes: remove legacy type from socket item accessor
The use of legacy types is discouraged and it's easy to use the node idname in all cases here.

Pull Request: https://projects.blender.org/blender/blender/pulls/138858
2025-05-14 10:19:29 +02:00
Philipp Oeser
5a882c7628 Fix: FCurve Settings RNA paths incomplete
Fill the missing gaps by going over the action data until we find the
corresponding FCurve in Layer < Slots > Channebags > FCurves.
Channelbads have their `_path` function already, so we can piggyback on
that, just adding the proper FCurve index to the mix.

Part of #137407

Pull Request: https://projects.blender.org/blender/blender/pulls/137956
2025-05-14 09:15:44 +02:00
Campbell Barton
247d8183f8 Refactor: pass the select mode to EDBM_selectmode_set
Pass the new selection mode instead of setting the value in the
BMEditMesh, then calling set.

This makes it possible to compare with the current selection mode
(needed for UV sync select #131642).
2025-05-14 11:26:58 +10:00
Clément Foucault
5fc8d4f759 Fix: GPU: Broken tests
These tests were hitting an assert about
invalid format. They were testing for this
legacy format we don't support anymore.

# Conflicts:
#	source/blender/gpu/vulkan/tests/vk_data_conversion_test.cc
2025-05-13 19:50:49 +02:00
Hans Goudey
1e1ac2bb9b Fix: Various asserts when creating GPU vertex formats
Caused by 617858e453.

These formats should use types aligned to 4 bytes. That's generally
required by modern GPUs. Uploading with these types also avoids
automatic conversion by the Vulkan backend which is something
we're hoping to remove fully.

In the end this PR removes a bunch of code related to supporting
the older single-byte formats.

Pull Request: https://projects.blender.org/blender/blender/pulls/138836
2025-05-13 19:07:01 +02:00
Guillermo Venegas
3b1e123361 Refactor: UI: Replace uiItemS and uiItemS_ex with uiLayout::separator
This merges the public `uiItemS` and `uiItemS_ex` functions into an
object oriented API (`uiLayout::separator`), matching the python API.
This reduces the difference between the C++ API with the python version,
its also helps while converting code from python to C++ code
(or vice-versa), making it almost seamless.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138826
2025-05-13 17:54:26 +02:00
Jacques Lucke
db7b5a480b Spreadsheet: make column widths editable
Currently, there are two main annoying problems with columns widths in the
spreadsheet:
* The initial column width is often too small. This is especially noticeable
  with the ID integer attribute.
* There is no way to change the column width.

This patch improves both of these aspects. The initial column width will now be
derived from the content of the spreadsheet. This initial width is then stored
in DNA to make it editable and to avoid having to recompute it on each redraw.
Furthermore, there is a new modal operator to change the width of a column.

Pull Request: https://projects.blender.org/blender/blender/pulls/138657
2025-05-13 17:47:02 +02:00
Jacques Lucke
55a831d134 Cleanup: Modifiers: rename function to draw modifier error message
The old name `modifier_panel_end` was not great because:
* There is no corresponding `*_begin`.
* It sounds more magical then it really is (it just draws the error message).
* It doesn't even have to be at the end as is sometimes the case when there are subpanels.

Pull Request: https://projects.blender.org/blender/blender/pulls/138797
2025-05-13 17:27:30 +02:00
Clément Foucault
617858e453 GPU: Unified DataFormat enum
This unifies vertex and texture data formats
into a single base enum class.

`TextureFormat` and `VertexFormat` then mask
the invalid format for their respective usage.

Having a base enum allows casting between
`TextureFormat` and `VertexFormat` possible
(needed for Buffer Textures).

It also makes it easier to write and read data
to buffers/textures as each format will have an
associated host type.

These enum is generated from MACRO expansion.
This allow to centralize all information about
the formats in one place. This avoid duplicating
the list of enums for each backend.

This only creates the new enum. Porting older enums will
be done in other PRs.

Normalized integer CPU format are missing and waiting for #130640

Rel #130632

Pull Request: https://projects.blender.org/blender/blender/pulls/138069
2025-05-13 17:08:32 +02:00
Clément Foucault
83a40ceae2 GPU: Shader Preprocess: Add support for BLI C++ vector functional swizzle
This allow to share more code between C++ and the shader
code base.

Pull Request: https://projects.blender.org/blender/blender/pulls/138820
2025-05-13 16:28:55 +02:00
Clément Foucault
90be031d6b EEVEE: Optimize Upfront specialization
Many of the upfront specialized variants
were not needed/ They are only used if
some scene render setting changes, which
we can detect upfront.

This is noticeable on OpenGL which doesn't support
specialization constant and has to do full shader
recompilation for each variants.

Pull Request: https://projects.blender.org/blender/blender/pulls/138589
2025-05-13 16:28:02 +02:00
Clément Foucault
4ab8267b7e Fix: EEVEE: Broken assert
Logic was flawed.
2025-05-13 16:19:31 +02:00
Clément Foucault
a13db5be47 Cleanup: EEVEE: Warnings tautological-constant-out-of-range-compare 2025-05-13 16:19:31 +02:00
Christoph Lendenfeld
9ee5196db7 Refactor: Remove PBONE_VISIBLE and EBONE_VISIBLE macros
No functional changes intended.

This just replaces all calls to `PBONE_VISIBLE` and `EBONE_VISIBLE`
with appropriate functions.
In the case of editbones it is just the function that the macro already contained.
For pose bones, a new function was added that mirrors what the macro had.

Using a function will make it easier to change how selection is queried in the future.

part of #138482

Pull Request: https://projects.blender.org/blender/blender/pulls/138819
2025-05-13 15:51:12 +02:00