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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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