Many of the modifier tests run off of a monolithic `modifiers.blend`
file via the `modifiers.py` test file. Because test data is stored in
the blend file, merging is particularly troublesome, which is
particularly exacerbated when porting changes to the LTS branch.
To begin mitigating this problem, in preparation for adding more
multires modifier tests, this commit extracts the existing test and test
objects into their own files into the
`tests/python/modeling/modifiers` folder.
Additionally, a new helper `main` method is added to `mesh_test.py`
to reduce duplication across files that will follow this format.
Pull Request: https://projects.blender.org/blender/blender/pulls/153108
Allow retrieving values from non-field lists. Though there is currently
no way to build non-field-type lists, this is a first step split from #148017
that will unblock other list nodes. The "Get List Item" node is changed to
allow retrieving single values for lists containing non-field types, and a
restriction for choosing the list structure type for many socket types is
removed too.
Pull Request: https://projects.blender.org/blender/blender/pulls/153055
Give BPY access to Blender's cache directory, via `bpy.app.cachedir`.
This is similar to the already-existing `bpy.app.tempdir`.
This is needed for the Remote Asset Library system, to be able to
cache data from Python without having to re-implement the same logic
there.
```py
import bpy
print(bpy.app.cachedir) # '/home/sybren/.cache/blender/'
```
Ref: #47684
Pull Request: https://projects.blender.org/blender/blender/pulls/152779
Allow the USD curves writer to export empty curve objects. Notably this
fixes a crash for old-curve objects and allows for animations where some
frames contain splines and some do not.
Because curve objects are just containers for any type of curve,
animated setups where the very first frame contains 0 splines may export
incorrectly. USD needs to know what type of curve it is (catmullRom,
bezier, poly, etc.) when defining the Prim, but if the object contains 0
splines, then we don't know what it should be. For this situation we
have a fallback where old-curves default to bezier and new-curves
default to catmullRom. All subsequent frames must only have curve types
matching the fallback.
Pull Request: https://projects.blender.org/blender/blender/pulls/152752
This test exercises a common pair of mask operations in sculpt mode, a
dense mesh is created, the sculpt expand operator is used to mask a
region starting from the center, and then this region is inverted.
Pull Request: https://projects.blender.org/blender/blender/pulls/151875
The group operator test has to distinguish internal from external nodes.
The operators are only applied to internal nodes.
This was done previously by placing external nodes outside of the frames which
identify the test cases. However, the pass-through operator test does not work
this way, because after ungrouping there are no internal sockets any more, and
the pass-through connection between external sockets is never actually tested.
Change the approach to identifying external sockets by labeling:
- All nodes for a test case must be included in the frame node.
- Nodes that should not be grouped must be labeled as "external".
Pull Request: https://projects.blender.org/blender/blender/pulls/152762
The order of attributes is mostly implementation defined at the moment,
based on the order of CustomDataType definitions and the order that each
CustomData struct happens to be referenced in. For #122398 this order
may change to creation order which is sometimes different. To avoid
testing the order of attributes in the list, sort the names first in
the mesh text representations, and update the references accordingly.
Pull Request: https://projects.blender.org/blender/blender/pulls/152728
These are cases found during refactoring of node group operators that are
currently lacking test coverage.
- Extension sockets: Grouping of nodes with extension sockets (e.g. Bake or
Capture Attribute nodes) should just ignore these sockets.
- Pass-through node groups: Directly connecting a group node input to a group
node output should simply connect external links directly to each other.
To support the "pass-through" test case the test script must be modified.
This test starts out with an existing node group with no content except the
pass-through socket connection. Instead of initially grouping this node,
the `make_group` operator should be skipped and the group node used directly
as the test data for ungroup/separate.
To this end the test cases are now listed explicitly in the test script,
instead of finding test cases based purely on frame nodes in the blend file.
This way each test case can be associated with additional options.
The `NODE_GROUP` option is used to indicate that the frame content is already
a node group and should be skipped by the `make_group` and `group_insert`
operators.
This removes the remaining legacy action code, that includes any unit tests for
legacy actions.
The only place that still deals with legacy actions is the versioning code.
I left the RNA functions `is_action_legacy` and `is_action_layered` in
place to not cause a breaking change for addons. However the functions
are now just hardcoded to return false and true respectively.
Part of #150644
Pull Request: https://projects.blender.org/blender/blender/pulls/152526
The UsdPreviewSurface has odd semantics related to its `opacity` input
where it is not only used for translucency/transmission but also for
so-called "alpha cutouts", despite the fact that the UsdPreviewSurface,
and all other USD surfaces, not having an actual Alpha input.
Up until this PR we were only considering the alpha cutout type networks
rather than transmission, which has meant we could never import/export
something like glass. Additionally, `opacity` is the inverse of
`transmission weight`, which is used on all other, modern, material
surfaces, which massively complicates export and import. We have to
invert the opacity <-> transmission values/graphs to properly handle it.
This PR will handle some very simple networks where things are plugged
into our Transmission Weight socket.
Like all other material network support, processing here is limited to
the usage of the Principled BSDF. Direct usage of e.g. a Glass BSDF node
is not supported.
Tests updated to include "constant" opacity values as well as several
texture-based networks (see screenshot).
Ref: #100452
Pull Request: https://projects.blender.org/blender/blender/pulls/152546
Adds a few more test cases for behavior of group operators wrt.
socket links to external (unselected) nodes.
Also changes socket link testing by using unordered sets, so that a difference
in link order no longer breaks the test. Link order can change when the test
generator attaches resulting nodes to a frame and it should have no effect.
- Outputs with multiple outgoing connections were not tested yet.
- "Internal" links between selected nodes were not tested yet.
- Grouping single nodes uses a separate code path and should be tested as well.
- Multi-input sockets are not supported in groups and get converted into
multiple group input sockets.
- Hidden sockets are not exposed in some code paths.
Pull Request: https://projects.blender.org/blender/blender/pulls/152516
This commit adds a new brush type and essential asset for blurring color
in Sculpt Mode. This replaces the previously hard-coded functionality
in the smear and paint brushes.
- Addition of the `SCULPT_BRUSH_TYPE_BLUR` to `eBrushSculptType`.
- Definition and Implementation of `color::do_blur_brush`, called within
`do_brush_action`.
- Addition of `SCULPT_BRUSH_TYPE_BLUR` to
`rna_enum_brush_sculpt_brush_type_items`, exposing it as an option
within the essential assets file.
- Changes to `assets/brushes/essentials_brushes-mesh_sculpt.blend` file,
to now include the `Blur` brush.
Pull Request: https://projects.blender.org/blender/blender/pulls/152351
Frame nodes need to be handled correctly in group node operators. This adds a
test with one simple and one nested frame to ensure the frame nesting is
preserved after applying group node operators.
It also fixes small issues with the test script to ensure node tests pass when
only the order of nodes changes. The order of nodes can differ between the
generated case and the test code when attaching generated nodes back to the test
case frame, but this should not affect the validity of the test. Compare nodes
by name instead of relying on a fixed order in the node tree collection.
Pull Request: https://projects.blender.org/blender/blender/pulls/152578
This adds tests for a number of related operators:
- `node.group_make`
- `node.group_ungroup`
- `node.group_insert`
- `node.group_separate`
The tests are based on a blend file with a wide range of nodes and sockets, testing various features like types, UI options, and other settings. The file also contains "ground truth" data in the form of node groups, which the operator results are compared against.
Test cases are organized using frame nodes: any nodes inside a top-level frame are considered a sub-test and are grouped together.
The `Tests` node tree contains the user-defined test cases. Ground truth data for comparison is generated from the `Tests` tree, by passing a `--generate` argument to the test script. This creates a derived node tree for each of the main operators, applying the operator to each of the sub-tests frames.
Example invocation:
`./bin/blender --background --factory-startup --python ../blender/tests/python/bl_node_copy_operators.py
-- --testdir ../blender/tests/files/node_group --generate`
Generated node trees are also linked in modifiers of the main `TestObject` in the scene. This is necessary for the `group_separate` operator which requires a valid editor _tree path_ to copy or move nodes into the parent tree. It's also convenient for selecting and comparing generated node trees.
Pull Request: https://projects.blender.org/blender/blender/pulls/151785
Adds three tests:
* Clearing a mask removes the .sculpt_mask attribute
* Inverting a mask performs the operation correctly
* Inverting a non-existent mask fills the mesh with empty values
Pull Request: https://projects.blender.org/blender/blender/pulls/151870
Controlled via BLENDER_TEST_FILTER environment variable which has the
same semantic as GTest's --gtest-filter:
BLENDER_TEST_FILTER=POSITIVE_PATTERNS[-NEGATIVE_PATTERNS]
Run only the tests whose name matches one of the positive patterns but
none of the negative patterns. '?' matches any single character; '*'
matches any substring; ':' separates two patterns.
A lowercase stem of a blend file is used for filtering.
Examples
Run only underwater caustics test on CPU, ignore the rest of the
integrator tests:
BLENDER_TEST_FILTER="underwater_caustics" ctest -R "cycles_integrator_cpu$" -V
Ignore any caustics test:
BLENDER_TEST_FILTER="-*caustics" ctest -R "cycles_integrator_cpu$" -V
Pull Request: https://projects.blender.org/blender/blender/pulls/152268
When in Texture Paint mode or in the image editor, certain actions do
not push undo steps (e.g. changing the active texture) that users would
expect. Additionally, some actions that *do* push undo steps (e.g.
changing face selection) have no effect when undone.
To fix the former, remove the code preventing property changes from
pushing undo steps while in Texture Paint mode.
To fix the latter, remove the poll function from `image_undo.cc`. This
prevents global undo steps from being tagged as image undo steps.
This works because the `poll` function is only needed when creating the
undo step to identify steps that do not have a `step_init` defined.
This is similar to, but notably different from !139871:
Image Undo (and Sculpt Undo) store deltas encoded as part of the undo
step and require explicit tagging of the begin and end state (see
`ED_image_undo_push_begin` and `ED_image_undo_push_end`). This allows
us to use memfile undo in the general case and image undo when
explicitly requested, avoiding the memory concerns of the previously
linked PR.
Addresses: #69346, #62520, #71895
Pull Request: https://projects.blender.org/blender/blender/pulls/151399
If `displayColor` was used with an interpolation type other than
'vertex', we would attempt to apply the attribute to the faces of the
mesh before we actually built those faces.
Read in the color information once the mesh has been fully built.
This would assert in debug builds and write to invalid memory locations
in retail.
Pull Request: https://projects.blender.org/blender/blender/pulls/152141
Replace 'touching' a file with an explicit increment of its
last-modified timestamp by one hour.
The test was flaky because it assumed a 'touch' would change the file's
last-modified timestamp. However, the last actual modification and the
'touch' could happen closer together than the filesystem's timestamp
resolution.
Pull Request: https://projects.blender.org/blender/blender/pulls/151914
Introduce a way to efficiently hash files, and to check whether a file
on disk matches an expected hash. "Efficient" here means that the
hashes are cached, and the cached value is returned when the file on
disk still has the same size & last-modification timestamp.
This was made for the [Remote Asset Libraries project][1]. In the
future, this system will also be used for the [BAT v2 project][2], as
that also will need to compute hashes for files.
[1]: https://projects.blender.org/blender/blender/issues/134495 [2]:
https://projects.blender.org/studio/flamenco/issues/104437
This PR introduces the following classes:
- `DiskFileHashService`: The top-level 'service' instance that's meant
to be used by other code. Takes care of computing hashes for files.
It can cache these hashes, and check them for 'freshness' based on
the file's size in bytes and last-modified timestamp.
- `DiskFileHashBackend`: Protocol class that defines the API for file
hash storage backends.
- `SQLiteBackend`: Implementation of that protocol, using SQLite as a
way to store hashes.
More info in the PR.
Pull Request: https://projects.blender.org/blender/blender/pulls/151497
Move several tests from manual validation into the compare framework.
This reduces overly verbose and sometimes difficult to understand python
code in exchange for an easier to read textual representation of
everything that was imported.
Only tests where the validation would be the same or better were
considered.
Minor changes to the io_report module were done to support this like
dumping `UDIMTile` information as well as escaping the generated report
data so file paths like `test_grid_<UDIM>.png` would show correctly.
Pull Request: https://projects.blender.org/blender/blender/pulls/151748
ParticleSystem hair was being exported as linear catmullRom rather than
as cubic catmullRom. Found while moving this test from manual validation
to the compare framework (in a separate PR).
Pull Request: https://projects.blender.org/blender/blender/pulls/151645
The bspline curve type was untested and had issues loading in 'varying'
curve widths (it would access invalid width values). The 'varying'
interpolation is, in general, not well supported in Blender for this
type but we can be safer and get much closer to ground-truth if we load
in the width values more carefully.
Add test coverage too.
Pull Request: https://projects.blender.org/blender/blender/pulls/151598
This commit adds a set of basic tests for all bundled brushes in
Sculpt, Vertex Paint, and Weight Paint. For each brush, we store the
initial state of the mesh, perform a stroke, and then compare the final
state of the mesh.
The attribute being compared is dependent on the mode and brush being
used. In general we verify that the attribute has changed since the
initial state, and that it is valid.
This does not yet enumerate each of the special modes for some brushes
nor does it handle certain classes of brushes (sculpt simulation) or
brushes that may have more specific requirements for positioning.
This currently only works on a mesh, though more dimensions (e.g.
multires, modifiers, dyntopo) should be added.
This is intended to work in tandem with the general render tests:
these unit tests can enumerate many possible permutations, whereas
the render tests can verify the appearance of a deformation.
Pull Request: https://projects.blender.org/blender/blender/pulls/151336
The issue was the `--gpu-backend` argument was passed to the python
script and not to Blender. This is because `blender_test` calls blender
first and then runs the test script inside it, whereas a `python_test`
calls blender with the provided python arguments.
The command `gpu.platform.backend_type_get()` was used to verify the
correct gpu backend was used.
Pull Request: https://projects.blender.org/blender/blender/pulls/151478
Initial implementation of client side decorations (CSD) as a replacement
for LibDecor integration.
The main focus is for basic functionality, drawing is fairly simple.
The implementation supports:
- Wayland (only).
- Hi-DPI & fractional scaling.
- Mouse, tablet & touch input.
- Blender windows and the animation player.
Event handling:
- Right click on the title-bar to show the menu.
- Double-click on the title-bar to maximize.
Details:
- Events on the decorations still generate GHOST events,
in practice they don't map to a area/region and are only handled
as decorations.
- Events are ignored by the decorations when the cursor is grabbed.
- Existing icons are used for buttons were a close match from the
existing icons, we may want to add icons for better control over
the buttons look.
- The animation player uses CSD as an overlay, showing the decorations
on hover over the upper part of the window.
Resolves: #144919, #108308, #107797.
See design task #113795.
Ref !148350
This change adds support for importing and exporting accessibility
metadata to USD.
Details:
USD supports authoring accessibility metadata via the UsdUIAccessibilityAPI
schema. Two methods for authoring accessibility metadata are supported:
1) An accessibility label and description can be specified directly in
the USD export options via two new string export fields This data will
be set on the default prim of the exported stage and will have a
"standard" priority.
2) Accessibility data can be authored in the Blender object's Custom
Properties which will be written to the corresponding USD prim during
the export. If creating custom properties, the property name must be
defined in the following format:
- accessibility:\<namespace\>:label
- accessibility:\<namespace\>:description
- accessibility:\<namespace\>:priority
Since the AccessibilityAPI is a MultipleApply schema, the namespace
can specify an intended purpose for the accessibility metadata.
Note: Although the AccessibilityAPI schema supports time-samples,
Blender STRING properties are not keyframe-able, so this change only
writes default attribute values without any time-samples.
On import, the accessibility properties are populated back into the
object's Custom Properties.
Authored by Apple: Dan Knowlton
Pull Request: https://projects.blender.org/blender/blender/pulls/149682
Add unit tests for evaluation of shape keys.
This covers #150710
and should give more confidence for that rewrite.
Unfortunately the tests fall short for anything that is not a mesh since
I do not get the evaluated coordinates via the python API. See #150973.
Pull Request: https://projects.blender.org/blender/blender/pulls/150983
It's possible for certain constructs in USD to result in
non-deterministic patterns in Blender across different imports (or the
same import if there are other identical constructs in the file). For
example, given a USD prim hierarchy at path `/root/A/A`, this can result
in either an object hierarchy of `A/A.001` or `A.001/A` in Blender.
This is mostly due to our sorting step which attempts to work around
inefficiencies when creating large amounts of objects; creating them in
order by name is faster. Since the incoming names are the same, e.g `A`
and `A`, sometimes the order is swapped.
To make things consistent now, and to alleviate problems in the future
with concurrent import, it's important to keep the order stable. We
break the tie on name by using the original USD path instead.
Pull Request: https://projects.blender.org/blender/blender/pulls/151281
This PR adds to possibility to get the radiance behind an object using
the Shader To RGB workflow.
The result of this operation depends on the type of material.
- Dithered Material with Raytraced Transmission **off** will sample the nearest probe.
- Dithered Material with Raytraced Transmission **on** will show Dithered Materials
with transmission **off** or fallback to nearest probe.
- Blended Material will show all Dithered Material materials or fallback to nearest probe.
This covers some workflows that were possible before 4.2 (which
were relying on the refraction BSDF).
This removes the `use_combined_lightprobe_eval` optimization which was defaulting
all Dithered Material to be in the same layer when raytracing was off.
We cannot do that anymore since this transparency feature requires clear separation
between the two material types (Raytraced Transmission on/off).
We could eventually reintroduce it by changing the way the submission is done when
there is no shader to rgb in the scene.
Pull Request: https://projects.blender.org/blender/blender/pulls/149723
by using a loop instead of unrolling all 64 evaluations.
Seems that two nested loops has the best performance.
Compilation time measured on Metal M2 Ultra:
| Kernel| Before| After|
| --| --| --|
| integrator_shade_volume|148.13s|114.71s|
|integrator_shade_volume_ray_marching| 44.30s| 14.27s|
| integrator_shade_shadow| 87.83s| 58.82s|
| shader_eval_volume_density| 32.69s| 6.63s|
Also added test file because we were not testing deterministic tricubic
interpolation before
Ref: #150119
This commits add three new opcodes to the secure opcode list.
These are:
RETURN_CONST
POP_JUMP_IF_FALSE
CALL_INTRINSIC_1
I removed the "f''" test as that now only uses the RESUME and
RETURN_CONST opcodes.
Pull Request: https://projects.blender.org/blender/blender/pulls/150650