Commit Graph

120055 Commits

Author SHA1 Message Date
Jeroen Bakker
41a69b76a6 Partial Fix #129592: Vulkan: Add support for line size
Add-ons can call a batch draw command for lines using a surface shader.
This is not intended and polylines shaders should be used. This PR
lighten this restriction to automatically replace the shader with the
correct polyline shader, similar to immediate mode.

This change is done inside the python wrapper as internally we should
use the correct polyline shader.

For point shaders we don't have a work around in place and that needs
more discussion. Therefore this is only a partial fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/138138
2025-05-01 15:44:40 +02:00
Mattias Fredriksson
b028384749 Cleanup: Pass pointer to get_item_as()
Overloaded version for utility function `get_item_as()` taking a pointer
as an argument (rather then reference) performs type verification,
avoiding the additional manual check.

Pull Request: https://projects.blender.org/blender/blender/pulls/138067
2025-05-01 15:40:14 +02:00
Habib Gahbiche
90ea4f88f3 Refactor: Use test fixtures and C++ style initialization
Initiliaze global context only once per test suite. Test data relevant
to the respective tests is still allocated and freed with every test
case.

Also, `scene->nodetree` will be deprecated in a future PR, so use
`material->nodetree` to test embedded trees instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/137895
2025-05-01 15:37:26 +02:00
Omar Emara
4d0a70f638 Compositor: Remove unused Defocus node options
This patch marks the Preview and Threshold options as deprecated and
removes them from the UI. They have been unused since 4.3.
2025-05-01 15:59:43 +03:00
Omar Emara
a31dcdf5b5 Compositor: Remove Variable Size blur option
This patch removes the Variable Size blur option from the Blur and Bokeh
Blur nodes. So now, whatever the user connects to the size input will be
used, be it variable or constant.

The option previously could be used to force the node to ignore variable
size inputs and assume a size of 1, so it was useless.

Versioning would be difficult, as we don't know if incoming links to the
size input is variable or single. So this is a breaking change. But I
can't think of a real reason why the user might use this option, so this
seems safe from a practical point of view.

Pull Request: https://projects.blender.org/blender/blender/pulls/138261
2025-05-01 14:58:10 +02:00
Philipp Oeser
a5967aae81 Fix #138177: Wrong rearranging channel groups in the Dope Sheet
Similar to !138193

We are going over the `bAnimListElem` nested / multiple times:
- once in `animchannels_rearrange_exec`
- then again in `rearrange_layered_action_channel_groups`

So we are basically just rearranging **multiple times** (unnecessarily
for unrelated actions)

So to resolve, pass the current action to
`rearrange_layered_action_channel_groups`, then skip `bAnimListElem` if
its action does not match the action passed in.

Pull Request: https://projects.blender.org/blender/blender/pulls/138196
2025-05-01 14:20:32 +02:00
Sybren A. Stüvel
781e15671b Fix #138177: Wrong rearranging channel groups in the Dope Sheet
Fix an issue where rearranging animation channels ("Move Up", "Move
Down", etc.) would take multiple steps. This was caused by the Action of
these channels being visited multiple times, and each visit taking a
step.

Pull Request: https://projects.blender.org/blender/blender/pulls/138257
2025-05-01 14:14:37 +02:00
Lukas Tönne
ed93044f70 Fix #138206: Pasting nodes is ignoring offset for frame children
The copy/paste function for nodes is offsetting the node centroid to the
mouse cursor. This was skipping direct children of selected frames, because
the node position was originally relative to the frame parent. This behavior
changed in 4bf34d95, which causes child nodes to remain stuck at their
original location.

All nodes should simply be offset now, since their positions are no longer
relative.

Pull Request: https://projects.blender.org/blender/blender/pulls/138252
2025-05-01 13:41:47 +02:00
Hans Goudey
2894fd79d4 Vulkan: Inline small data conversion function
In a profile of sculpting with the Vulkan GPU backend enabled,
This function made up 0.7% of samples. Since it's just a single
comparison, inlining it should be helpful for the compiler.

Pull Request: https://projects.blender.org/blender/blender/pulls/138210
2025-05-01 13:37:36 +02:00
Campbell Barton
e1e0c041cf Fix: incorrect peak sharpen calculation with the ocean modifier
The initial port [0] incorrectly use `sqrt` where `sqr` was used in the
original code. This mistake was made in two places but the second
causes a significant change in behavior, so this has been left as is
noting the difference in a comment.

Resolve the following issues:

- Use square instead of sqrt when calculating the peak value,
  besides following the original implementation it avoids the result
  being NAN when "Fetch" is below 30.

- Pass in `sqrt(m_omega)` matching the `omega` argument to
  `alpha_beta_spectrum` as well as following the upstream code.

In most cases the user visible changes are subtle.

Ref !137607

Co-authored-by: Nicolas Paris <nicolas.paris490@gmail.com>

[0]: 6ce709dceb
2025-05-01 11:04:45 +00:00
Sybren A. Stüvel
2e0a8ea027 Fix: memory leak when rearranging animation channels
Fix a memory leak when moving animation channels up/down.

Pull Request: https://projects.blender.org/blender/blender/pulls/138256
2025-05-01 12:38:39 +02:00
Philipp Oeser
4c7c26440a Fix #138162: Crash rearranging ungrouped channels the Dope Sheet
This happend to ungrouped channels and in the case other Actions are
also visible in the Dopesheet (e.g. by having multiple objects
selected).

We are going over the `bAnimListElem` nested / twice:
- once in `animchannels_rearrange_exec`
- then again in `rearrange_layered_action_fcurves`

The inner workings are tied to specific actions from the first loop, but
we are going over FCurves possibly contained in **other** actions in the
second loop. Doing this with the "wrong" action goes wrong (e.g. in
`get_group_or_make_fake` where we try to get a channelbag for an FCurve
slot handle in the "wrong" action).

So to resolve, skip `bAnimListElem` if its action does not match the
action passed into `rearrange_layered_action_fcurves`

Pull Request: https://projects.blender.org/blender/blender/pulls/138193
2025-05-01 12:29:35 +02:00
Nathan Vegdahl
30698cf885 Fix #137932: compute correct armature bounds
There were actually two issues here:

1. The dimension reported for armatures were often wildly incorrect,
   including negative values and zero!
2. The dimensions reported for objects are supposed to be invariant with
   rotation, representing the dimensions along the object's local axes.
   However, armature objects' reported dimensions changed with rotation.

The respective causes were:

1. `BKE_armature_min_max()` was using an incorrect formula (acknowledged
   in a comment) for transforming the bounding box between spaces. This
   worked fine for some of the places that `BKE_armature_min_max()` was
   called, since they just reverse the transform using the same(!)
   erroneous formula, but it didn't work for others.
2. `BKE_armature_min_max()` first computed the bounds in world space,
   and then transformed them into object space, rather than computing
   them in object space directly like the respective functions for other
   object types. Even when done correctly, this causes the reported
   dimension to vary with rotation.

This PR fixes these issues by simply computing the armature bounding box
in object space directly instead.

There is one place in the code base that was directly using the
world-space bounds: `view3d_calc_minmax_selected()`. However, for every
object type other than armatures, it takes the object-space bounds and
transforms them (with an incorrect formula!) to world space.  So this PR
also changes `view3d_calc_minmax_selected()`'s armature code to do the
same, except with a correct formula.

Note that the reason for using the correct transform formula (departing
from other object types) is that the world-space bounds for armatures
were already correct prior to this PR due to being computed in that
space. Therefore using the incorrect formula has the potential to
introduce regressions in this case.

Pull Request: https://projects.blender.org/blender/blender/pulls/137961
2025-05-01 12:25:52 +02:00
Sybren A. Stüvel
a3b8ea843c Anim: Add 'unshare' node to driver evaluation dependency graph
Add a new node to the dependency graph, to act as a single entry point
before drivers are evaluated in parallel.

The node will take all the driven RNA properties, and write their
current value to the property again. This ensures that any implicitly
shared data is copied to ensure writability. Subsequent concurrent
writes by the driver evaluation will then be safe, as the
thread-unsafe part has already been performed.

Fixes: #132423

Pull Request: https://projects.blender.org/blender/blender/pulls/135802
2025-05-01 11:49:21 +02:00
Habib Gahbiche
987fc14ada Cleanup: simplify logic in node tree iterator
Return separately for each node tree type.

This patch originally started as a refactor to change the logic of
iterating through compositing node trees but we ended up choosing
a different solution so only the small cleanup part is submitted here.

Pull Request: https://projects.blender.org/blender/blender/pulls/138205
2025-05-01 11:08:13 +02:00
Habib Gahbiche
5c801a7600 Cleanup: Initialize memory of default materials
Pull Request: https://projects.blender.org/blender/blender/pulls/138219
2025-05-01 10:58:24 +02:00
Omar Emara
510130de07 Compositor: Turn Bilateral Blur options to inputs
This patch turns the options of the Bilateral Blur node into inputs.

In the process, the Sigma Space and Iterations were joined into a single
Size input, previously they were just added together then ceiled to get
the blur size. Furthermore, Sigma Color was renamed to threshold and now
represents the average color difference, not the sum, so it was
previously multiplied by 3.

Versioning and RNA compatibility is not perfect due to joining the two
size options.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138249
2025-05-01 09:57:57 +02:00
Jordan Henshaw
10113a119e UI: Add missing periods to Overwrite file dialogue message
The paragraph message in the Overwrite File dialogue is missing periods.
Now added in this PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/127953
2025-05-01 08:46:02 +02:00
Sergey Sharybin
d568b78717 GPU: Add immediate drawing of textured rectangle
New function called immRectf_with_texco(), which resides next to the other
immRectf utilities.

Currently used in a single place in the sequencer, but it will be used in
a few other places in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/138222
2025-05-01 08:40:18 +02:00
Jesse Yurkovich
4a0391c4a1 Cleanup: USD: Shrink the USDPrimReader base class
Shrinks the USDPrimReader base class by 24 bytes
- Uses `StringRefNull` in place of a full `string` (prevents additional
  runtime allocations)
- The `prim_path` field is only used sparingly, mostly for tracing, and
  a few non-perf-critical paths. No use keeping it around when it's
  easily, and quickly, accessible through other means.

Pull Request: https://projects.blender.org/blender/blender/pulls/138232
2025-05-01 06:30:55 +02:00
Campbell Barton
2f2d26fc54 Cleanup: use float2 for wmTabletData::tilt & PaintStroke::tilt 2025-05-01 12:51:55 +10:00
Campbell Barton
c3692c7008 Cleanup: use int2 for pointer location & 3D snapping functions
Use the term `mval` as these values are region relative,
which wasn't so clear.
2025-05-01 12:39:46 +10:00
Campbell Barton
a37f2014fd Cleanup: sort CMake file lists 2025-05-01 12:16:00 +10:00
Campbell Barton
43af16a4c1 Cleanup: spelling in comments, correct comment block formatting
Also use doxygen comments more consistently.
2025-05-01 11:44:33 +10:00
Harley Acheson
89ad52b22a UI: Enum Tooltip Item Order
Tooltips for enum items currently show the enum name on one line, then
enum description, then the current value's name, then the value's
description on the next line. This PR changes that to display the
(short) names together then the (longer) descriptions together. This
also adds a small amount of padding under the title.

Pull Request: https://projects.blender.org/blender/blender/pulls/137571
2025-05-01 00:50:34 +02:00
John Kiril Swenson
2ab59859c9 Cleanup: VSE: Replace remaining seq and sequence references
Ref: #132179

Renames:
- `Editing.act_seq` -> `Editing.act_strip`
- `SequenceModifierData` -> `StripModifierData`
  - Its member `mask_sequence` is now `mask_strip`.
- `MetaStack.parseq` -> `MetaStack.parent_strip`
- Remaining function names/parameters that were not dealt with in #132748
- Various references to `seq` or `sequence` throughout code and docs when
  referring to a strip

Also moves `_get` to the end of the renamed function names where
applicable for standardization (unless "by" or "from" are used).

There should be no changes to current behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/138077
2025-05-01 00:22:04 +02:00
Richard Antalik
4c9e06066b Fix: VSE: Adding standalone effect was linked to selected strip
Caused by recent refactor of strip input querying in #136474.
This caused `Strip::seq1` to be set even if effect strip has no inputs.

Fix was applied to `vse::strip_effect_get_new_inputs`, so it is less
confusing during debugging, but also to `seq::add_effect_strip`, as
I think, that core function should never produce invalid strip.

Pull Request: https://projects.blender.org/blender/blender/pulls/138016
2025-04-30 23:37:00 +02:00
Hans Goudey
ec33994c62 Cleanup: Remove unused VertBuf::duplicate() function
This is completely unused, not implemented for the Vulkan backend, and
seems to add quite a bit of complexity to the Metal and OpenGL backends.
It was added for EEVEE legacy motion blur, and the last use was removed
along with EEVEE legacy. We're probably better off not maintaining it since
we should avoid duplicating vertex buffer data anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/138226
2025-04-30 22:35:47 +02:00
Miguel Pozo
d3f3dc4d72 Fix: Overlay: Material Preview when !bl_use_eevee_viewport 2025-04-30 20:46:00 +02:00
Hans Goudey
12e626f31f Shape Keys: Add operator to update keys from selected objects
This operator is very similar to the existing "Join as Shapes" operator,
which updates or adds shape key array values with the positions of
objects with the same name, but instead of creating new shape keys,
it just updates existing ones. The new operator is called "Update from
Objects" in the UI.

Internally, some logic was moved to a poll function shared between the
two operators, and a new argument for whether to ensure keys exist was
added to their shared implementation.

Part of #135095.

Pull Request: https://projects.blender.org/blender/blender/pulls/136853
2025-04-30 20:07:25 +02:00
Michael B Johnson
79c318f692 Fix #137973: Add MaterialX version info on USD export
This change adds MaterialX version information to the exported MaterialX
USD materials.

Details:

In USD 25.02, the MaterialXConfigAPI schema was introduced to allow
recording the MaterialX version used to author a material. When loading
MaterialX documents into USD, this schema is automatically applied and
the associated version attribute is created on the material.

Due to how the MaterialX export works (via copying the composed
MaterialX spec from a temporary stage), the MaterialXConfigAPI needs to
be explicitly applied to the final material being exported.

This change applies this MaterialXConfigAPI schema and copies the
version attribute from the temporary MaterialX stage to the final stage.

Authored by Apple: Dan Knowlton

Co-authored-by: Dan Knowlton <d_knowlton@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/137974
2025-04-30 19:54:17 +02:00
Hans Goudey
2037145e43 Fix: Broken VectorSet move construction after recent change
Caused by a2fac05e9d.
Like the move constructor for `Vector`, all the template arguments must
be specified for the compiler to pick the move constructor over the copy
constructor when the defaults aren't used. We can test this with a non-
moveable type like unique_ptr.

Pull Request: https://projects.blender.org/blender/blender/pulls/138215
2025-04-30 18:51:33 +02:00
Habib Gahbiche
439e65c77c Tests: add tests for node tree iterator
This is a preparation for a small cleanup to the node tree iterator, see
https://projects.blender.org/blender/blender/pulls/138205

Pull Request: https://projects.blender.org/blender/blender/pulls/138195
2025-04-30 18:36:23 +02:00
Clément Foucault
60d01f9c29 Fix: EEVEE: Missing shadows in render tests file on Mac
There seems to be a synchronization issue with the
non-workaround version of texture atomics on macos.

This fixes some other broken test from #138147
2025-04-30 16:33:09 +02:00
Clément Foucault
64399ddfcd Fix: EEVEE: Missing shadow update during light baking
This is the root cause of the non-deterministic behavior of
light baking. The shadow system was not given enough update
iteration to fully render all tiles of the Virtual shadow maps.

This would resulte in missing tiles inside the bakes.
The value of the tiles seems to have been implementation
dependant, which, on some implementation created light leaks.

This fixes some recent regressions on the MacOS builbot tests.

This is candidate for backporting to 4.2.

Fix #138147

Pull Request: https://projects.blender.org/blender/blender/pulls/138203
2025-04-30 16:32:43 +02:00
Aras Pranckevicius
9315af2170 Fix: some cases of bone scale were not handled correctly in new FBX importer
- Was not consistently adjusting for bone adjust_post_scale
- Map fbx node "igore parent scale" to Blender bone "inherit scale: none"

Pull Request: https://projects.blender.org/blender/blender/pulls/138204
2025-04-30 16:03:00 +02:00
Philipp Oeser
8409a5081b Fix #137998: Crash calling editmode_toggle overriding view_layer.objects.active
If the viewlayer active object was set to None, editmode toggle poll
would still be permissive (it checked `CTX_data_active_object`, exec was
checking `BKE_view_layer_active_object_get`...)

These two need to be in sync.

For this PR, just go with `BKE_view_layer_active_object_get`...

NOTE: other mode switching operators seem to have the same "problem".
Pull Request: https://projects.blender.org/blender/blender/pulls/138083
2025-04-30 15:54:27 +02:00
Philipp Oeser
1ae6d13b5f Fix #138178: Grease Pencil strokes loose vertexgroups after Re-Arrange
Caused by 9d13e39585

Compared to meshes (which in that commit did a
`BKE_mesh_copy_parameters_for_eval` on the new Mesh
[mesh_new_no_attributes] -- this includes copying `vertex_group_names`)
Curves were missing that.

Now added.

Pull Request: https://projects.blender.org/blender/blender/pulls/138202
2025-04-30 15:34:45 +02:00
Omar Emara
f216b3ca62 Compositor: Turn Directional Blur options to inputs
This patch turns the options of the Directional Blur node into inputs.

In the process, the node now allows scaling down, not just scaling up.
The transformation options were renamed to Translation, Rotation, and
Scale as opposed to Distance, Spin, and Zoom. Finally, scaling is now
defined as a scale instead of a delta. So 1 is identity, 2 means scale
up two times, and so on. While previously, 0 was an identity scale, 1
means scale up by two types.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138198
2025-04-30 14:40:13 +02:00
Sergey Sharybin
6ff0726ef2 Refactor: const-correctness in GPU viewport
Make GPU_viewport_colorspace_set() const-crrect w.r.t view_settings.

Instead of doing in-place modifications of the view_settings argument
with restoring them later introduce new function for copying view
settings which keeps curve mapping unchanged in the destination.

Should be no functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138189
2025-04-30 14:03:26 +02:00
Clément Foucault
4c4c21df76 DRW: Debug: Change debug scope to debug group
These are not the same. Debug Scope are for scoped
capture. These should be static to avoid flooding
debug tools with scopes. Since this code is
unlikely to be debugged, it is better to use
debug groups.
2025-04-30 13:40:27 +02:00
Campbell Barton
e8f1473da6 Refactor: add "filepath" property to CollectionExport to avoid hacks
Fixes for #137856 & #137507 were workarounds to ignore the
PROP_PATH_SUPPORTS_BLEND_RELATIVE for CollectionExport however they
were error prone - especially #137856 as it relied on the surrounding
buttons.

Instead of adding logic to ignore the flag for this specific case,
add a property to the CollectionExport which can have it's flags
and use this instead of the operators "filepath" property.

Internally this wraps the same IDProperty data used by the operator.

Ref !137883
2025-04-30 11:15:38 +00:00
Clément Foucault
0dba80c89c GPU: Add reserved GLSL keywords to C++ stubs
This avoid using them in our shader codebase.
2025-04-30 12:47:00 +02:00
Clément Foucault
82dd9f68a4 Fix: Overlay: Compilation error on OpenGL
Caused by reserved `active` keyword in GLSL.
2025-04-30 12:44:00 +02:00
Damien Picard
a4669e3a8f Fix: Bring back UI translation of node header labels
Translation of node header labels was removed in cleanup
commit 02281dd26a, likely by mistake.

Issue reported by Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/138052
2025-04-30 12:29:00 +02:00
Omar Emara
7a6acfac62 Compositor: Turn Sun Beams options to inputs
This patch turns the options of the Sun Beams node into inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/138184
2025-04-30 11:46:36 +02:00
Pratik Borhade
3b9c03bb9b Fix: Add SequenceCache read-attributes flag to defaults
Include `MOD_MESHSEQ_READ_ATTRIBUTES` flag to defaults. Also in
`MOD_MESHSEQ_READ_ALL`

Continuation of !132475

Pull Request: https://projects.blender.org/blender/blender/pulls/138110
2025-04-30 11:04:31 +02:00
Clément Foucault
7714998537 Overlay: Remove macros for globals uniform buffer access
Pull Request: https://projects.blender.org/blender/blender/pulls/138068
2025-04-30 09:55:52 +02:00
Clément Foucault
cac80a9e3c Cleanup: Overlay: Rename GlobalsUboStorage to UniformData 2025-04-30 09:55:48 +02:00
Clément Foucault
6c4b410d3e Cleanup: Remove unused draw_common_shader_shared.hh 2025-04-30 09:55:48 +02:00