Commit graph

2606 commits

Author SHA1 Message Date
Sybren A. Stüvel
35a2ca4c10 Fix #155953: Geometry nodes bake paths not reported via foreach_path
This was never implemented. Adding support is relatively simple.
We either expose the path corresponding to the bake or the
path the bake will inherit from the modifier.

Because there are arbitrarily many metadata files and the connection
to the binary blob files is only clear at runtime when loading the bakes,
this PR just exposes the entire directory.

Co-authored-by: Sybren A. Stüvel <sybren@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/156380

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/157175
2026-04-10 12:42:11 +02:00
Brecht Van Lommel
9c285aa0da Fix #155861: Crash rendering CMYK JPEG textures in Cycles
The OpenImageIO version we use has broken CMYK to RGB conversion in
JPEG, this is a temporary workaround until we upgrade to a newer
version. Directly read the CMYK image with libjpeg.

Note that when we upgrade, we can remove the CMYK conversion code
entirely as OpenImageIO supports this natively nowadays.

---

NOTE: This is the backport for 5.1.1.
Pull Request: https://projects.blender.org/blender/blender/pulls/157146
2026-04-10 09:07:36 +02:00
Campbell Barton
e622d316e2 Fix #155928: Undo argument can no longer be passed to the operator
Resolve regression in [0] which didn't account for a single positional
boolean argument.

[0]: 877283a09a

Ref !155997

Pull Request: https://projects.blender.org/blender/blender/pulls/157122
2026-04-09 15:23:02 +02:00
Campbell Barton
2edae0c5e0 Tests: add tests for sub-classing & calling operators from Python
Add two tests, one to check that sub-classing works as expected,
another for the operators callable types.

Written to validate fixes for #155928 & #155996 and ensure
there are no further regressions.

Ref !155994
2026-04-09 15:23:02 +02:00
Sean Kim
0689bf2104 Revert "Fix #127398 : Transform tool not working correctly with non-uniform scaling"
This reverts commit 7375b837b0.

This commit causes issues with non-global transform orientations and
with hindsight now seems like the incorrect approach to take, given that
the original issue is specifically about non-uniform scale.

Pull Request: https://projects.blender.org/blender/blender/pulls/156055
2026-04-08 09:15:31 +02:00
Brecht Van Lommel
bae49f7fca Fix: Cycles denoise animation test is flaky with parallel ctest
Write intermediate file in the relevant test directory in the build
folder, rather than next to the blend file, so the OSL and SVM variants
don't interfere.

Started happening after a78585b00d re-renabled this test.

Pull Request: https://projects.blender.org/blender/blender/pulls/156700
2026-04-08 09:11:22 +02:00
Brecht Van Lommel
1cc874cd7b Fix #155982: Cycles denoise animation operator fails for multi-part EXR
Support reading multi-part EXR in this code, and add a test. Also fixes
the denoise_animation test being disabled.

Regression from be1619f4ad.

Pull Request: https://projects.blender.org/blender/blender/pulls/156040
2026-04-08 09:11:14 +02:00
Brecht Van Lommel
2fc4670f6e Fix #155851: Cycles crash with background scene
BKE_view_layer_base_find returns null for objects from background scenes
since they have no base in the current view layer. As before, such
objects will not have holdout or indirect-only flags.

Regression from 244b154bb6.

Pull Request: https://projects.blender.org/blender/blender/pulls/155876
2026-04-07 15:00:00 +02:00
Brecht Van Lommel
db4b36d1b2 Fix #155458: Cycles displacement with flat and smooth normals artifacts
The fix in 2dc2e0b062 to discard flat/smooth flags if there are corner
normals didn't work well for displacement. Then the normals are fully
recomputed from displacement and for this the flat/smooth flag is
needed.

Rather than discarding the flags on conversion from Blender, do it
inside Cycles after displacement.

Pull Request: https://projects.blender.org/blender/blender/pulls/155522
2026-03-11 17:51:04 +01:00
Sybren A. Stüvel
705ff33bc0 Python: add size limit to HTTP downloader
Add an option to the HTTP downloader that sets a size limit (in bytes).
Any download that's larger than this will be rejected with a
`ContentLengthTooBigError` exception.

This is useful to prevent Blender from choking on the parsing of huge
JSON files, which can be served relatively cheaply via compression
techniques.

```py
from _bpy_internal.http import downloader as http_dl

downloader = http_dl.ConditionalDownloader(
                     metadata_provider=metadata_provider)
downloader.max_size_bytes = 100

downloader.download_to_file("https://example.com/huge.json",
                            Path("/tmp/huge.json"))
```

The `DownloaderOptions` dataclass has also been extended with a
`max_size_bytes` parameter, so that this can be passed to the background
downloader process as well.

Note: the HTTP downloader is not used in Blender 5.1 (it's intended
for the Remote Asset Libraries in 5.2). However, since this can be
considered a fix for a security issue (potential DOS of Blender), I
feel it's still warranted to include this in 5.1. See !154464 for this
change in context.

Pull Request: https://projects.blender.org/blender/blender/pulls/155259
2026-03-10 13:37:55 +01:00
Jesse Yurkovich
c1c7984396 Fix: USD: Allow primvars to contain ':' characters
In USD primvars can use ':' to namespace their primvar variables. It is
somewhat common, especially with USD files from more established DCCs,
to see primvars like `primvars:ri:attributes:user:MatteID0`.

During Import we would read this in correctly. However, Export would
sanitize the name and convert ':' to '_' unnecessarily. This PR allows
generic primvars, including UVs, to contain ':'.

Pull Request: https://projects.blender.org/blender/blender/pulls/155300
2026-03-09 18:40:23 +01:00
Christoph Neuhauser
07460be69a Fix #154770: UI: Force OS DPI scale of 1 in UI tests
Pull Request: https://projects.blender.org/blender/blender/pulls/155422
2026-03-09 18:17:06 +01:00
shokuyansh
7375b837b0 Fix #127398 : Transform tool not working correctly with non-uniform scaling
Transform tools in ```sculpt mode``` were working incorrectly when mesh
was scaled non-uniformly because transformation logic was calculating
```Translation Delta``` and ```Pivot Point``` in ```Local Space``` ,
thus causing the issue.

Fixed the issue by updating ```transform_matrices_init``` function :

- Converted start and final pivot position to **World space** before
  calculating `Translation Delta` and `Pivot Matrix`.
- Multiplied the ```sculpt_matrix``` with ```object_to_world``` &
  ```world_to_object``` matrices respectively , ensuring correct
  transformation to the **world space** and back to **local space**.
- Handle the pivot transformation in world and local space as well

Pull Request: https://projects.blender.org/blender/blender/pulls/154310
2026-03-07 03:40:59 +01:00
Brecht Van Lommel
2dc2e0b062 Fix #155171: Cycles renders flat faces with custom normals wrong
The convention is that the custom normals override flat shading.
Regression from corner normals support in 6bbdad08fd.

Pull Request: https://projects.blender.org/blender/blender/pulls/155223
2026-03-05 13:33:31 +01:00
Christoph Lendenfeld
b6a84566b9 Fix #141841: Removing a bone does not remove its drivers
When removing a bone in edit mode, the drivers on
the pose bone stuck around. Thus when creating
a bone with the same name, the drivers would appear again.

This is now fixed by calling `BKE_animdata_drivers_remove_for_rna_struct`
when leaving edit mode.
The reason this call is not deeper in the code is because there is a
valid use case for freeing a bone without touching its animdata.
One example for that in Blender is mirroring where the bones on
one side are freed. It would be unexpected to lose drivers from mirroring.
This is also why the drivers are only removed when leaving edit mode.
That way it can be consistent between using the api and editing the
armature via the UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/154571
2026-03-05 11:54:25 +01:00
Brecht Van Lommel
44be56fd49 Cycles: Smoothly blend denoising features to avoid artifacts
Albedo and normal denoising features passes used several hard cutoffs
that lead to discontinuities in the passes and sometimes the denoised
render too. Use smooth transitions instead.

Specular roughness cutoff of 0.075 replaced by a smoothstep from 0.0
to 0.15. Specular and transparent 25% threshold replaced by diffuse to
specular ratio blend from 0.0 to 0.5.

Also stop using sample_weight which is meant for importance sampling
only.

Fix #150391
Fix #85512
Fix #78571

Pull Request: https://projects.blender.org/blender/blender/pulls/154988
2026-03-03 16:45:02 +01:00
Brecht Van Lommel
934346f935 Cycles: Add Normal Map node Base option for displaced surfaces
To choose between:
* The smooth, undisplaced base surface normal and tangents, when you
  have a displacement map and normal map that match.
* The displaced surface normal and tangents, when you want to apply a
  normal map in addition to displacement.

This is Cycles only for now, to fix a regression in 5.0 regarding
adaptive subdivison.  More unified handling with EEVEE is for another
time. This is an alternative solution to replace #122397.

Fix #153670

Pull Request: https://projects.blender.org/blender/blender/pulls/154031
2026-02-27 18:52:50 +01:00
Brecht Van Lommel
cb3db815bc Cleanup: Consistent setup and teardown in OSL compile test
If multiple tests are added in the future, this could break them.

This issue was introduced in 4f050d82dc.

Pull Request: https://projects.blender.org/blender/blender/pulls/154967
2026-02-27 17:15:35 +01:00
Jesse Yurkovich
2d00ccb576 Fix #154776: Incorrect scaling applied for unit conversion scenarios
An incorrect scaling vector was used that resulted in the positions of
the incoming and outgoing USD prims not being scaled accordingly.

There was already test coverage in place for the general code paths, but
none tested or verified the positions of the objects when scaling was
required. Added additional test coverage to prevent future regressions.

Pull Request: https://projects.blender.org/blender/blender/pulls/154780
2026-02-26 22:11:22 +01:00
Miguel Pozo
a67ba0c309 Build: Force disable Overlay tests
We need to enable WITH_GPU_RENDER_TESTS_HEADED on the builder for the
Overlay tests (#154533).
However, since an early version of the tests is already on main/release
(without reference images), simply enabling the flag on the builder
would cause `+test_gpu_draw` to fail.

So the plan of action is:
1. Merge this PR into 5.1 and main (and LTS branches?).
2. Enable the `WITH_GPU_RENDER_TESTS_HEADED` flag on the builder.
   (https://projects.blender.org/infrastructure/builder/pulls/23)
3. Revert this commit in #154533 and merge it only into main.

Pull Request: https://projects.blender.org/blender/blender/pulls/154885
2026-02-26 17:34:33 +01:00
Mark van de Ruit
24d6138e16 EEVEE: Add ShaderToRGB+Subsurface test
Adds a simple test to catch some behaviors I fixed in #154819, buggy
interactions between Diffuse/Glossy/ShaderToRGB/Subsurface shaders.

Pull Request: https://projects.blender.org/blender/blender/pulls/154872
2026-02-25 16:29:08 +01:00
Sean Kim
109721cf00 Fix: Errors in python test helper script
Introduced in 4b7ffbe48c

Pull Request: https://projects.blender.org/blender/blender/pulls/154779
2026-02-24 22:03:20 +01:00
Sean Kim
9f5cd90dbf Fix: Syntax error in test logic
Introduced with f7806ffbf9

Pull Request: https://projects.blender.org/blender/blender/pulls/154778
2026-02-24 22:02:30 +01:00
Alejandro Aguirre
ca0884abb0 Fix: Mesh: Active/default color attribute and UV map not set when created via Python
Caused by 8adba33029.

Since this commit the active/default color and UV were only set in
edit mode. The code path using AttributeStorage did not set them.

Pull Request: https://projects.blender.org/blender/blender/pulls/154775
2026-02-24 13:51:30 +01:00
Sergey Sharybin
4f050d82dc Cycles: Add OSL compilation test
The test explicitly requests an OSL script to be compiled, without
relying on possibly cached bytecode in a node, or an oso file on a
disk.

It is aimed to catch issues line the ones in the referenced issue
and pull-request.

The reason why the compilation error was not caught before is because
render tests were using bytecode that was cached in the node storage.

This change uses internal Cycles API to test OSL compilation. This
seems to be the easiest way to hook up to this API. The operators from
node or text editor requires a context override, which is a bit tedious
to setup.
Alternative could be to use an external OSL script, but the issue with
that is Cycles would store OSO next to the input, so we can't have a
script stored in the tests folder and it'll need to be saved in a temp
directory anyway.

The test code might be a bit too verbose, but it just follows the
typical boiler plate code from other Python tests, preparing for the
future where we might want to store input scripts outside of the
python script.

The reason why comment line compilation using oslc succeeded is because
it is not really required to pass include to the "system" `shaders`
directory: the oslc/liboslcomp has a special logic that looks for the
`share/OSL/shaders`: `oslc ~/script.osl -o ~/script.oso` works just
fine.

Ref #154476
Ref #154576

Pull Request: https://projects.blender.org/blender/blender/pulls/154623
2026-02-20 10:26:59 +01:00
Sean Kim
f7806ffbf9 Refactor: Tests: Make OperatorSpecObjectMode more generic
The existing `OperatorSpecObjectMode` operator was unnecessarily
restrictive.

Prior to this change, it specifically handled setting the object to
Object mode and then calling a specific `bpy.ops.object` operator with
given parameters.

Instead of extending this to define one per-mode, and to allow calling
operators outside of the `object` module, this commit converts the class
and its usages to `OperatorSpec` where the target mode and containing
module are specified as parameters.

Pull Request: https://projects.blender.org/blender/blender/pulls/154625
2026-02-19 20:39:04 +01:00
Sean Kim
b52b77165e Fix: Error in topology automasking test
Pull Request: https://projects.blender.org/blender/blender/pulls/154542
2026-02-19 00:37:47 +01:00
Miguel Pozo
4cc54a73a2 Cleanup: EEVEE Tests: Fail thresholds clarification
Add extra info.
Swap camera and texture locations.
2026-02-18 17:58:52 +01:00
Jeroen Bakker
bbbc20fb81 Fix #154515, #154516: EEVEE rendertests on AMD/Linux/OpenGL
Increased the fail threshold for texture, rayquery and camera tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/154520
2026-02-18 09:25:46 +01:00
Lukas Tönne
beafb31be4 Fix: Node "make_group" operator creates invisible links (regression)
Grouping a single node with hidden sockets can create links between the
group node input/output and the hidden sockets, which also hides the
new internal link.

This is a regression in #151894. Before this the make group operator
would always un-hide all sockets and un-collapse all panels of the
grouped node.

Make sure that created links in node group operators are always visible
and that panels are always uncollapsed. This is a little slower than
the previous approach of simply expanding everything, because we have
to slow-search through the panel hierarchy. But it is more consistent
behavior because we don't have to know which links the operator
creates, it just make anything visible that gets connected.

Pull Request: https://projects.blender.org/blender/blender/pulls/154264
2026-02-18 08:56:45 +01:00
Sean Kim
ac17d71d27 Tests: Add sculpt automask test for 'Face Set' and 'Topology' modes
Adds a new file for testing automask modes, specifically testing the
'Face Set' and 'Topology' modes.

This is achieved by performing a stroke on a Suzanne mesh with the face
sets initialized by loose parts (i.e. the eyes of the mesh).

Additionally, minor changes are included to the common paint test
helper to make testing easier.

Pull Request: https://projects.blender.org/blender/blender/pulls/154342
2026-02-18 00:50:18 +01:00
Sean Kim
ff0161c348 Fix: Paint: Mimic modal execution when calling PaintStroke::exec
Currently, when using `sculpt.brush_stroke`, the raycast that updates
active attributes and certain properties on the `SculptSession` is not
executed, preventing certain brush features from working.

There were a few  problems that prevented this from working correctly:
* When `test_start` was called, all non-`invoke` calls were considered
  valid.
* We need to call `test_start` on each stroke step until we find the
  actual starting point
* The wrong "mouse" event was passed to `test_start`

Additionally, this allows a handful of tests that formerly had to be
skipped to be ran as part of the sculpt brush test suite.

Pull Request: https://projects.blender.org/blender/blender/pulls/154341
2026-02-16 19:28:15 +01:00
Sean Kim
4b7ffbe48c Tests: Extract common sculpt functions to helper module
Pull Request: https://projects.blender.org/blender/blender/pulls/154233
2026-02-12 02:29:49 +01:00
Sean Kim
557365b304 Tests: Add blocklist for intel linux undo test
Pull Request: https://projects.blender.org/blender/blender/pulls/154229
2026-02-10 23:52:25 +01:00
Campbell Barton
9ad35799c4 PyAPI: support None arguments documented as defaulting to None
A long standing confusion with the C/Python API is arguments
that are optional and documented as defaulting to "None" yet,
will fail with a type error if None is passed in.

This is confusing both for API users & developers,
as well as making the code difficult to properly type check.

The reason for this is PyArg_Parse* functions don't support
parsing arguments that can optionally be None for most types.
Resolve by adding our own argument parsing helpers.

Also rename bmesh 'example'  parameter to 'source'
for verts/edges/faces.new and face_split.
To match BMesh internal naming, although this is only for documentation
purposes as it isn't a keyword argument.

Ref !154178
2026-02-10 19:13:16 +11:00
Brecht Van Lommel
ab4efcf3c0 Fix: Cycles corner normals and displacement + bump wrong results
Vertex normals were recomputed too late to be available to store as undisplaced
normals. Now make sure they exist right before add_undisplaced is called.

Pull Request: https://projects.blender.org/blender/blender/pulls/154102
2026-02-09 23:20:15 +01:00
Brecht Van Lommel
f7bca00032 Fix #154128: Cycles normal map wrong renders after corner normal changes
After refactoring to deduplicate code, the normal for the tangent frame was
no longer properly transform to object space. Revert code to how it was
before and add a more explicit function name and comment.

Pull Request: https://projects.blender.org/blender/blender/pulls/154102
2026-02-09 23:20:15 +01:00
Christoph Lendenfeld
bce83c83b1 Fix #153229: Driver on bone lost on rename
The issue was that when renaming the bone, the function to fix the rna
paths on the Armature data checked for the `pose.bones` prefix (which
is on the Object data).

This is a simple fix, but to be sure this is still working
(and because we had a bunch of bugs in that area already)
I covered the case with a few unit tests.

I found another bug while writing the unit tests.
Driver targets don't get renamed.
The testing code is there, just commented out so we can quickly
get the test to fail once we start fixing the bug.

report mentioned in comment above the buggy line
#29822

Pull Request: https://projects.blender.org/blender/blender/pulls/153573
2026-02-09 13:45:14 +01:00
Brecht Van Lommel
fac8b300e0 Fix #152455: OpenEXR DWAA/DWAB saving leads to inf values
DWAA/DWAB lossy compression uses DCT-based encoding, where values near
HALF_MAX can overshoot to infinity after decompression, due to DCT ringing.

There are different ways to resolves it and it's not so clear what the ideal
solution would be and how it would be handled upstream. By default it
will already convert values > HALF_MAX to inf and it's up to the application
to clamp if they want to (like we do).

As a workaround, clamp half float values before writing with an empirically
determined value that takes into account that lower quality makes this
problem worse. The resulting files should then decompress without inf in
existing software.

Pull Request: https://projects.blender.org/blender/blender/pulls/154061
2026-02-09 13:10:39 +01:00
Brecht Van Lommel
c17eb901f7 Tests: Put exr dwaa/dwab quality in file name 2026-02-09 13:10:38 +01:00
Brecht Van Lommel
110de4f488 Cycles: Half float denormals and optimizations
* Switch to more accurate half and float conversion supporting denormals
  to match native instructions. This makes CPU and GPU match more
  closely in some tests and avoids clipping some low values.
* Inf and NaN are not supported still, as we already filter these out
  and there is no reason to have the overhead.
* Change avx2 kernel to require f16c. For all physical CPUs avx2 implies
  f16c, and it's only for emulation and virtual machines that this would
  not be the case. So it's fine to fall back to the sse4.1 kernel then.
* Assume half instructions are available with ARM NEON. There is no
  defined minimum architecture, but Blender assumes the same and ARMv8.2-A
  is relatively old.
* For everything else there are SIMD optimized fallbacks.
* New unit tests were added, coverting both native instructions and
  fallback implementations, and half/half3/half4.

Fix #152763: Half float image low values are clipped

Pull Request: https://projects.blender.org/blender/blender/pulls/154042
2026-02-09 13:01:08 +01:00
Campbell Barton
791505e2ed PyDoc: use :param: instead of :arg: in Sphinx docstrings
While "arg" isn't deprecated "param" is preferred and used in all
Sphinx's examples & tutorials.

Ref !154039
2026-02-07 14:30:16 +11:00
Brecht Van Lommel
9b8810a351 Refactor: Cycles: Compress vertex normals with octahedral mapping
To reduce memory usage, store in a 32 bit packed_normal.

This requires more processing to read the normals, which may or may not be
offset by reduced cache misses. For CPU there is SIMD to decode 3 normals at
once. Overall performance impact seems minimal.

Co-authored-by: Alex Fuller

Pull Request: https://projects.blender.org/blender/blender/pulls/153836
2026-02-06 19:22:48 +01:00
Campbell Barton
c89ba4de5d Cleanup: spelling in comments (make check_spelling_*) 2026-02-06 23:06:08 +11:00
Brecht Van Lommel
abf187f4c9 Revert "Tests: Temporarily disable OpenEXR HTJ2K saving tests"
This reverts commit 515a956884. The test
should now be reliable with the latest library update.

Fix #153443

Pull Request: https://projects.blender.org/blender/blender/pulls/153977
2026-02-06 00:27:47 +01:00
Brecht Van Lommel
343c71beb2 Images: AVIF file format read and write support
It can be used for saving HDR images that work in most web browsers and
image editors. Unlike HDR PNG, this can use lossy compression to make file
sizes much smaller.

The options are 8/10/12 bit and a quality percentage.

Pull Request: https://projects.blender.org/blender/blender/pulls/153540
2026-02-06 00:15:05 +01:00
Jonas Holzman
e3bbfc0996 Fix: macOS: Disable skinned_rabbit IO FBX test due to floating-point precision difference
The 5.1 Ceres / Eigen extern removal and update caused a single small
floating 0.001 floating precision difference to occur in this specific
FBX test on macOS compared to other platforms / the recorded reference
ground truth.

Temporarily disable this test for the 5.1 library update. Later, a
better solution could involve re-enabling this test and improving the
floating precision handling in the IO test data desc generation code.
2026-02-05 23:10:02 +01:00
Bart van der Braak
986ffa3aee Tests: Run without creating thumbnails by default
This reduces the thumbnails generated by a tests run from about
5k to less than 10.

In practice, some tests can still reset this userpreference e.g. by calling
`bpy.ops.wm.read_factory_settings()`. Further tweaks are possible
should this still be an issue in the future.

See also blender/blender#153811 and infrastructure/meta#197

Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/153817
2026-02-05 17:29:02 +01:00
Hans Goudey
de0bba6f41 Fix #153722: Single value field capture on attribute ignores selection
Don't replace the attribute data with a single value if we're not setting
the value for the entire attribute domain.

Pull Request: https://projects.blender.org/blender/blender/pulls/153954
2026-02-05 16:47:41 +01:00
Brecht Van Lommel
b5941c0f8e Fix #153081: Cycles: Displacement overrides flat shading
The code to compute the undisplaced flat normal was missing, it was always
assuming smooth shading. Includes minor refactor to deduplicate code.

The Metal workaround does not appear needed anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/153842
2026-02-04 21:04:31 +01:00