Commit graph

1902 commits

Author SHA1 Message Date
Hans Goudey
5e1e4de9d9 Mesh: Avoid name copy at the end of modifier stack
Currently after mesh data evaluation finishes evaluating modifiers, it
copies the name of the object's original mesh to the evaluated mesh.
This is problematic for a couple reasons. First is that it's not
necessarily right semantically. The mesh might have been sourced from
another object during evaluation with some method like the object info
node. Second, this requires the final mesh to be mutable. While that
isn't a problem for current code, it gets in the way for #119968, which
optimizes modifier evaluation using implicit sharing though GeometrySet
to avoid copies.

To get the same evaluated mesh naming as before where it makes sense,
this PR makes mesh copy/creation functions copy the name. That way the
original name is propagated through the modifier stack and nodes, similar
to the way the edit mesh pointer is propagated after 839108f623.
This still required a change to the USD export test though, because the
mesh it exports is generated from scratch inside Geometry Nodes; it doesn't
come from the original mesh in any way.

Pull Request: https://projects.blender.org/blender/blender/pulls/155330
2026-03-24 17:02:49 +01:00
Mark van de Ruit
ee45eaf611 EEVEE: Update subsurface thickness test for sphere/slab modes
Updated `subsurface_thickness`  and references to test both sphere and slab thickness modes; slab was previously not being tested.

Pull Request: https://projects.blender.org/blender/blender/pulls/156182
2026-03-24 14:34:49 +01:00
Miguel Pozo
834114cf96 Draw: Enable Overlay tests
Part of #148449.

- Fix the Overlay tests CMake setup.
- Reduce the number of test permutations.
- Simplify the test geometry to work around depth precision differences
  between platforms.
- Render the tests with 4X super-sampling to work around rasterization
  differences between platforms.
- Add reference images.

Pull Request: https://projects.blender.org/blender/blender/pulls/154533
2026-03-24 11:13:52 +01:00
Sean Kim
216a24e041 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-03-23 23:25:40 +01:00
Brecht Van Lommel
a78585b00d 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-03-23 11:43:42 +01:00
Brecht Van Lommel
7ef18aca68 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.

Pull Request: https://projects.blender.org/blender/blender/pulls/155946
2026-03-23 10:33:24 +01:00
Campbell Barton
48c15c655a CMake: convert macros to functions where possible
Functions scope their variables, macros don't. Use functions
for better variable hygiene, with `PARENT_SCOPE` where output
variables need to propagate.

This avoids the need to `unset(...)` every local variable which is
easy to forget - leaking variables into the callers scope.

Macros that must remain (flag modification, `find_package` forwarding,
paired state, caller-scope `return()`) are annotated with the reason
in their doc-strings.
2026-03-23 07:41:59 +00:00
Campbell Barton
9afe6f3b51 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
2026-03-20 19:33:43 +11:00
Campbell Barton
177ce52e34 Fix #155996: Crash calling operators with non-string keywords
Resolve regression in [0] which didn't account for the move to our
own callable type needing to validate the key types in the keyword dict.

Add `PyC_Dict_CheckKeysAreStrings` utility to allow reuse for
callable types in the future.

[0]: 877283a09a

Ref !155997
2026-03-20 19:33:10 +11:00
Campbell Barton
216c095d5d 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-03-20 18:10:22 +11:00
Campbell Barton
c26156384a PyAPI: ImBuf expose "NONE" as a file type
Internally this was already used in some places,
previously the API attempted hide the internal "NONE" type,
defaulting to "PNG" but this wasn't all that reliable.

Allow getting/setting an image's file_type to "NONE" to indicate
no format is assigned. Expose NONE in the `imbuf.file_types` dictionary
so it's always possible to do: `imbuf.file_types[image.file_type]`
without having to check for the NONE case.

"NONE" is treated as a format with no extensions and no capabilities.

Ref !155990
2026-03-20 06:21:01 +00:00
Campbell Barton
75b67099a8 ImBuf: add file type metadata and capability flags
Add filetype_id, file_extensions, and read/write capability flags
to ImFileType. Expose these through public accessor functions so
the Python imbuf module can use them.

Add capability checks to write and write_to_buffer that raise an error
when the format doesn't support the requested operation.

Also assert when attempting to write unsupported configurations
from C++ code.

Ref !155825
2026-03-20 06:21:00 +00:00
Campbell Barton
3aeba8cc09 Fix #155822: Out of bounds buffer read when writing AVIF image format
Saving AVIF was reading past the buffer bounds for 8bit images,
workaround the bug by re-allocating a buffer with the necessary
padding to avoid the error.

This has been fixed up-stream, the workaround can eventually be removed
when we drop support for older OIIO versions.

Ref !155824
2026-03-20 09:50:21 +11:00
Julien Duroure
46c4a12642 Fix: typo in glTF test report
Fix typo in glTF test report

Pull Request: https://projects.blender.org/blender/blender/pulls/155922
2026-03-19 10:31:07 +01:00
Sean Kim
4ffdc93378 Fix: Failing UI tests after recent change
Introduced with afc6d7a463

Pull Request: https://projects.blender.org/blender/blender/pulls/155899
2026-03-19 02:45:09 +01:00
Bastien Montagne
2b756ece9a Core: Add very basic global/memfile undo 'smoke tests'.
Abusing once again the 'blendfile_versioning' tests.
These are now doing three different tests on (almost) all test blendfiles:
* Basic open/save/reload
* Basic link/append.
* Basic memfile undo/redo.

At some point we probably want to refactor this into something better
organized? maybe with a test API that can apply some generic
operation(s) on all test blendfiles?

Pull Request: https://projects.blender.org/blender/blender/pulls/155637
2026-03-18 17:28:19 +01:00
Campbell Barton
be13b612df Tests: re-enable imbuf_py_api test with AVIF disabled
Workaround for #155822, where AVIF fails would buffer overrun
when writing 2x2 pixel images.

Ref !155827
2026-03-18 15:25:52 +11:00
Campbell Barton
5741952c50 Tests: disable recently added imbuf_py_api test
This is failing with the nightly sanitizer build,
disabling until this can be resolved.
2026-03-18 00:10:58 +11:00
Campbell Barton
3abf54cf3f PyAPI: add ImBuf.file_type read/write access
Support different file types in the imbuf module, previously it wasn't
possible to use imbuf to save an image as a different file format.

- Add `ImBuf.file_type` read/write property to get/set the image file
  format (e.g. 'PNG', 'JPEG', 'TIFF', ... etc).
- Add `imbuf.file_types` read-only dict mapping type identifiers to
  `ImBufFileType` objects which expose `id` and `file_extensions`.
- Add `imbuf.file_type_from_buffer()` to detect the file type from
  image data in memory.

Ref !155740
2026-03-17 13:31:24 +11:00
Campbell Barton
e0f91aed38 PyAPI: add ImBuf buffer methods & context manager for pixel data access
Provide buffer access to pixel data, as well as methods to ensure/clear
float/byte buffers as previously it wasn't possible to create new
float images.

- ImBuf.with_buffer(): context manager yielding a memoryview of pixel
  data (byte or float, with optional region and write support).
- ImBuf.ensure_buffer(), has_buffer(), clear_buffer():
  manage byte/float pixel buffers.
- Export blocking: resize/crop/free raise BufferError while
  pixel buffers are active.
- PyC_ParseRectI, PyC_ParseOptionalRectI:
  reusable O& converters for rcti argument parsing.
- Additional tests.

Ref !155734
2026-03-17 09:57:09 +11:00
John Kiril Swenson
07cf1ad2fe Cleanup: VSE: Replace all deprecated properties in internal scripts
This includes `frame_final_start`, `frame_final_end`, and
`frame_final_duration`.

Pull Request: https://projects.blender.org/blender/blender/pulls/155691
2026-03-16 20:39:22 +01:00
Sybren A. Stüvel
36e817aa80 Revert "PyAPI: add ImBuf buffer methods & context manager for pixel data access"
This reverts commit 8cf8973f69. That
commit broke unit tests, and the author doesn't seem to be available for
a proper fix right now.

Pull Request: https://projects.blender.org/blender/blender/pulls/155721
2026-03-16 17:31:02 +01:00
Campbell Barton
8cf8973f69 PyAPI: add ImBuf buffer methods & context manager for pixel data access
Provide buffer access to pixel data, as well as methods to ensure/clear
float/byte buffers as previously it wasn't possible to create new
float images.

- ImBuf.with_buffer(): context manager yielding a memoryview of pixel
  data (byte or float, with optional region and write support).
- ImBuf.ensure_buffer(), has_buffer(), clear_buffer():
  manage byte/float pixel buffers.
- Export blocking: resize/crop/free raise BufferError while
  pixel buffers are active.
- PyC_ParseRectI, PyC_ParseOptionalRectI:
  reusable O& converters for rcti argument parsing.
- Additional tests.

Ref !155710
2026-03-16 12:47:23 +00:00
Omar Emara
1d2ca9b15c Compositor: Port Active Camera and Camera Info nodes
This patch makes the Active Camera and Camera Info nodes from Geometry
nodes available in the compositor. This also exposed the object socket
as the first user for it.

Pull Request: https://projects.blender.org/blender/blender/pulls/155616
2026-03-16 10:01:00 +01:00
Campbell Barton
6944a44e2a PyAPI: add planes argument to imbuf.new & improve planes docstring
This makes it possible to create grayscale/RGB images,
with/without an alpha channel.
2026-03-16 13:13:16 +11:00
Campbell Barton
3152423683 PyAPI: expose ImBuf quality and compress properties 2026-03-16 13:13:15 +11:00
Campbell Barton
9e7fc240c9 PyAPI: add ImBuf.write_to_buffer for in-memory image encoding
Useful for sending images over a network without writing to a file first.
2026-03-16 13:13:15 +11:00
Campbell Barton
f50f5a5a20 Tests: Add Python API tests for the imbuf module
Test imbuf.new, properties, resize, crop, copy, free,
Python protocols (repr, hash, isinstance), and file I/O
(write, load, load_from_buffer).
2026-03-16 13:13:15 +11:00
Hans Goudey
fd92278798 Tests: Enable attribute existance check and update files, fix many tests
Previously the tests ignored cases where attributes didn't exist on one
of the meshes being compared. This makes a whole class of bugs invisible
to the tests. It also hid the fact that some of the test files were
completely useless; the expected object never had its modifier applied.

Mostly the changed attribute are the selection attributes, which as of
(years!) ago are propagated as generic attributes. There are a few other
cases like that too. I also had to clarify the behavior of the Points to
Vertices node which now doesn't create attributes for topology. I think
that's a better design anyway and they'll be created later if necessary.

Beyond that, a few more changes:
- Print the mismatched attributes in the geometry comparison
- Fix the names of the builtin mesh attributes
- Display attributes even for empty domains in the spreadsheet
- Don't create "sharp_face" on a circle without fill faces
- Don't "do_selection" when updating failed tests.
  This is just confusing and pointless

Pull Request: https://projects.blender.org/blender/blender/pulls/155546
2026-03-13 14:50:50 +01:00
Julien Duroure
fa8faef7fa Fix: glTF: Test Report outdir de-duplication
All 3 kinds of glTF (export, import, roundtrip) was set to same dir
So 3 glTF reports overwritten each others

Now, each kind of tests are generated in its own directory

Pull Request: https://projects.blender.org/blender/blender/pulls/155565
2026-03-12 15:41:14 +01:00
Miguel Pozo
7da2065b9d Fix #154166: Cycles: Raycast + Bump artifacts
The raycast node disables self intersection when the ray start is the
surface position.
However, this fails when evaluating bump.

This commit adds an extra offset to the ray start (tmin) when
evaluating bump.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/154222
2026-03-12 15:33:08 +01:00
Christoph Neuhauser
046b45b510 UI: Enable Vulkan tests by default
Pull Request: https://projects.blender.org/blender/blender/pulls/155180
2026-03-12 13:51:15 +01:00
Sybren A. Stüvel
37a9382484 Merge remote-tracking branch 'origin/blender-v5.1-release' 2026-03-10 14:48:36 +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
4c2a1cf285 Merge branch 'blender-v5.1-release' 2026-03-09 10:41:06 -07: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
Sean Kim
f686db875b Merge branch 'blender-v5.1-release' 2026-03-09 10:18:05 -07: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
Jeroen Bakker
a6f60f8657 Python: Added support for GPU python module in background mode
This commit adds an init method to the gpu module. It allows for a more
direct and intuitive way of enabling use of the gpu python module in
background mode.

Currently, a workaround exists to enable use of the gpu module which
involves calling the bpy.ops.render.render() operator. This is rather
uninituitive and hard to find. See `tests/python/modules/gpu_info.py`

Co-authored-by: tobias <tobiaskrantz33@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/155400
2026-03-09 09:04:35 +01:00
Sean Kim
900a78c416 Merge branch 'blender-v5.1-release' 2026-03-06 18:41:42 -08: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
Julian Eisel
5851a85cc5 Merge branch 'blender-v5.1-release' 2026-03-05 13:26:52 +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
Aras Pranckevicius
e64447670c Tests: VSE render test coverage for various color spaces
In preparation for delaying colorspace conversions until they
are needed (#119501), extend render tests to cover:
- Various color spaces in input media,
- Various operations done on them (blending, blurring, compositor adjustments),
- Various VSE working color space setups

Pull Request: https://projects.blender.org/blender/blender/pulls/155183
2026-03-05 10:01:02 +01:00
Brecht Van Lommel
420b3e403e Merge branch 'blender-v5.1-release' 2026-02-27 17:22:42 +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
Lukas Tönne
b1a865b347 Nodes: Preserve input values when ungrouping
Ungrouping a node group will currently discard any default input values
of the group node and any type conversions to and from the group node
sockets. This changes the behavior of nodes when ungrouping which is
undesirable.

This patch adds input nodes and implicit conversion nodes that store the
previous group input values and ensure the behavior of the group is
reproduced exactly.

1. If the group node has an unconnected input then the input value is
  stored in a constant input value node.
2. The same applies to constant output values inside the group, which
  are also copied to value nodes.
3. If the group uses an implicit input field then the equivalent node is
  added instead of a constant value.
4. If the group socket has incoming links and any internal or external
  connection requires conversion then a converter node is added.
5. Otherwise no conversion is needed and the internal and external
  sockets are connected directly as before.

Pull Request: https://projects.blender.org/blender/blender/pulls/151432
2026-02-27 15:13:40 +01:00
Jesse Yurkovich
4dc4a36bd7 Merge branch 'blender-v5.1-release' 2026-02-26 13:11:57 -08: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
356cf05b5a Merge branch 'blender-v5.1-release' 2026-02-26 17:35:52 +01:00