Commit Graph

120055 Commits

Author SHA1 Message Date
Sean Kim
ab54e09556 Refactor: Move and replace Pose SCULPT_stroke_is_first_brush_step
* Localizes code to the pose.cc file
* Removes external visibility of no longer needed calls

Pull Request: https://projects.blender.org/blender/blender/pulls/138951
2025-05-15 23:07:40 +02:00
Sean Kim
563a00bd3f Refactor: Replace Cloth SCULPT_stroke_is_first_brush_step check
Pull Request: https://projects.blender.org/blender/blender/pulls/138950
2025-05-15 23:04:55 +02:00
Sean Kim
f831e211f4 Refactor: Move and replace Face Set SCULPT_stroke_is_first_brush_step
* Shift call to the Draw Face Set brush implementation as it is
  irrelevant for other brushes.
* Instead of checking for the first brush step, check to see if the
  value is still `SCULPT_FACE_SET_NONE`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138949
2025-05-15 23:03:42 +02:00
Sean Kim
0514789737 Refactor: Replace Enhance Details SCULPT_stroke_is_first_brush_step
Pull Request: https://projects.blender.org/blender/blender/pulls/138948
2025-05-15 22:58:39 +02:00
Harley Acheson
755336b17f Fix #138832: Panel Category Background Out By One Pixel
The drawing of the background of panel categories is out by one pixel,
but was covered by the area borders until recently. This PR just draws
one pixel more to the edge.

Pull Request: https://projects.blender.org/blender/blender/pulls/138956
2025-05-15 22:42:23 +02:00
Guillermo Venegas
89a3478e35 Refactor: UI: Replace uiItemMenuF and uiItemMenuFN with uiLayout methods
This converts the public `uiItemMenuF` and `uiItemMenuFN`
functions to an object oriented API (an `uiLayout::menu_fn`
and `uiLayout::menu_fn_argN_free` respectively), following
recent uiLayout changes.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/138902
2025-05-15 21:26:49 +02:00
Jacques Lucke
5a449439ef Refactor: BLI: simplify compute context hash generation and make it lazy
Currently, there was a lot of boilerplate to compute the compute context hash.
Now, the complexity is abstracted away to make it a simple function call.

Furthermore, this makes the compute context hash generation lazy. The goal here
is to make it very cheap to construct the compute context hash in the first,
while making it a little bit more expensive (still quite cheap overall) to
access the hash when any data has to be logged. This trade-off makes sense when
we want to pass the compute context to more lower-level places in order to be
able to create better error messages with more contextual information. For
example, we'd want to create error messages during multi-function evaluation
which happens during field evaluation within a node.

Pull Request: https://projects.blender.org/blender/blender/pulls/138912
2025-05-15 21:18:23 +02:00
Jacques Lucke
734e3c5589 Spreadsheet: support double click to fit column width
This implements a new operator that automatically fits the width of a column to
its content. It's triggered by double-clicking on the column edge in the header
row. This is common functionality in other spreadsheet software.

Pull Request: https://projects.blender.org/blender/blender/pulls/138924
2025-05-15 20:57:37 +02:00
Jacques Lucke
578f935170 Nodes: support changing attached frame while transforming nodes
Currently, removing a node frame a frame is rather annoying. The `alt+P`
shortcut is hard to reach and probably not very intuitive. Furthermore, often
one only notices that one wants to remove a node from a frame after starting to
move the node. So one would have to put the node back down, detach it from the
frame and then start moving again.

This patch simplifies this entire process by adding a new shortcut that can be
used while dragging nodes. When `F` is pressed, the selected nodes are detached
from their parents. Alternatively, if the nodes are detached already, they may
be attached to the frame under the cursor.

Pull Request: https://projects.blender.org/blender/blender/pulls/138650
2025-05-15 20:54:29 +02:00
Hans Goudey
cbcf421db7 Cleanup: Draw: Use StringRef for attribute names
Avoid the need to measure string length potentially many times.
2025-05-15 14:53:51 -04:00
Jacques Lucke
8ec093a2d8 Nodes: new operator to simplify adding named frames
Currently, the steps required to add a named frame in the node editor are quite
cumbersome:
* Press ctrl+J, which is hard to reach.
* Press F2, to rename.

This is bad, because frames are a key part of making node trees understandable.
Therefore, we should lower the barrier to adding them as much as possible.
Additionally, named frames help significantly more with readability. Therefore,
it's good to lower the barrier to adding those even more. Of course it's still
possible to click in empty space to avoid having to give a frame a name.

This patch adds a new operator to join nodes in a named frame. When triggered,
it adds the frame and automatically opens the rename menu to set the name.

Keymap changes:
* Remove `ctrl+J` which was creating a frame without label.
* Move existing functionality of `F` key to `J` key
  (including `shift+F -> shift+J`).
* Use `F` for this new operator to create a named frame.

Pull Request: https://projects.blender.org/blender/blender/pulls/138390
2025-05-15 20:51:54 +02:00
Hans Goudey
760cf70d63 Draw: Use VectorSet for generic attribute requests
Replace `DRW_Attributes` with a VectorSet of std::string. The max number of
attributes is still the same. The inline buffer size is 4, and std::string's inline
buffer is smaller than the previous char array size of 64, but it seems
reasonable to save those optimizations for shorter attribute names and
fewer attributes. In return we significantly decrease the size of the batch
caches, simplify the code, and remove the attribute name length limit.

I observed roughly an 8% increase in the 30k cube objects file, a change from
12 to 13 FPS. I'm guessing this is mostly because `VectorSet<std::string>` is
smaller than `DRW_Attributes`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138946
2025-05-15 20:43:31 +02:00
Sergey Sharybin
a3748b549b Fix #138868: Slow start up on when using certain OCIO config
Regression caused by #138433

Somehow the lazy nature of the is_linear and is_srgb got lost in
the refactor and the fields were greedily initialized on startup
and it is not a cheap operation.

Pull Request: https://projects.blender.org/blender/blender/pulls/138945
2025-05-15 20:26:02 +02:00
Sean Kim
906a27bdb2 Fix #138887: Clay Strips brush ignores automask settings
Caused by 33bef53c3e

The change to return an empty IndexMask early from the clay strips brush
breaks some previous assumptions about data flow. To fix this, and
improve the overall resilance of related code to such changes, avoid
checking for a specific stroke step when initializing this data and
delay it in processing until needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/138921
2025-05-15 20:11:42 +02:00
Clément Foucault
97a1e1501b DRW: Add a new GPU context for rendering preview jobs
This avoid stalling the viewport when a preview job is running.
This is because both were fighting for the same GPU context.

This doesn't remove the blocking but allows to remove it using #136991.

Pull Request: https://projects.blender.org/blender/blender/pulls/138882
2025-05-15 20:09:37 +02:00
Brecht Van Lommel
a94a911e10 Fix: Slow USD import with certain OpenColorIO configs
As evidenced by #138868, checking all colorspaces to see if they are sRGB
can be very slow, due to loading all LUTs into memory. Instead use a simpler
check by a list of names only, which is still better than the hardcoded
single name used in Blender 4.4.

Ideally recent configs will use the ColorInterop Forum alias so we can
find the sRGB colorspace reliably.
2025-05-15 19:33:37 +02:00
Hans Goudey
011b3f5cb3 Cleanup: Remove unused field from mesh draw batch cache 2025-05-15 13:14:47 -04:00
Michael B Johnson
af0cfcb01c MaterialX: Export Principled BSDF as OpenPBR Surface
Switch from Standard Surface to OpenPBR as the exported MaterialX surface,
since this is the new standard more renderers are adopting and it more closely
matches the Principled BSDF implementation.

Anisotropy support is improved though still not quite the same, as formulas
are different. Nodes are generated to apply anisotropic rotation to the
tangent vector, as there is no corresponding parameter in OpenPBR.

Fixes #138164

Authored by Apple: Lee Kerley

Pull Request: https://projects.blender.org/blender/blender/pulls/138165
2025-05-15 19:13:36 +02:00
Sybren A. Stüvel
54a7b0bc61 Fix: crash when determining RNA data path of driver F-Curve
The F-Curve RNA path function assumed that the F-Curve would be owned by
an Action, which is not the case for drivers, NLA control curves, and
potentially other "free-floating" F-Curves.

This is now checked for, and if the owner is not an Action, the function
refuses to produce a data path. In the future this could be extended to
search through the aforementioned places as well.
2025-05-15 16:32:15 +02:00
Hans Goudey
b13bdcfaeb Fix #138910: Crash with sculpt mode and "Texture" shading type
Using the wrong `std::string` constructor through an alias, oops..
2025-05-15 10:13:34 -04:00
Habib Gahbiche
df6e65dd93 Compositor: add viewer node to the default node tree
Users almost always need a viewer node, so add one to the default node
tree.

Note that the backdrop is already enabled by default, so the backdrop
image will be visible as soon as a render is available (no need to
manually add viewer node or click `cltr+shift+LMB` to show a backdrop
image.

Pull Request: https://projects.blender.org/blender/blender/pulls/138890
2025-05-15 16:08:19 +02:00
Hans Goudey
91627b3d47 GPU: Remove int float fetch mode combination
This commit finishes removing the uses of the integer to float
vertex buffer fetch mode. Previous commits noted below already started
that process. The last usage was geometry attributes. Now integers are
converted to floats as part of the existing upload process.

The change makes the Vulkan vertex buffer type conversion unused, so
it's removed. That's nice because Vulkan vertex buffers go from 1040 to
568 bytes in size and have significantly less overhead on creation.

Related:
- 153abc372e
- 1e1ac2bb9b
- 617858e453

Pull Request: https://projects.blender.org/blender/blender/pulls/138873
2025-05-15 15:29:12 +02:00
Habib Gahbiche
eaa1e34eca Compositor: improve default node position
The node tree is partially covered by default. This patch updates the
position of the nodes to a better default.

Pull Request: https://projects.blender.org/blender/blender/pulls/138889
2025-05-15 15:13:19 +02:00
Pratik Borhade
3c726aaa6b Fix: Grease Pencil: Check lock status in assign/remove vgroup API
Skip editing vertex group from `vertex_group_assign/remove` API call
of GreasePencilDrawing, when vgroup is locked. Noticed this while
reviewing !127216

Pull Request: https://projects.blender.org/blender/blender/pulls/138932
2025-05-15 14:53:44 +02:00
Nathan Vegdahl
8a984f4f4e Anim: Add "replace" mix mode to the Action Constraint
The available mix modes on the Action Constraint only allowed
*combining* the Action's transforms with the input transforms, but
unlike most other constraints lacked a way to completely
override/replace those transforms.

This PR adds a "Replace" mix mode to the Action Constraint, bringing it
in line with most of the other constraints already in Blender.

![action_constraint_replace_mode_screenshot.png](/attachments/51fb09d6-0a87-42dc-a75e-9ae81c856796)

----

Test file: [action_constraint_replace_mode.blend](/attachments/fc3417a8-b60a-4212-9840-5b59191e9ed9)

- The small bone at the top is the action constraint target (translating it right-left triggers the action constraint).
- Both two-bone chains are set up with action constraints.  The base bones of each chain additionally have a copy location constraint to the small sideways bone, placed before the action constraint in their constraint stack.
- The chain on the left has the default mix mode, which allows you to manipulate the bones on top of what the action constraint does, and allows the copy location constraint on the base bone to work.
- The bones on the right have the new "Replace" mix mode, and therefore manipulating them does not affect the final constrained transformation, and the copy location on the base bone is overridden by the action constraint.

Pull Request: https://projects.blender.org/blender/blender/pulls/138316
2025-05-15 14:30:01 +02:00
Jacques Lucke
e4e49e1634 Nodes: don't jump viewer node if it's still visible
The goal is to make the viewer node jump less often because each unnecessary
jump feels annoying. Previously, we already had a heuristic that would disable
the jumping if the new viewer location was further away than the old one. Now
the viewer never jumps when it's still visible in the node editor and already to
the right of the node-to-view.

As a byproduct this also fixes an issue where the initial viewer position does
not work properly, because the node does not have known draw-bounds yet.

Pull Request: https://projects.blender.org/blender/blender/pulls/138744
2025-05-15 12:11:07 +02:00
Jeroen Bakker
1c72dca726 Cleanup: Remove unused code 2025-05-15 12:00:09 +02:00
Jeroen Bakker
3b3cab471a Fix #138843: Vulkan: Swapchain issues
- Reduce artifacts during resizing to also recreate the swapchain
  when acquire image is suboptimal
- Do not stretch when backbuffer and swapchain have a different size

Pull Request: https://projects.blender.org/blender/blender/pulls/138925
2025-05-15 11:57:44 +02:00
Falk David
c07dfca81a Cleanup: Grease Pencil: Simplify get_bone_mat utility function 2025-05-15 11:41:35 +02:00
Jeroen Bakker
74e244d9b7 Fix: Vulkan: memory leak when rendering animations
Always discard the context discard pile even when not submitted
When rendering animation it is not guaranteed that the submission
flag will ever be set.
2025-05-15 09:06:37 +02:00
Jeroen Bakker
4365a0015f Vulkan: Add render discard pile to debug
Recently we introduced a new discard pile, but it wasn't
reported inside the debug information.
2025-05-15 09:06:37 +02:00
Omar Emara
499dcc3ae2 Compositor: Avoid clamping after HSVA conversion
This patch avoid clamping HSVA colors after being combined using a
Combine HSVA node in the GPU compositor. This is consistent with the CPU
compositor and other node editors.
2025-05-15 09:58:32 +03:00
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
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