Commit Graph

1205 Commits

Author SHA1 Message Date
Jesse Yurkovich
46ec277713 USD: Add support for UsdPrimvarReader_TYPE in materials
Add support for the UsdPrimvarReader_TYPE templates for both import and
export. These are used by several USD test assets and support here
represents the last major piece of the UsdPreviewSurface spec to be
implemented.

On import these become `Attribute` nodes and on export the `Attribute`
nodes will become `UsdPrimvarReader_TYPE`'s accordingly.

Import:
- `UsdPrimvarReader_float` and `UsdPrimvarReader_int` will use the `Fac`
  output
- `UsdPrimvarReader_float3` and `UsdPrimvarReader_float4` will use the
  `Color` output
- `UsdPrimvarReader_vector`, `UsdPrimvarReader_normal`, and
  `UsdPrimvarReader_point` will use the `Vector` output

Export (only `Geometry` Attribute types are considered):
- `Fac` will use `UsdPrimvarReader_float`
- `Color` will use `UsdPrimvarReader_float3`
- `Vector` will use `UsdPrimvarReader_vector`
- `Alpha` is not considered

MaterialX note:
Hydra-native support is a bit more involved and will have to be done
separately. Hydra w/USD sync is trivial to implement but those changes
have been left out here.

Pull Request: https://projects.blender.org/blender/blender/pulls/135143
2025-05-19 19:47:22 +02:00
Jacques Lucke
16ad67d34c Tests: have test_object active by default in regression test files
When opening Geometry Nodes regression test files I always find a bit annoying
that the `expected_object` and not the `test_object` is active. That's because
only the `test_object` contains the modifier or node tree that is being tested.
Therefore, usually my first step when opening these files is to select the
`test_object` first.

This patch changes it so that when mesh tests are updated, the `test_object` is
made active in the end before the file is saved again.

Pull Request: https://projects.blender.org/blender/blender/pulls/139088
2025-05-19 15:38:17 +02:00
Sean Kim
9e1e9b0859 Paint: Add toggle support for brush.asset_activate
This commit adds a toggle functionality to the `brush.asset_activate`
operator that makes it behave similarly to the `paint.brush_select`
parameter of the same name.

When the operator has this option enabled, using the operator or
pressing the relevant key will either:
* Activate the specified brush and store it if the current brush does
  not match the specified brush
* Activate the previously stored brush if it exists.

This option is exposed in the keymaps and enabled by default for the
Sculpt Mask brush.

This allows, for example, users to press 'M' to switch to the mask brush
and then press 'M' again to switch back to their previously active
brush.

Partially addresses this RCS submission: [1]
[1] https://blender.community/c/rightclickselect/1VwZ/

---

### Notes
This commit does not currently clear the `AssetWeakReference` when switching paint modes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138845
2025-05-16 23:25:45 +02:00
Jesse Yurkovich
3b2bbad609 USD: Add support for Text objects during export
Similar to the existing meta-ball export, and the other exporters,
convert Text objects to meshes for export.

Ref #138883

Pull Request: https://projects.blender.org/blender/blender/pulls/138903
2025-05-16 22:12:48 +02:00
Michael B Johnson
af0cfcb01c MaterialX: Export Principled BSDF as OpenPBR Surface
Switch from Standard Surface to OpenPBR as the exported MaterialX surface,
since this is the new standard more renderers are adopting and it more closely
matches the Principled BSDF implementation.

Anisotropy support is improved though still not quite the same, as formulas
are different. Nodes are generated to apply anisotropic rotation to the
tangent vector, as there is no corresponding parameter in OpenPBR.

Fixes #138164

Authored by Apple: Lee Kerley

Pull Request: https://projects.blender.org/blender/blender/pulls/138165
2025-05-15 19:13:36 +02:00
Nathan Vegdahl
8a984f4f4e Anim: Add "replace" mix mode to the Action Constraint
The available mix modes on the Action Constraint only allowed
*combining* the Action's transforms with the input transforms, but
unlike most other constraints lacked a way to completely
override/replace those transforms.

This PR adds a "Replace" mix mode to the Action Constraint, bringing it
in line with most of the other constraints already in Blender.

![action_constraint_replace_mode_screenshot.png](/attachments/51fb09d6-0a87-42dc-a75e-9ae81c856796)

----

Test file: [action_constraint_replace_mode.blend](/attachments/fc3417a8-b60a-4212-9840-5b59191e9ed9)

- The small bone at the top is the action constraint target (translating it right-left triggers the action constraint).
- Both two-bone chains are set up with action constraints.  The base bones of each chain additionally have a copy location constraint to the small sideways bone, placed before the action constraint in their constraint stack.
- The chain on the left has the default mix mode, which allows you to manipulate the bones on top of what the action constraint does, and allows the copy location constraint on the base bone to work.
- The bones on the right have the new "Replace" mix mode, and therefore manipulating them does not affect the final constrained transformation, and the copy location on the base bone is overridden by the action constraint.

Pull Request: https://projects.blender.org/blender/blender/pulls/138316
2025-05-15 14:30:01 +02:00
Omar Emara
79d37720de Nodes: Add Factor and Percentage subtypes for vector sockets
This patch adds support for the Factor and Percentage subtypes for
vector sockets. This is needed by the compositor, since it has some node
inputs that specify locations and sizes relative to image size, and
having factor and percentage subtypes for those improves the UX quite a
bit according to user feedback.

Pull Request: https://projects.blender.org/blender/blender/pulls/138805
2025-05-15 08:29:41 +02:00
Alaska
1c1e2f1371 Fix: Render test failures when building without fluid modifier
When building Blender WITH_MOD_FLUID=OFF, the OpenVDB render tests
would fail as some of them make use of the WITH_MOD_FLUID features.

This commit fixes this by disabling OpenVDB render tests unless
WITH_MOD_FLUID is active.

Pull Request: https://projects.blender.org/blender/blender/pulls/138728
2025-05-13 05:07:45 +02:00
Aras Pranckevicius
a96ecd2834 Fix #137768: new FBX importer does not import some animations correctly
- FBX "root bone" should become the Armature object itself, and not
  an extra bone (follow same logic as Python importer did).
- "World to armature matrix" was not correct for armatures that are
  parented under some other objects with transforms.
- Parenting imported meshes under an Armature was not taking into
  account that the mesh bind transform might not be the same as the
  current mesh node transform (i.e. was not setting "matrix parent
  inverse" to compensate like the Python importer did).
- The repro file in #137768 also exposed an issue that importing custom
  vertex normals was not working correctly in the new importer, when
  mesh is partially invalid (validation alters the mesh, custom normals
  have to be set afterwards).

Pull Request: https://projects.blender.org/blender/blender/pulls/138736
2025-05-12 10:56:07 +02:00
Jacques Lucke
18365a88bd Geometry Nodes: initial Import node regression tests
This adds some basic tests for the Import OBJ/STL/PLY nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/138700
2025-05-10 07:24:33 +02:00
Sergey Sharybin
bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00
Jesse Yurkovich
bf6c847464 Tests: USD: Run the compliance validator for the MaterialX export test
We recently pulled in the upstream patch to address the incorrect
validation error we were experiencing. This was the only test which
previously required the validator to be disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/138289
2025-05-02 06:19:28 +02:00
Clément Foucault
877abbe9f7 Cleanup: EEVEE: Remove next from EEVEE-Next from tests suite
It makes no sense to keep this suffix now that eevee-next is default.

Pull Request: https://projects.blender.org/blender/blender/pulls/138271
2025-05-01 17:54:22 +02:00
Michael B Johnson
79c318f692 Fix #137973: Add MaterialX version info on USD export
This change adds MaterialX version information to the exported MaterialX
USD materials.

Details:

In USD 25.02, the MaterialXConfigAPI schema was introduced to allow
recording the MaterialX version used to author a material. When loading
MaterialX documents into USD, this schema is automatically applied and
the associated version attribute is created on the material.

Due to how the MaterialX export works (via copying the composed
MaterialX spec from a temporary stage), the MaterialXConfigAPI needs to
be explicitly applied to the final material being exported.

This change applies this MaterialXConfigAPI schema and copies the
version attribute from the temporary MaterialX stage to the final stage.

Authored by Apple: Dan Knowlton

Co-authored-by: Dan Knowlton <d_knowlton@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/137974
2025-04-30 19:54:17 +02:00
Lukas Stockner
be4268ec1c Tests: Cycles: Remove OSL-specific displacement test after fix to match SVM
Since commit 175686f2, the behavior of OSL now matches SVM, so instead of this
separate test this is handled by the regular test and the "does OSL match SVM"
checks.
2025-04-28 14:53:05 +02:00
Lukas Stockner
54b156bf16 Cycles: Add support for automatic bump mapping on OptiX OSL
All the required parts are already there, just needs to be hooked up.
This is essentially just copying what `osl_eval_nodes<SHADER_TYPE_SURFACE>`
does on the CPU.

Fixes #104276.

Pull Request: https://projects.blender.org/blender/blender/pulls/138044
2025-04-28 12:47:31 +02:00
Jesse Yurkovich
ba60868477 USD: Animated camera property import
Imports in the following animated data from UsdGeomCameras:
- Focal length
- DOF distance
- DOF fstop
- Clip start, Clip end
- Tilt shift x, Tilt shift y
- Aperture sizes (with caveats)

Implementation wise, it's more complicated than I'd like due to needing
to read in both non-animated and animated data for each property. And
because I've tried to reduce the duplication of various transforms we
have to do on each value. E.g. scaling values by "tenth of scene units"
or the extraction of the USD clipping range from a GfVec2f into 2
separate properties, and 2 separate fcurves, in Blender etc. The current
approach was the best I could come up with so far.

Aperture sizes remain problematic for import, with animation data and
without, due to how Blender selects the largest sensor dimension to base
downstream calculations on and for which there's no concept in USD to
strictly dictate which dimension to use. Additionally, changing the
sensor size will impact the Tilt values as well. This means that if the
Aperture sizes are animated, we must also animate the tilt values; leads
to more fcurves being created than perhaps expected.

The `projection` attribute (perspective and orthographic) remains
unchanged (non animated only) due to differences in how USD<>Blender
interoperate with the Orthographic projection method. Note: Blender only
exports perspective cameras due to the same reason.

Pull Request: https://projects.blender.org/blender/blender/pulls/137487
2025-04-25 19:57:12 +02:00
Sean Kim
e27be7cfc6 CMake: Rename and expose 'USE_EXPERIMENTAL_TESTS' option
The `USE_EXPERIMENTAL_TESTS` variable was not exposed as an option, so
the two tests that use the option to check whether tests should be run
had to be manually enabled by changing `tests/python/CMakeLists.txt`.

This commit renames the variable to `WITH_TESTS_EXPERIMENTAL`, defaults
the option to `OFF`, and marks it as an advanced option.

Pull Request: https://projects.blender.org/blender/blender/pulls/133831
2025-04-24 06:11:30 +02:00
Brecht Van Lommel
df053e290d Fix #137621: Cycles curve info random gives wrong value
Caused by filter width changes in 5ce239cc229931b8225.

Pull Request: https://projects.blender.org/blender/blender/pulls/137671
2025-04-17 19:15:05 +02:00
Aras Pranckevicius
67063d3c4d Tests: switch FBX import tests to use the new importer
Pull Request: https://projects.blender.org/blender/blender/pulls/137590
2025-04-16 13:01:46 +02:00
Sean Kim
65b84a97de Tests: Add tests for object.voxel_remesh
Pull Request: https://projects.blender.org/blender/blender/pulls/137378
2025-04-16 07:01:24 +02:00
Clément Foucault
dde18802a5 GPU: Remove WITH_GPU_RENDER_TESTS_SILENT option
This was introduced during EEVEE-next developement
cycle to not make the buildbot fail because of EEVEE
render tests.

These have stabilized now and we can remove this option.

Pull Request: https://projects.blender.org/blender/blender/pulls/137545
2025-04-15 17:56:16 +02:00
Alaska
21add72f31 Tests: Add Cycles test for RDNA1 Principled BSDF rendering issue
This commit adds a render test for the issue reported in
blender/blender#137420.

Ref: blender/blender-test-data!84
2025-04-15 09:20:09 +02:00
Jacques Lucke
c11055c1cf Geometry Nodes: enable closure regression tests
Some special care had to be taken because these tests require an experimental
feature to be turned on to work.

Pull Request: https://projects.blender.org/blender/blender/pulls/137414
2025-04-13 13:55:23 +02:00
Sean Kim
898e6f3687 Paint: Ensure brushes are loaded when requested while in background mode
Depending on internal details of how Blender is run, attempting to load
elements from the asset library may either execute as synchronous &
blocking or asynchronously.

When executing a script in background mode, prior to this commit,
operators that are dependent on the asset system will not execute
correctly due to the loading not being complete.

Busy-waiting for this by repeatedly calling the operator over and over
again in python does not resolve. To match behavior of other operators
when called from python scripts such as the quadriflow remesh, this
commit changes the `brush.asset_activate` operator and dependent code to
force a blocking call instead of optionally using the wmJob background
abstraction system.

Related to #117399

Pull Request: https://projects.blender.org/blender/blender/pulls/134203
2025-04-10 22:09:06 +02:00
Brecht Van Lommel
4970bac061 Tests: Properly disable tests when data directory is missing
And clean up cmake output to be less verbose.
2025-04-07 16:29:14 +02:00
Campbell Barton
f48b4e3abf Cleanup: wrap long lines for CMake 2025-04-05 20:30:37 +11:00
илья _
f3f9aaf4f7 Fix: Tests: Geometry Nodes tests ignore threshold value
Base constructor ask test name as the third argument,
so threshold have to be named parameter in case test name is not mentioned

Pull Request: https://projects.blender.org/blender/blender/pulls/134300
2025-04-04 11:52:16 +02:00
Christoph Lendenfeld
28d0bef706 Fix: Retain slot name when baking action
Previously when an action was baked, the slot name was not retained.
This causes problems when switching between actions because the slot
will not automatically be assigned.

This is now fixed by ensuring that the name of the last assigned slot
is used to create the new slot.

Pull Request: https://projects.blender.org/blender/blender/pulls/136814
2025-04-03 10:18:15 +02:00
Sean Kim
f1c87d1bd2 Fix: Multi-window UI tests can produce inconsistent results
After creating a new scene in a separate window when performing UI
tests, the respective view layer for the window may not be updated
immediately in the event loop.

Previously, this was mitigated with a single `yield` statement that
would delay processing by a single tick. To fix this issue, this commit
adds the capability to yield for a specific `timedelta` and waits this
amount of time for the two affected tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/136012
2025-04-02 21:38:05 +02:00
Campbell Barton
f89cf19ba6 Cleanup: indentation for CMake files, strip trailing space 2025-04-02 03:01:59 +00:00
Christoph Lendenfeld
e4d3a52ed6 Anim: Unit Tests for baking code
No functional changes.

This patch adds unit tests for the animation baking code in `anim_utils.py`.
It is by no means exhaustive but it is a start to figure out what this function
is actually doing.
With the usage of the legacy python API I was worried things might not work as
expected but all added tests pass.
Also, the tests document the current behavior without any attempt of declaring
that behavior as good or correct.

Pull Request: https://projects.blender.org/blender/blender/pulls/135583
2025-03-27 12:56:46 +01:00
Aras Pranckevicius
812bf5473e Tests: emit 2d and 4d custom properties, more bone flags
Pull Request: https://projects.blender.org/blender/blender/pulls/136595
2025-03-27 11:21:45 +01:00
Campbell Barton
61d857eba4 Tests: add Hyper modifier support to the "easy_keys" module 2025-03-27 12:13:29 +11:00
Sybren A. Stüvel
a7d787f5b9 Fix #136347: Keyframe interpolation behavior changed for BoolProperty
F-Curve interpolation uses the `FCURVE_INT_VALUES` and
`FCURVE_DISCRETE_VALUES` flags, which were not set in the keyframe
insertion function for slotted Actions. This is now resolved by making
the RNA property type part of the `FCurveDescriptor`.

Existing code has been refactored a bit, mostly to allow calling
`update_autoflags_fcurve_direct()` with just the RNA property type,
instead of passing the property itself. This avoided the need to include
pointers to RNA properties in `FCurveDescriptor`, which I think is a
slightly nicer design. It also makes it more explicit which aspect of
the property is used.

Because there's now another `std::optional<>` in the `FCurveDescriptor`,
I've also changed some `std::nullopt` to `{}` for brevity of the code,
as repeating that another time would have caused longer lines with more
rewrapping.

Pull Request: https://projects.blender.org/blender/blender/pulls/136446
2025-03-25 10:34:19 +01:00
Jesse Yurkovich
01ddb320dd Fix #124263: Generate unique names during Alembic and USD export
While object names in Blender are already unique, the names themselves
may be "unsafe" for use in the various file formats. During processing
we make the names "safe". However, we did not guarantee that these new
safe names were themselves unique wrt each other. Consider object names
"Test 1" and "Test-1" which both become "Test_1" after being made safe.
These will collide during export; only 1 object would be exported and
it's undefined which object's data would "win".

To rectify this we add another name map to the hierarchy iterator which
is then used to handle collisions as they happen. The map is per-
hierarchy meaning that a name can appear more than once as long as its
under a different hierarchy. E.g.
- `/root/A/X` and another `/root/B/X` is OK
- `/root/A/X` and another `/root/A/X` is NOT OK

Pull Request: https://projects.blender.org/blender/blender/pulls/135418
2025-03-21 21:29:08 +01:00
Aras Pranckevicius
850d67829c Tests: emit more information in import test templates
- Object parent type & parent bones
- Pose information that is not trivial (i.e. print posed bones that
  have either non-identity pose matrix, or custom properties)
- Make sure custom properties are output sorted by name

Pull Request: https://projects.blender.org/blender/blender/pulls/136321
2025-03-21 20:16:47 +01:00
Omar Emara
d6fa68eb58 Compositor: Add boolean socket support
This patch adds support for boolean sockets in the compositor. This
involves adding a new Bool ResultType and handling it in relevant code.
For shader operations, booleans are passes as floats since GPUMaterial
does not yet support boolean types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136296
2025-03-21 12:03:09 +01:00
Aras Pranckevicius
944c7733e3 Tests: emit more animation data in I/O test template output
Previously only "legacy style" (no action layers, slots etc.)
were emitted for import tests

Pull Request: https://projects.blender.org/blender/blender/pulls/136133
2025-03-18 19:13:09 +01:00
Alaska
7e7594c7ff Tests: Add Cycles test for transparent spatial splitting artifacts
With the HIPRT backend for Cycles, rays can end up hitting the same
triangle multiple times due to a issue in the spatial splitting
algorithm.

Most of the time this issue isn't visible, but it is quite obvious in
semi-transparent shadows of meshes.

So this commit adds a file that contains a object made up of many
semi-transparent rectangular prisms casting a shadow onto the a plane.

Ref: blender/blender#117527
Ref: blender/blender-test-data!76
2025-03-18 02:01:41 +01:00
Aras Pranckevicius
c34c1e2812 Tests: more consistently in import test output
- Print negative/positive zeroes the same in more places,
- Sort emitted fcurves, armature bones by name
- More FBX test files from various bug reports

Pull Request: https://projects.blender.org/blender/blender/pulls/136089
2025-03-17 17:30:33 +01:00
Campbell Barton
73997ee5a9 Cleanup: underscore prefix private functions, use str.format 2025-03-16 16:33:37 +11:00
Campbell Barton
102c454781 Tests: event coordinates for UI tests on macOS with Hi-DPI
Correct the event coordinates by scaling by the pixel_size on macOS.

All the UI tests now pass on macOS.

Ref !136008

Co-authored-by: Sean Kim <SeanCTKim@protonmail.com>
2025-03-16 16:27:39 +11:00
Campbell Barton
f58a054eaf Tests: ui_test_undo.view3d_simple menu search failure
The inclusion of "Add -> Image -> Mesh Plane" causes the menu search
for "Add -> Mesh -> Plane" to attempt to add the image plane.

Workaround the problem by searching for an exact match,
although I think this should be possible to search for menu items
without having to include their shortcuts, especially since these
can be platform dependent.
2025-03-16 16:09:08 +11:00
Maxime-Cots
7d27064870 USD: Add new USD shapes import test
This PR update test data and test case for a few new USD Shapes
(Cylinder_1, Capsule_1, Plane)

Related Links :
* Issue : https://projects.blender.org/blender/blender/issues/134138
* PR: USD: Add Plane Shape import : https://projects.blender.org/blender/blender/pulls/134275
* PR: USD: Add Cylinder_1, Capsule_1 import : https://projects.blender.org/blender/blender/pulls/134944

Test Data PR : https://projects.blender.org/blender/blender-test-data/pulls/58

Co-authored-by: Nig3l <nig3lpro@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/134971
2025-03-15 00:46:16 +01:00
Sean Kim
38870d17e6 Build: Allow UI tests to run locally on all platforms
This commit allows the `WITH_UI_TESTS` CMake option to be used on all
platforms, not only Linux. The existing functionality to use the Weston
compositor was moved into the `WITH_UI_TESTS_HEADLESS` option. When
these tests are run with only `WITH_UI_TESTS`, a visible instance of
Blender is opened up for testing.

Pull Request: https://projects.blender.org/blender/blender/pulls/135889
2025-03-14 22:27:50 +01:00
Brecht Van Lommel
de821416c7 Cycles: Adaptive subdivision dicing and splitting improvements
* Share vertices between patches instead of using stitch map
* Switch to OpenSubdiv compatible counter-clockwise indexing
* Simplify patch edge reverse direction logic
* Add more comments to splitting and dicing

Pull Request: https://projects.blender.org/blender/blender/pulls/135681
2025-03-11 20:58:33 +01:00
Sybren A. Stüvel
2cdd75def0 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-11 10:38:55 +01:00
Sybren A. Stüvel
064421a02d Anim: expose Action Slot users to RNA
Add a new RNA function `ActionSlot.users()` that returns the
data-blocks that are animated by this slot.

This covers direct assignment of the action & slot, but also use in
the NLA and in Action constraints.

```python
>>> D.actions['SuzanneAction'].slots['OBSuzanne'].users()
[bpy.data.objects['Suzanne']]
```

This was implemented as a function, and not a collection property,
because Blender's bookkeeping of the slot users can be marked 'dirty'.
In that case the slot user list needs to be rebuilt, which happens for
all Actions and all their slots simultaneously. This was considered
too broad a data-changing action to 'hide' inside a getter of a
property. Also it needs a `bmain` pointer, which is not available in
getters, but is available in functions.

Pull Request: https://projects.blender.org/blender/blender/pulls/135734
2025-03-11 10:36:59 +01:00
Sean Kim
331df61e32 Tests: Add sculpt.detail_flood_fill operator test
Conveniently, this operator serves as a useful basic test for dyntopo
subdivision.

Pull Request: https://projects.blender.org/blender/blender/pulls/135558
2025-03-10 16:27:08 +01:00