Commit Graph

152696 Commits

Author SHA1 Message Date
Sergey Sharybin
e4fc33adfc Fix #143775: Cryptomatte: Precision issues with matte output
The issue has been introduced in 7ceb4495c5 by missing implementation
of the is_noop() callback for the CPU processor.

While it was not noticeable perceptually, an exact floating point value
might have changed due to un-premultiplication+premultiplication.

The fix needs to be ported to the Blender 4.5 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/143998
2025-08-05 14:08:08 +02:00
Omar Emara
34ccb88921 Fix: Viewport compositor passes does not work with Group Input
The Group Input node can not access viewport compositor passes, this is
because EEVEE only considered render layers node. This fixes that by
also taking root group input nodes into consideration.

Pull Request: https://projects.blender.org/blender/blender/pulls/143996
2025-08-05 13:42:43 +02:00
Bastien Montagne
0d2295a538 Fix (unreported): Compositor Cryptomate could crash in some cases.
Cryptomate's init process would access the scene's viewlayers even when
`build_meta_data` was false - and the `CryptomatteSession` constructor
would only ensure valid viewlayers if `build_meta_data` is `true`.

Triggered in a complex setup (BCon25 app template), but suspect this was
reproducible when the compo node tree is used in a non-active scene.
2025-08-05 12:33:25 +02:00
Falk David
b833b9daac Fix: VSE: Wrong context used when dropping audio files
The `start_audio_video_job` function was using `CTX_wm_window`
and `CTX_data_sequencer_scene` which shouldn't be populated when
the callback is called.
The reason for this is that this callback is executed once on drag enter,
but there isn't a vaild context at that moment.

The fix removes the use of the context functions since we don't need
the context members. The window was always `nullptr` anyway and the
`scene` was just _a_ scene, but not necessarily the correct one.
For audio files, we need the scene framerate to compute `strip_len`
which is used to draw a temporary strip in the VSE timeline.
But instead of computing the `strip_len` on drag enter, we compute
it on the fly when drawing the temporary strip since we have the
right context then.

Pull Request: https://projects.blender.org/blender/blender/pulls/143981
2025-08-05 12:27:54 +02:00
Pratik Borhade
58d078fa3d UI: Tree View: Rename with F2
Luckily operator to rename already exists `UI_OT_view_item_rename`, just
need to add that in the keymap

Pull Request: https://projects.blender.org/blender/blender/pulls/143978
2025-08-05 11:58:39 +02:00
Habib Gahbiche
ac134c5a51 Compositor: Use frame for Map Value node versioning
Ref: #143441

The Map Value node was removed. During versioning, it gets replaced by
other equivalent nodes.
This PR adds a frame around the newly created nodes with a label that
clarifies the reason these nodes were added.

Pull Request: https://projects.blender.org/blender/blender/pulls/143800
2025-08-05 11:39:56 +02:00
Sybren A. Stüvel
e239c7f43c Anim: fix printf format string
Use `PRId64` for `int64_t` values, to appearse both clang and gcc.

The warnings were introduced in efef8a201a

Pull Request: https://projects.blender.org/blender/blender/pulls/143979
2025-08-05 11:37:28 +02:00
Damien Picard
5998795aa6 UI: Replace contractions with long-form text
Avoid using contractions for can't, aren't, doesn't, and shouldn't.
Following the writing style guide in the Human Interface Guidelines.

Pull Request: https://projects.blender.org/blender/blender/pulls/143852
2025-08-05 11:16:22 +02:00
Benjamin Beilharz
570f44a059 Compositor: Extension modes for corner pin mode
This commit introduces the extension modes to the corner pin node and
further streamlines the node properties by wrapping all props in the node
storage. Therefore, the interpolation mode has been removed from the
custom properties of the node and moved into the node storage.

Right now, the extension modes only work for non-anisotropic filtering.

Pull Request: https://projects.blender.org/blender/blender/pulls/141570
2025-08-05 11:12:54 +02:00
Ian Yoo
f6523e619a Tests: Add group node test for missing output node
This adds a test case for #142944 where the compositor crashes when
there is a missing group output node inside a group node.

Pull Request: https://projects.blender.org/blender/blender/pulls/143150
2025-08-05 11:06:44 +02:00
Sybren A. Stüvel
f7a033e547 Fix: AssetShelfSettings memory management issues (assignment & destructor)
Rewrite `AssetShelfSettings::operator=` and fix `~AssetShelfSettings()`
to address some memory management issues:

- `memcpy` was used to copy a C++ struct, which shouldn't be done: it
  can cause undefined behaviour if the class has vtables or internal
  padding. This isn't the case here, but GCC nonetheless warns for it.
- `active_catalog_path` was incorrectly freed via `MEM_delete()`; it was
  allocated with `BLI_strdup()`, which uses `MEM_malloc_arrayN()` and
  thus should be freed with `MEM_freeN()`.
- Self-assignments weren't handled properly, and could cause data loss.

These are now all fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/143701
2025-08-05 11:03:31 +02:00
Bastien Montagne
f453c189f8 make format 2025-08-05 11:02:21 +02:00
Clément Foucault
83c5e81a8b Fix #143857: View3D smooth interpolation produces invalid rv3d.dist values
In the particular case of the report it creates a rv3d with `dist == 0`.

This causes EEVEE to create an invalid projection matrix when
calling `RE_GetWindowMatrixWithOverscan` with a zero `viewplane`.

To avoid this, we check if `rv3d->dist == 0` and don't compute overscan
in this case. This avoid many issues down the line.

Candidate for backporting to 4.5 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/143946
2025-08-05 11:01:03 +02:00
Bastien Montagne
d3f6523536 tests: Add basic performance test for bpy/RNA API.
These tests check performances of ID python wrapper creation (these are
cached), regular RNA struct wrapper creation, acess to IDProperties,
(un)registering of py-defined PropertyGroup, and access to py-defined
properties (without and without custom get/set).

The goal of these tests is mainly to follow performances impact of
on-going refactors and improvements in the BPY/RNA area.
2025-08-05 10:41:08 +02:00
Jeroen Bakker
9d039ef29e Fix #141806: Crash with certain layers enabled
This PR removes the deferred allocation of swapchain images. A lot of layers
don't support this and will crash when used.

Thanks to Jorn Visser to point out the potential issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/143924
2025-08-05 10:11:06 +02:00
Clément Foucault
5b15894d7c Fix #143294: Blended surface not receiving volume properly
The `gl_FragCoord.z` is now containing the reverse Z and
should be passed through the `read` function.

Candidate for backporting to 4.5 LTS.

Pull Request: https://projects.blender.org/blender/blender/pulls/143950
2025-08-05 09:57:13 +02:00
Omar Emara
264a316984 Fix #141173: Inpaint node inconsistent on GPU
The Inpaint node produces inconsistent results across different GPUs,
where it produces different results on Intel Windows GPU platforms. This
is due to a mismatch between the precision declared for the shader and
that of the allocated textures. To fix this, we make sure the shader
uses the same precision as the allocates results.

Pull Request: https://projects.blender.org/blender/blender/pulls/143793
2025-08-05 09:45:34 +02:00
Christoph Lendenfeld
5fcd624bd6 Fix: Poll function for asset screenshot operator
The issue was the usage of `asset_edit_id_is_editable` which seems to also return
true for external libraries that are not `asset.blend`

The fix is to use  `asset_edit_id_is_writable`

Fixes: #142124
Pull Request: https://projects.blender.org/blender/blender/pulls/141942
2025-08-05 09:09:17 +02:00
Christoph Lendenfeld
befe6062c0 UI: Icons for playhead snapping
The recently introduced feature of playhead snapping (#137278)
added a popover menu for snap targets.
This used text to indicate the contents of said popover.
In order to bring it in line with the other snapping menu, this PR adds
icons to indicate the enabled state of snapping.

Part of #135794

Pull Request: https://projects.blender.org/blender/blender/pulls/139271
2025-08-05 09:01:56 +02:00
Tenkai Raiko
de9b24abad Fix: Map UV node does not work with single values
The Map UV node does not work when the UV input is a single value, where
it is expected that the output will also be single value. This was
simply not implemented for GPU, so this patch does that.

Pull Request: https://projects.blender.org/blender/blender/pulls/143096
2025-08-05 08:09:25 +02:00
Jacques Lucke
2c435ce8df Fix #141469: Geometry Nodes: use safer approach to modifying each instance geometry
Many nodes operate on all the instances that are passed into them. For example,
the Subdivision Surface node subdivides the mesh at the root but also instanced
meshes. This works well for most nodes, but there are a few nodes were the old
`modify_geometry_sets` function was not very well defined and it was tricky to
use correctly.

The fundamental problem was that the behavior is not obvious when a node creates
or modifies instances and how those are integrated with the already existing
instances.

This patch solves this with the following changes:
* Remove the old `GeometrySet::modify_geometry_sets` and related
  `*_during_modify` methods.
* Add a new `blender::geometry::foreach_real_geometry` function that is similar
  to the old `modify_geometry_sets` but has a more well-defined interface:
  * It never passes instances into the callback. So existing instances can't be
    modified with it.
  * The callback is allowed to create new instances. This will automatically be
    merged back with potentially already existing instances. The callback does
    not have to worry about accidentally invalidating existing instances like
    before.
* A few existing usages used `modify_geometry_sets` to actually modify existing
  instances (usually just removing attributes). Those can't use the new
  `foreach_real_geometry`, so they just get a custom simple recursive
  implementation instead of using a generic function.

Pull Request: https://projects.blender.org/blender/blender/pulls/143898
2025-08-05 06:25:20 +02:00
Jacques Lucke
b9b71dbb71 Refactor: Nodes: slightly generalize drawing node errors
The goal here is it to make it more obvious how error messages for
shader nodes should be added. Nowever there is a more explicit
block for compositer and geometry nodes.
2025-08-05 06:24:52 +02:00
Hans Goudey
f5f9c4f444 Fix #143450: Bevel modifier crash with free normals
If the BMesh already has a "custom_normal" attribute with the wrong
type, the call to `BM_lnorspace_update` won't be able to add the
attribute with the expected name, and the bevel code ends up using an
invalid offset to access the data.

For the fix, first just guard against that case. But also make sure the
harden normals functionality still works when the input mesh has free
normals. They will no be converted to tangent space normals as
necessary, in bevel and in other BMesh code that requires that
custom normal storage format.

Pull Request: https://projects.blender.org/blender/blender/pulls/143489
2025-08-05 04:45:49 +02:00
Campbell Barton
9d449ffcba Build: unbreak WITH_PYTHON_MODULE=ON
Caused by 9f056204e5.
2025-08-05 12:08:24 +10:00
Harley Acheson
74b6e675d4 UI: Replace Top Bar Region Emboss with Fade
This removes code that adds a line to region edges, used only to add
a slight divider between Top Bar workspace list and the Scene selector.
The replaces that divider with a fade out effect instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/137921
2025-08-05 01:53:47 +02:00
Sean Kim
d3918515d1 Fix #143238: Weight & Vertex Paint crash when applying deform modifier
Fix in dd651ef5d6 was incomplete, the
cache logic needs to match as well to ensure that the correct cache is
being populated or set as dirty when updated.

Pull Request: https://projects.blender.org/blender/blender/pulls/143968
2025-08-05 01:07:41 +02:00
Harley Acheson
283bc177a4 Fix #143939: Fix Win32 External Ops, Open Folder/CMD for Files
File Browser list, Context Menu, External. On Win32 for items that are
not folders we need to use the list root for "open folder" and for
"command prompt here".

Pull Request: https://projects.blender.org/blender/blender/pulls/143964
2025-08-05 00:11:33 +02:00
Sean Kim
a007c309b3 Fix: Grease Pencil Vertex Paint uses old path for unified_paint_settings
Introduced in 4434a30d40

Pull Request: https://projects.blender.org/blender/blender/pulls/143948
2025-08-04 23:27:33 +02:00
Hans Goudey
bf40023aa4 Fix #143333: Custom bone shape does not include subdivision surface
This was caused by a mismatch in the conditions that enabled GPU
subdivision. The mesh normals domain for meshes with no faces was
reported incorrectly, causing the code to think there are auto-smooth
style split normals when there actually aren't.

Also the GPU subdiv normals extraction had a crash binding a vertex
buffer that doesn't exist when there are no faces. Add an early return
for the wire-only mesh case to avoid that.

Pull Request: https://projects.blender.org/blender/blender/pulls/143961
2025-08-04 23:13:31 +02:00
Casey Bianco-Davis
21fcf524b1 Curves: Treat curve as selected when any handle is selected
This makes it so that operators that function on curves will work if
only handles are selected. For Grease Pencil this also makes it so that
the control points of a stroke will be visible if any handles are
selected.

Part of #121574

Pull Request: https://projects.blender.org/blender/blender/pulls/143867
2025-08-04 22:15:35 +02:00
Hans Goudey
b9f48ceee6 Cleanup: Use BitVector for mesh mapping function
Also:
- Use MutableSpan instead of raw float pointer
- Remove outdated confusing comments
2025-08-04 15:34:18 -04:00
Jacques Lucke
8133f7aa13 Fix: crash due to wrong duplicate node name handling
Generally, node names are expected to be unique within a node tree. However,
`ntree_shader_copy_branch` currently does not enforce this for performance
reasons. This was broken by recent changes in 5b73f798d0 and 9fd877e174 which
allows for passing already unique names and identifiers to the node copy
function.

The main problem here was that the `use_unique` parameter of the `node_copy`
function was not well defined. Now, this function is completely removed in favor
of using `node_copy_with_mapping` directly. This also has a new
`allow_duplicate_names` parameter now which makes the expected behavior more
explicit.

Pull Request: https://projects.blender.org/blender/blender/pulls/143951
2025-08-04 19:57:43 +02:00
Jesse Yurkovich
da1846ebe1 Tests: Add options controlling verbosity of output for IO report
Add two sets of options to the IO Report class that allows tests to
control the verbosity of output.
- Add `Report.context_lines` controlling how many lines of context the
  diff uses when there are failures (3 by default)
- Add `Report.side_to_print_single_line` (5 by default) and
  `Report.side_to_print_multi_line` (3 by default) controlling how many
  items are written out

The first option helps when a failure in the test might not produce
enough lines of output to know which object is affected. The second set
of options allows individual tests to ensure more values are taken into
consideration for test validation.

They are exposed as class variables due to all the inner methods using
them being static.

Pull Request: https://projects.blender.org/blender/blender/pulls/143922
2025-08-04 19:18:16 +02:00
Ramon Klauck
efef8a201a VSE: delete keyframes from preview
This PR makes it easier to delete strip keyframes from the preview.
It works similarly to the 3D viewport and also works with keying sets.
Pressing "alt + I" deletes the keyframe on the current frame of the
selected strips, when a keyset is active it only deletes the keyframes
of the selected keyset.

Pull Request: https://projects.blender.org/blender/blender/pulls/140385
2025-08-04 19:15:00 +02:00
Jacques Lucke
72e810a45a Geometry Nodes: put closure sockets in panel
This moves the closure interface sockets into a separate panel so that they
can't be confused with the main closure input.

Pull Request: https://projects.blender.org/blender/blender/pulls/143821
2025-08-04 18:35:20 +02:00
Lukas Stockner
793040ad1c Cycles: Improve parameter packing for the Principled BSDF
The Principled BSDF has a ton of inputs, and the previous SVM code just always
allocated stack space for all of them. This results in a ton of additional
NODE_VALUE_x SVM nodes, which slow down execution.

However, this is not really needed for two reasons:
- First, many inputs are only used consitionally. For example, if the
  subsurface weight is zero, none of the other subsurface inputs are used.
- Many of the inputs have a "usual" value that they will have in most
  materials, so if they happen to have that value we can just indicate that
  by not allocating space for them.
  This is a bit similar to the standard "pack the fixed value and provide
  a stack offset if there's a link" pattern, except that the fixed value
  is a constant in the code and we allocate a NODE_VALUE_x if a different
  fixed value is used.

Therefore, this PR re-implements the parameter packing in a more efficient way:
- If we can determine that a component is disabled, all conditional inputs are
  disconnected (to avoid generating upstream nodes).
- If we can determine that a component is disabled, we skip allocating all
  conditional inputs on the stack.
- The inputs for which a reasonable "usual" value exists are changed to
  respect that, and to only be allocated if they differ.
- param1 and param2 (which are fixed-value-packed as on all BSDF nodes) are
  used to store IOR and roughness, which have a decent chance to be fixed
  values.
- The parameter packing is more aggressive about using uchar4, which allows
  to get rid of two SVM nodes while still storing the same inputs.

The result is a considerable speedup in scenes that make heavy use of the
Principled BSDF:

| Scene | CPU speedup | OptiX speedup |
| --- | --- | --- |
| attic | 5% | 9% |
| bistro | 5% | 8% |
| junkshop | 5% | 10% |
| monster | 3% | 4% |
| spring | 1% | 6% |

Pull Request: https://projects.blender.org/blender/blender/pulls/143910
2025-08-04 18:34:58 +02:00
Bastien Montagne
fbdf21fb52 Fix #143888: Repeated deletion & Ctrl+Z on a linked data crashes.
The issue comes from the fact that placeholder IDs where not properly
cleared before writing, leaving all kind of potential broken pointers
once read back.

Also use the `BLO_Write_IDBuffer` for these, with dedicated 'cleanup'
logic since in their case, we want to write almost nothing.

Pull Request: https://projects.blender.org/blender/blender/pulls/143949
2025-08-04 18:01:49 +02:00
Bastien Montagne
6dbcc84cc0 Fix #143844: Assert when loading an image in Image Editor (debug build).
'Regular' ID RNA pointer not refcounting its usages, not properly tagged
as such.
2025-08-04 17:56:45 +02:00
Bastien Montagne
0e52304772 Fix building (missing include). 2025-08-04 17:54:15 +02:00
Brecht Van Lommel
526b776417 Fix: Build error with USD/Hydra with some build systems
Move API shared between USD and Hydra to usd_private.hh. It seems ninja
added an include directory other build systems don't.
2025-08-04 17:21:09 +02:00
Jeroen Bakker
2da51cef50 Cleanup: Silent unused parameter 2025-08-04 16:15:59 +02:00
Hans Goudey
5d1bea7ff5 Fix #143780: Bounds overlay ignores edit mesh
For quite a while, for edit mode mesh object evaluation we haven't
put the evaluated edit mesh in the evaluated geometry set. I don't
think the reason for that applies anymore. The code is much simpler
if all the evaluated geometry is a consistent place, so just put it there,
the same way as non-edit-mode evaluation.

Pull Request: https://projects.blender.org/blender/blender/pulls/143896
2025-08-04 16:04:04 +02:00
Mattias Fredriksson
535842fb92 Cleanup: Confusing and varied naming of 'last_control_point_index'
Function curves::nurbs::calculate_basis_cache() varies the name of the
variable 'last_control_point_index '. Name is also confusing and not
descriptive as it  refers to the total number of points including
padded/repeated points for cyclic curves (repeated by wrapping the
index by the size of the array).

Use of 'points_num' generally also refers to the size of the array and
not total number of wrapped points.

Pull Request: https://projects.blender.org/blender/blender/pulls/143921
2025-08-04 16:03:35 +02:00
Dawid Kurek
9afa991316 Hydra: Handle dome light rotation
This refactors the code for world to dome light to be shared between USD and
Hydra, and makes rotations work for Hydra the same way they do in USD.

One small behavior change is that missing image files now render black,
matching Cycles and EEVEE more closely.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/143035
2025-08-04 15:58:37 +02:00
Alaska
83472b19fe Fix: Cycles: Show correct minimum OptiX GPU driver in preferences
Ever since the OptiX 8 update in Blender 4.5, the minimum GPU driver
requirements to use OptiX has increased to 535 or newer.

This commit update the minimum GPU driver requirement listed in the UI
to reflect this.

Pull Request: https://projects.blender.org/blender/blender/pulls/143917
2025-08-04 15:48:43 +02:00
Hans Goudey
89a45a66aa Cleanup: Use consistent parameter name, remove const in declaration 2025-08-04 09:42:24 -04:00
Amogh Shivaram
ff4d840cf8 Cycles: Add polarized Fresnel function for conductors
This PR adds a new `fresnel_conductor_polarized` function, which calculates reflectance and phase shift (if requested) for both parallel and perpendicular polarized light. This is needed for applying thin film iridescence to conductors (see !141131).

For consistency, this PR also makes `fresnel_conductor` call `fresnel_conductor_polarized` instead of using a fast approximation of the Fresnel equations that is inaccurate at lower n and k values. This will change the output of some Metallic BSDF renders using Physical Conductor and prevent discrepancies when enabling thin film iridescence.

I didn't do any rigorous performance testing, but from timing the functions outside of Blender, `fresnel_conductor_polarized` is significantly slower than the approximation, between 1.5-3x depending on the compiler. This makes sense because it has three square roots and the approximation has none. In some informal tests with metallic_multiggx_physical.blend modified to have more spheres, the new renders took around 1-2% longer on both CPU and GPU.

There are some avoidable inefficiencies in this approach of just calling `fresnel_conductor_polarized`:

- one of the three square roots could be saved since `fresnel_conductor` never needs the phase shift and there are simplifications possible when only calculating the reflectance
- there are several unnecessary multiplications by 1.0 since `fresnel_conductor` uses relative IOR and `fresnel_conductor_polarized` doesn't, though those could get optimized out if inlined

Pull Request: https://projects.blender.org/blender/blender/pulls/143903
2025-08-04 15:36:36 +02:00
Lukas Stockner
e266692688 Fix #143907: Cycles: Crash when custom camera shader is not found 2025-08-04 15:34:16 +02:00
Lukas Stockner
3107d1f962 Cycles: Improve parameter packing for BSDFs and emission
This replaces `stack_assign` with `stack_assign_if_linked`, which should save a few SVM nodes for constant parameters.

Running benchmarks (all scenes in the benchmark repo, 3 runs, median value for each) shows 1.0% improvement on CPU and 1.5% on OptiX. Not huge, but fairly (all between -0.2% and 3.0%).

Pull Request: https://projects.blender.org/blender/blender/pulls/143404
2025-08-04 15:19:40 +02:00
Jeroen Bakker
2da5969fdc Vulkan: Remove framebuffer slot assert
This assert was to notify developers that they are using a framebuffer
configuration that isn't supported when using render passes. Render
passes should not be used and will be removed later in 5.0. Removing the
assert will already help during triaging.

Pull Request: https://projects.blender.org/blender/blender/pulls/143936
2025-08-04 14:42:10 +02:00