This commit adds a test for the situation in which a AOV pass is used
on a object with a fully or semi-transparent material, either using the
transparent BSDF directly, or mixing it with some other material.
Pull Request: https://projects.blender.org/blender/blender/pulls/141068
This commit moves Curves and Grease Pencil to use `AttributeStorage`
instead of `CustomData`, except for vertex groups. This PR mostly
involves extending the changes from the above commit for point clouds
to generalize to other geometry types.
This is mostly straightforward, though a couple non-trivial places of
note are the joining of Grease Pencil objects (`merge_attributes`), the
"default render fallback" UV for curves objects which was previously
unused at the UI level and just ended up being the first attribute, and
the `update_curve_types()` call in the curves versioning function.
Similar to:
- fa03c53d4a
- f74e304b00
Part of #122398.
Pull Request: https://projects.blender.org/blender/blender/pulls/140936
The issue was that the depsgraph was not rebuilt, thus
the driver node still stuck around. This then crashed when the
depsgraph evaluated.
The reason why this wasn't caught in the unit tests, was because the
depsgraph was not updated between creating and removing the data.
Pull Request: https://projects.blender.org/blender/blender/pulls/141272
Test for armature deform modifier settings that are not yet covered by other tests:
- Vertex Group vs. Envelope deformation and both combined.
- Vertex group masking ('vertex_group' setting of the modifier)
- Inverted vertex group masking
- Preserve Volume (dual quaternions)
- Vertex Group/Envelope influence mixing (bone option)
- B-Bone deformation
- Multi-modifier mixing
Each case has a new test/expected mesh pair in the modifiers test.
Pull Request: https://projects.blender.org/blender/blender/pulls/141054
This addresses issue #120949 to move compositor tests to reflect the
grouping used when adding a new node.
This PR only moves the relevant single tests and their renders into
matching directories. Folders such as 'multi-node setups' and
'pixel nodes' were not changed.
Pull Request: https://projects.blender.org/blender/blender/pulls/139757
This test replaces the existing multires modifier test with one that
subdivides the mesh and then compares the result. The existing one has
little purpose, as it applies a modifier with 0 subdivision levels.
Pull Request: https://projects.blender.org/blender/blender/pulls/140567
The `apply_modifiers` property of the `RunTest` class overrides
all of the test level `apply_modifier` properties. This prevents
modifiers from manually specifying when a modifier is applied and forces
the modifier to be applied immediately after it is added.
The vast majority of tests do not override the `apply_modifier`
property, the primary usecase for this property is to work in
combination with the `do_compare` property to allow examining the
corresponding .blend file to debug test failures.
This commit simplifies the settings by removing this parameter. It now
only disables applying the modifier if `do_compare` is set to False.
Pull Request: https://projects.blender.org/blender/blender/pulls/140893
This commit cleanly splits IDProperties storage for its two very different
usages:
* "User-defined" data, also known as "custom properties". Mostly exposed
in UI and as 'dictionary' in Python scripting, these are unique to each data
(each object can have its own set of custom properties).
* "System-defined" data, mainly as backend-storage for runtime RNA
structures and properties. While these are not necessarily present in the
storage, they are registered for a data type, and therefore always available
to all data of that type through RNA access.
See #123232 for rationales, designs and alternative investigated solutions.
## User-facing Changes
When using Blender, the only noticeable change is that python-defined RNA
data are not listed anymore in the Custom Properties panels (e.g. Cycles
data).
From a Python API perspective, the main changes are:
* Runtime RNA structs defined by sub-classing `PropertyGroup` and
registering them are no more accessible through the 'dict' syntax.
* They remain accessible through a dedicated 'bl_system_properties_get()`
callback, but its usages are only expected to be for testing and
debugging.
* The result of this call will be `None` by default when there has been
nothing written into it yet, unless its optional `do_create` parameter
is set to `True`.
* Some types (like `Node`, `UIList`, etc.) cannot store raw IDProperties
anymore (using the 'dict' syntax).
## Technical Details
* Adds System idprops to some data types (IDs, ViewLayer...).
* Moves some other containers (e.g operator properties, or some UI types like
UILists) to only have system-defined properties.
* For a few specific types (like `PropertyGroup`), the same storage is used,
but exposed in RNA as both user and system properties.
* Adds RNA API accessor callback to system idprops.
* Adds a function `bl_system_properties_get()`, which wraps system-defined
idprops and gives 'dict-like' access to them. Currently mainly used by some
unittests.
* System IDProps are always ignored by RNA diffing code (and therefore
liboverride processing), as their value is already exposed through RNA
properties, and should always be processed through these RNA properties.
* Modifies bpy rna binding to use these new system idprops for property
accesses, and keeps using user-defined idprops for 'dict-type' accesses.
* Handles versioning by copying 'user idprops' (existing ones) into new
'system idprops'.
### IDProperties Split
These types keep their historic IDProperty storage for user properties,
and get a new `system_id_properties` storage for system properties:
`ID`, `ViewLayers`, `Bone`, `EditBone`, `BoneCollection`, `PoseBone`, `Strip`
These types can both be extended with registrable RNA properties, and
expose Custom Properties in the UI.
### IDProperties become System Ones
These types keep a single IDProperties storage (their DNA struct does not
change), but it is now exclusively used for system-defined properties.
`OperatorProperty`, `View3DShading`, `UIList`, `AddonPreferences`,
`KeyConfigPreferences`, `GizmoProperties`, `GizmoGroupProperties`,
`Node`, `NodeSocket`, `NodeTreeInterfaceSocket`, `TimelineMarker`,
`AssetMetaData``
Since user properties were never available in the UI for them, they lose
their 'dict-like' IDProperties access in the Python API.
### Single Storage, Exposed as Both in API
These types still use a single IDProperty storage, but expose it both as
user properties and as system ones through RNA API.
* `PropertyGroup`: They need both access APIs since they are both
used for raw IDProperty groups (the 'dict-like' access), and
internally to access data of runtime-defined RNA structs.
* `IDPropertyWrapPtr`: Done mainly to follow `PropertyGroup`.
* `NodesModifier`: cannot become purely system idprops currently, as
there is no other access than the 'raw ID properties' paths to their
values. This can be changed once #132129 is finally implemented.
Pull Request: https://projects.blender.org/blender/blender/pulls/135807
This new file can parse the file header (first few bytes) as well as the block
headers.
Right now, this is used by two places:
* `blendfile.py` which is used by `blend2json.py`
* `blend_render_info.py`
This new module is shipped with Blender because it's needed for
`blend_render_info.py` which is shipped with Blender too. This makes using it in
`blendfile.py` (which is not shipped with Blender) a bit more annoying. However,
this is already not ideal, because e.g. `blend2json` also has to add to
`sys.path` already to be able to import `blendfile.py`.
This new file could also be used by blender-asset-tracer (BAT).
The new `BlendFileHeader` and `BlockHeader` types may be subclassed by code
using it, because it wants to store additional derived data (`blendfile.py` and
BAT need this).
New tests have been added that check that the file and block header is parsed
correctly for different kinds of .blend files.
Pull Request: https://projects.blender.org/blender/blender/pulls/140341
Caused by changes in da4eda148b. Did not realized we have a few
duplicate blend-file names in `tests/files`, these ended up stepping on
each other's toes at random during testing.
Now ensure that the generated temporary 'save & reload' blend-file names
are unique, by adding a hash of the whole file path.
Change the maximum data-block name from 64 to 256 bytes by increasing MAX_ID_NAME value.
Also increase a few related non-ID data name max size, essentially the action slots identifiers, as these are the primary key used to match an Action's slot to an ID by name.
Other sub-data (bones, modifiers, etc.) lengths are not modified here, as these can be made actual dynamic strings in the future, while keeping (a reasonable level of) forward compatibility, during the course of Blender 5 release cycles.
Implements #137608.
Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/137196
Fix#79163 bug related to the bevel operation producing disconnected UVs for
new bevel faces. This change replaces previous approach using scattered and
selective usage of functions: bev_merge_uvs, bev_merge_edge_uvs and
bev_merge_end_uvs with one coherent technique for all stages of the bevel operation.
It is utilizing a concept of loop (BMLoop) buckets to keep track of UV vertices
that should be merged at the end of bevel operation by a single call to
bevel_merge_uvs function. This approach doesn't touch initial UV position
calculation done by interpolation algorithm in bev_create_ngon function and
keeps the concept of representative faces (called frep, facerep or rep_face in
code) to help decide to which bucket specific loops should be assigned.
This is from PR https://projects.blender.org/blender/blender/pulls/139595,
which has more explanation and discussion.
Fix#79163 bug related to the bevel operation producing disconnected UVs for
new bevel faces. This change replaces previous approach using scattered and
selective usage of functions: bev_merge_uvs, bev_merge_edge_uvs and
bev_merge_end_uvs with one coherent technique for all stages of the bevel operation.
It is utilizing a concept of loop (BMLoop) buckets to keep track of UV vertices
that should be merged at the end of bevel operation by a single call to
bevel_merge_uvs function. This approach doesn't touch initial UV position
calculation done by interpolation algorithm in bev_create_ngon function and
keeps the concept of representative faces (called frep, facerep or rep_face in
code) to help decide to which bucket specific loops should be assigned.
This is from PR https://projects.blender.org/blender/blender/pulls/139595,
which has more explanation and discussion.
The `a + array_len > in.len` check was off-by-1 whenever accessing a
non-array property without raw access. This was because `array_len` was
actually the array length of the property, which is `0` for non-array
properties.
Given an array which was too short, this would cause the slower loop to
overrun the end of the array by one item. When getting items this would
cause a crash on a debug build with `Fatal Python error:
_PyMem_DebugRawFree: bad trailing pad byte`.
So use `item_len` instead, wichi is always set to `1` for non-array
properties.
Also do not assume that an `array_len` of `0` means that the property is
an array. While this may be true currently, it is cleaner and safer to
use the dedicated RNA API to check that.
This PR also adds some basic checks for expected failure of `foreach_set`
/`foreach_get` API when the provided array is too small.
Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/115967
The way these tests work is similar to the existing field inferencing tests.
There is a .blend file that is opened and then we check the inferred structure
types from Python. A new `NodeSocket.inferred_structure_type` property is added
to be able to access this information. Other then the field inferencing tests,
this patch does not directly check the socket shapes, which are not always
exactly determined by the inferred structure type.
This also fixes a few issues I found while adding the tests.
Pull Request: https://projects.blender.org/blender/blender/pulls/140520
This is replaced by geometry nodes, where volumes can now be generated from
point clouds and meshes with more control, and more efficient rendering as a
sparse volume.
No backwareds compatibility is provided, as this would be complicated, and
probably this feature was not used much in the past few years.
This node was supported in Cycles only, not by EEVEE.
Pull Request: https://projects.blender.org/blender/blender/pulls/140292
Adds a Point Instancing exporter based on the existing
USDPointInstancerReader. Covers both round-trip and Blender-native
workflows. Exports 'Instance on Points' setups as USDGeomPointInstancer,
supporting objects, collections, and nested prototypes.
A warning is shown during export if invalid prototype references are
detected. These would occur if an instancer attempts to instance itself.
This feature is currently gated behind an off-by-default export option
(`use_instancing`) as there are still a few cases which can yield
incorrect results.
Further details in the PR.
Ref: #139758
Authored by Apple: Zili (Liz) Zhou
Pull Request: https://projects.blender.org/blender/blender/pulls/139760
- Move `gtao_distance` to view layer and rename to
`ambient_occlusion_distance` (API change).
- Remove `gtao_quality` from the RNA (API change).
- Remove `use_gtao` (unused) from the RNA (API change).
- Rename `gtao_focus` to `fast_gi_bias` in the DNA (no API
change).
- Rename `gtao_resolution` to `fast_gi_resolution` in the
DNA (no API change).
Pull Request: https://projects.blender.org/blender/blender/pulls/140298
This changes the engine identifier back to `BLENDER_EEVEE`.
We keep the `BLENDER_EEVEE_NEXT` identifier around for
versioning reasons (have to detect when it is the active
engine of a older file).
This also rename a bunch of pannels that were using `next`
in their name.
This is a breaking change for Addons compatibility.
Pull Request: https://projects.blender.org/blender/blender/pulls/140282
While individual modes have UI tests related to undo, this new set of
tests in this new file is intended to be a set of very broad sanity
tests that catch the most egregious errors that cause crashing on start
up, whether due to python errors, UI rendering issues, or otherwise.
Running these tests takes approximately 4 seconds currently as it adds
and verifies the loading of each of the workspaces available "out of
the box" to a blender user.
Pull Request: https://projects.blender.org/blender/blender/pulls/139318
The 2D->2D, 3D->3D, 4D->4D hash functions used in Voronoi node were
using quite an expensive hash function. Switch these to dedicated
2D/3D/4D hash functions (pcg2d, pcg3d, pcg4d) -- these are still very
good quality, but the hash function itself is 3x-4x faster.
Which makes Voronoi node calculation overall be around 2x faster. In
some cases when using OSL, the speedup is even larger.
This visibly changes output of the Voronoi noise however. The actual
noise "behaves" the same, just if someone was depending on the noise
pattern being exactly like it was before, this will change the pattern.
Images, more performance results and details wrt OSL are in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/139520
It is possible for a mesh to change topology across frames but still be
detected as not needing a topology update.
Until we can make a finer-grained check against the before and after
topology, unconditionally ensure it's updated for now.
Adds a new test that checks a few frames of changing topology that is
similar, but not the same.
Pull Request: https://projects.blender.org/blender/blender/pulls/140253
Current NURBS evaluation handles corners or sharp angles poorly. Sharp
edges appear when a knot vector value is repeated `order - 1` times.
Users can make sharp corners by creating NURBS curve with `Bezier` knot
mode or by setting `order` to 2 for legacy curves. The problem occurs
because current algorithm takes all the curve's definition interval,
divides it into equal parts and evaluates at those points, but corners
are exactly on repeated knot's. To hit those, the resolution has to be
increased higher than required for the rest of the curve.
The new algorithm divides non zero length intervals between two adjacent
knots into equal parts. This way corners are hit with a resolution of 1.
This does change the evaluated points of NURBS curves, which is why some
test results have to be updated in this commit.
Pull Request: https://projects.blender.org/blender/blender/pulls/138565
This commit implements #125759.
It removes:
* Blender does not build on big endian systems anymore.
* Support for opening blendfiles written from a big endian system is
removed.
It keeps:
* Support to generate thumbnails from big endian blendfiles.
* BE support in `extern` or `intern` libraries, including Cycles.
* Support to open big endian versions of third party file formats:
- PLY files.
- Some image files (cineon, ...).
Pull Request: https://projects.blender.org/blender/blender/pulls/140138
This commit adds 9 tests that check each of the default brush curve
strength preset options to ensure that none of them cause NaN
propagation. In total this takes approximately 0.7s to run to run.
By design, these tests are very broad and are not a replacement for
other testing, but they should help in reducing the chance of potential
regressions.
Related to #140162
Pull Request: https://projects.blender.org/blender/blender/pulls/140242
when there is no uv, we call the function `map_to_sphere()` to create
temporary uv for computing the tangent. It could happen that a triangle
has vertices with the u coordinates going across the line where u wraps
from 1 to 0. In this case, just computing the difference of the u
coordinates results in the wrong triangle area.
To fix this problem, we compute distance in toroidal (wrap around)
space.
This is safe for coordinates generated by `map_to_sphere()` function,
because it is not supposed to map the positions of a triangle to u
coordinates that span larger than 0.5.
Pull Request: https://projects.blender.org/blender/blender/pulls/139880
This commit renames the python Brush properties that end with `_tool` to
`_brush_type` (e.g. `sculpt_tool` -> `sculpt_brush_type`) to better
distinguish the property from the concept of tools in a workspace
context.
Resolves#124201
Pull Request: https://projects.blender.org/blender/blender/pulls/139909
When dissolving an edge merges faces, use an angle threshold before
dissolving vertices from the face which have become chains as reult
of the merge (connected to 2 edges).
Also fix edge-flag handling when dissolving multiple edges
from a chain into a single edge, previously flags from the
resulting edge was effectively random.
Now flags from all edges are merged.
Resolves#100184.
Ref !134017
A small number of USD files in the wild contain invalid face index data
for some of their meshes. This leads to asserts in debug builds and
crashes for users in retail builds(sometimes). There is already an
import option to Validate Meshes but it turns out that we, and most
other importers, perform validation too late. We crash before getting to
that validate option (see notes).
This PR implements a cheap detection mechanism and will auto-fix if we
detect broken data. The detection may not find all types of bad data but
it will detect what is known to fail today for duplicate vertex indices.
We immediately validate/fix before loading in the rest of the data. The
downside is that this will mean no additional data will be loaded.
Normals, edge creases, velocities, UVs, and all other attributes will be
lost because the incoming data arrays will no longer align.
It should be noted also that Alembic has also chosen this approach. It's
check is significantly weaker though and can be improved separately if
needed.
If auto-fix is triggered, it will typically appear as one trace on the
terminal.
```
WARN (io.usd): <path...>\io\usd\intern\usd_reader_mesh.cc:684
read_mesh_sample: Invalid face data detected for mesh
'/degenerate/m_degenerate'. Automatic correction will be used.
```
A more general downside of these fixes is that this applies to each
frame of animated mesh data. The mesh will be fixed, and re-fixed, on
every frame update when the frame in question contains bad data.
For well-behaved USD scenes, the penalty for this check is between 2-4%.
For broken USD scenes, it depends on how many meshes need the fixup. In
the case of the Intel 4004 Moore Lane scene, the penalty is a 2.7x
slowdown in import time (4.5 s to 12.5 s).
Pull Request: https://projects.blender.org/blender/blender/pulls/138633
In the render test suite there is an OSL folder that contains tests that
need OSL to function.
Previously due to some missed logic, the OptiX OSL test suite would not run
tests in that folder because part of the test code assumed that if you aren't
testing on a CPU, then your device doesn't support OSL.
This commit fixes this issue.
Along with this change, some logic was changed in preparation for allowing
OptiX OSL camera tests to run without OSL shading enabled.
Pull Request: https://projects.blender.org/blender/blender/pulls/139433