Commit Graph

914 Commits

Author SHA1 Message Date
Sybren A. Stüvel
efbdc4e1fa Anim: ChannelBag F-Curve management functions (C++/RNA)
Add F-Curve management functions on ChannelBags
(`channelbag.fcurves.xxx`) that are very similar to the legacy Action
functions `Action.fcurves.xxx`.

```python
channelbag = strip.channelbags.new(slot)
fcurve = channelbag.fcurves.new("rotation_quaternion", index=1)
assert channelbag.fcurves[0] == fcurve
channelbag.fcurves.remove(fcurve)
channelbag.fcurves.clear()
```

Pull Request: https://projects.blender.org/blender/blender/pulls/124987
2024-07-18 17:06:12 +02:00
Christoph Lendenfeld
6ef77a0d22 Anim: Deselect Keys before inserting new keys
This commit changes the keying code to deselect keyframes when inserting new keys.
This has been discussed in the Animation & Rigging module meeting [1].
There is also an RCS post about that [2].
Doing this brings key creation in line with object creation,
where only the newly created object is selected.
There has been a previous attempt [3] to do a similar thing.

### Changes
When inserting keys by pressing `I` in the viewport or choosing a keying set,
all keys of the `Action` get deselected before inserting new keys.
New keys are selected by default.
Python RNA functions are **NOT** affected, meaning addons using
those functions will not deselect any keys by default.
The developer has to choose to do so.
To make that easier, there is a new RNA function on the action
`deselect_keys`

[1]: https://devtalk.blender.org/t/2024-05-02-animation-rigging-module-meeting/34493#patches-review-decision-time-5
[2]: https://blender.community/c/rightclickselect/K0hbbc
[3]: https://archive.blender.org/developer/D11623

Pull Request: https://projects.blender.org/blender/blender/pulls/121908
2024-07-18 14:48:00 +02:00
Sybren A. Stüvel
7360ce4bcc Anim: add RNA code for ChannelBags
RNA API for creating & removing channelbags, as well as a path function
to construct RNA paths for channelbags.

```python
action = bpy.data.actions.new('TestAction')

slot = action.slots.new()
slot.name = 'OBTest'

layer = action.layers.new(name="Layer")
strip = layer.strips.new(type='KEYFRAME')

# New in this commit:
channelbag = strip.channelbags.new(slot)
strip.channelbags.remove(channelbag)
```

Pull Request: https://projects.blender.org/blender/blender/pulls/124793
2024-07-18 11:14:15 +02:00
Alaska
2724f296b2 Render test: Add option to ignore block list
Add a option to ignore Cycles render test black list, controlled via
BLENDER_TEST_IGNORE_BLOCKLIST environment variable.

Useful for testing to see if anything is seriously broken in a test
that's black listed. (E.g. See if some particle rendering tests are
seriously broken on the GPU)

It would be recommened that this be used to test GPU compiler updates.
Or the enablement of certain features like custom curve rendering on
custom BVH.

Pull Request: https://projects.blender.org/blender/blender/pulls/124662
2024-07-17 16:59:25 +02:00
Alaska
ef010da315 Cycles tests: Enable MNEE test on Metal on supported macOS version
MNEE tests were disabled on Metal due to the feature not being
supported in macOS < 13.

This commit enables MNEE tests on Metal GPUs if they are using
macOS >= 13, otherwise leave it disabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/124709
2024-07-16 09:46:12 +02:00
Clément Foucault
e0474c4bd3 Merge branch 'blender-v4.2-release' 2024-07-09 16:47:16 +02:00
Clément Foucault
ee94e84ab2 EEVEE: Make tests pass on all platforms
Increase fail threshold for tests with platform
dependent noise.
Blacklist `principled_thinfilm_transmission` as
the IOR is very small and isn't packed to the GBuffer
with the same precision on every platform.
2024-07-09 16:46:06 +02:00
Falk David
2efc3e8db2 Cleanup: Formatting 2024-07-09 15:12:58 +02:00
Clément Foucault
acf7eab3b5 Merge branch 'blender-v4.2-release'
# Conflicts:
#	tests/data
2024-07-09 14:52:34 +02:00
Clément Foucault
afeb38f76f EEVEE: Blacklist pointcloud volume render tests
This test is testing a feature that is not supported yet
and has different behavior depending on the hardware.
2024-07-09 14:48:43 +02:00
Jesse Yurkovich
5bb5cfd97a Merge branch 'blender-v4.2-release' 2024-07-08 09:07:07 -07:00
Clément Foucault
032182f572 EEVEE: Nudge the render test lightprobe sphere
This avoid random raster imprecision in the render tests.
2024-07-08 17:37:57 +02:00
Sybren A. Stüvel
0aa75ab57b Refactor: rename "Animation data-block" to "Action"
Rename "Animation data-block" to "Action" or "Layered Action", where
appropriate. Some uses of the term actually refer to the `AnimData`
struct, in which case they were left as-is.

No real functional changes, just changing some messages & descriptions.

Pull Request: https://projects.blender.org/blender/blender/pulls/124170
2024-07-05 17:52:55 +02:00
Sybren A. Stüvel
c0364efec0 Refactor: rename 'Action Binding' to 'Action Slot'
Rename 'Binding' to 'Slot'. The old term was causing all kind of
confusion, and 'slot' was considered to be a better term for the
intended functionality.

This commit breaks existing blend files that were using the new layered
Action for their animation. The animation data will be lost due to the
rename, as there is no versioning code or DNA renaming logic. At this
time the new system is still marked as experimental, so shouldn't be
used for anything serious anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/124170
2024-07-05 17:52:55 +02:00
Sergey Sharybin
bd75344b2b Merge branch 'blender-v4.2-release' 2024-07-03 14:47:23 +02:00
Sergey Sharybin
9460dfd4f3 Fix #124086: blake2 hasher is unavailable on macOS
The issue is caused by an external dependency to
/opt/homebrew/opt/libb2/lib/libb2.1.dylib

This change adds a test to catch the same issue in the future,
and moves the arm64 libraries to a newer hash with fixed Python.

Pull Request: https://projects.blender.org/blender/blender/pulls/124096
2024-07-03 14:46:33 +02:00
Campbell Barton
11b32ed48b Merge branch 'blender-v4.2-release' 2024-07-02 15:07:17 +10:00
Campbell Barton
c29d8326e0 UI: sort add-ons by name
Previously add-ons were sorted by category & name, remove the category
only sorting by name since the category is no longer displayed and
isn't part of extension meta-data. Now the add-ons are sorted by name
(case insensitive).

Details:

- Store add-ons modules sorted to avoid having to sort on every redraw.
- addon_utils.modules() now returns an iterator.
2024-07-02 15:06:14 +10:00
Jesse Yurkovich
5c7821fd79 imbuf: Add regression test for PSD
Make use of recently added PSD test files to ensure loading works
correctly when we update our library dependencies.

Pull Request: https://projects.blender.org/blender/blender/pulls/123861
2024-06-27 22:34:36 +02:00
Devashish Lal
3e28b6c7f1 Nodes: File path socket subtype for string sockets
This commit adds a new socket subtype for the string socket type
for file paths. Like other subtypes, this doesn't influence the data
stored in the socket or passed between nodes, it adds a file browser
popup operator to the socket button in the node.

From the file import nodes GSoC project:
https://devtalk.blender.org/t/gsoc-2024-geometry-nodes-file-import-nodes/34482

Pull Request: https://projects.blender.org/blender/blender/pulls/123250
2024-06-24 16:28:33 +02:00
sandarm
d512139c7f Operator tests: Adding test for quads_convert_to_tris operator.
Operator tests: Adding test for quads_convert_to_tris operator.

This is related to https://projects.blender.org/blender/blender/issues/84999.

Co-authored-by: powergainer <95447782+powergainer@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/123286
2024-06-21 19:06:00 +02:00
Jesse Yurkovich
7ba935f7dd USD: Add animation export test
Add an export test to cover some simple animation scenarios that would
have protected against recent bugs:
- A simple object animation (would have prevented `122625`)
- An armature animation (would have prevented `724a674baed`)
- A shape key animation (would have indirectly found `6c5ce883e73`)

Pull Request: https://projects.blender.org/blender/blender/pulls/123458
2024-06-20 03:50:26 +02:00
Brecht Van Lommel
a26fd603b0 Merge branch 'blender-v4.2-release' 2024-06-18 21:19:24 +02:00
Clément Foucault
d41cd2095a EEVEE: Make render tests use volume indirect lighting 2024-06-18 17:53:22 +02:00
Hans Goudey
68000660d2 Tests: Add option to allow index changes for certain mesh comparison tests
Currently the mesh boolean code is producing a different index order on the latest
version of XCode on macOS. This is proving very difficult to investigate, and it's
preventing developers from spending time on more important things.

As a compromise for now, allow configuring certain geometry nodes tests to make
meshes with a different index order still pass the test. This can be done by adding
a boolean custom property with the name `allow_index_change` to the test object
and setting it to "True". Allow the index change on different platforms is unfortunate,
spending time on working on a replacement exact boolean algorithm is a more
valuable use of time currently.

After this commit lands, someone who can reproduce the failing test on their
computer should update tests to include that custom property as necessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/123204
2024-06-14 14:50:26 +02:00
Bastien Montagne
b03a6bbd60 Cleanup: Remove left-over debug print in tests. 2024-06-13 20:50:13 +02:00
Bastien Montagne
5dfc197262 IDProp: BPY: Support assigning large int values to float properties.
Allow assigning integer values beyond int32 range to float/double
IDProperties. Extract the py object value into a temporary int64 value
in these cases.
2024-06-13 20:47:46 +02:00
Bastien Montagne
b278e37f70 IDProps: Make 'dynamic RNA' IDProperties statically typed.
All IDProperties generated as part of 'storage backend' for dynamic RNA
properties are now statically typed.

Also adds some basic unittests for the new statically typed IDProperty
system, based on py-defined RNA data.

Ref. #122743.
2024-06-13 19:58:22 +02:00
Sybren A. Stüvel
83311ef96d Fix #122777: The keyframe_insert method throws python exceptions
Just for the `pyrna_struct_keyframe_insert()` function, reduce the
reporting level of keyframe insertion failures from `RPT_ERROR` to
`RPT_WARNING`. This prevents the conversion of these reports to a Python
exception.

`CombinedKeyingResult::generate_reports()` now accepts an option
argument `report_level`, so that the caller is in control over the type
of reports it generates.

Previously only errors were converted to exceptions; warnings were
implicitly cleared and never displayed. To avoid these 'keyframe
insertion failure' reports from becoming invisible, the
`pyrna_struct_keyframe_insert()` function now sends any warnings to
stdout (unless there were errors, in which case the old
error-to-exception behaviour is still there).

Pull Request: https://projects.blender.org/blender/blender/pulls/122827
2024-06-11 11:11:16 +02:00
Bastien Montagne
65f68fe7fe BPY IDProp tests: Add basic tests for 'UI data' system.
This are not complete by far, mainly here to illustrate the issue
reported in #122843 (mismatch returned value for 'enum' idprops).
2024-06-10 15:54:29 +02:00
Bastien Montagne
a799c84946 BPY IDProp tests: test matching results from subscription and path_resolve.
Add (partially disabled) systematic tests that for all IDProp types, the
returned value from direct idprop subscription and RNA-based
`path_resolve` return the same data.

NOTE: This does not work currently for 'composite' types (`IDP_ARRAY` and
`IDP_GROUP`).
2024-06-10 14:27:16 +02:00
Campbell Barton
b7e0d7d1c3 Fix script_load_addons including add-ons from the users home directory
The add-on load test could fail depending on add-ons in user extension
repositories.

Remove all repositories before running the tests.

Also minor naming & comment edits.
2024-06-09 22:50:10 +10:00
Michael B Johnson
f913fb6159 USD: Add MaterialX shader export
This change adds the ability to export MaterialX networks into the resulting
USD layer.

Details:

A new export option has been added to the USD export to enable MaterialX
export. It is off by default currently due to reasons in the caveats
section.

When enabled, it exports the MaterialX shading network alongside the
UsdPreviewSurface network, on the same USD Material. This allows the same
material to be used by renderers that don't support MaterialX, using the
USDPreviewSurface as a fallback. This is similar to setups in other DCC
packages, and matches the format we've used in our Reality Composer Pro
asset library.

It uses the existing MaterialX framework used to generate MaterialX
documents for rendering, to act as the basis for the USD graph. In this
process it also re-uses the existing texture export code as well if provided
and necessary.

Once the MaterialX document is created, use usdMtlx to generate a USD
shading network. Unfortunately, usdMtlx generates a graph that is unlike
what other DCCs that support MaterialX-embedded-in-USD generates. It
generates several extra prim hierarchies, and externalizes all shader
inputs, making them difficult to edit in other MaterialX graph editors.

To workaround this, generate the MaterialX shading network onto a
temporary stage, where we then run various pre-processing steps to prevent
prim collisions and to reflow the paths once they're converted.

The PrimSpecs are then copied over to their new path. The resulting prim
hierarchy matches what many artists we've worked with prefer to work with.

Caveats:

The Export MaterialX check is off by default. When using the Principled
BSDF, the resulting graph is very usable. However, when using some of the
other BSDFs, the shading networks generated by the existing MaterialX
framework in Blender generate some shading graphs that are difficult for
usdview and other DCC's to understand. The graph is still correct, but
because we're trying to prioritize compatibility, the default is off.

In future PRs we can aim to make the graphs for those other BSDFs play
better with other DCCs.

Other Implementation Details:

As part of this commit we've also done the following:

* Place some of the materialx graphs inside a passthrough nodegraph to
  avoid node conflicts.
* Better handle some shader output types , and better handle some
  conflict cases.
* Moved the ExportTextureFunction to materials.h due to some difficult
  to resolve header ordering issues. This has no effect on any runtime code.
* There is a test for the MaterialX export that does some basic checking to
  make sure we get an export out the other end that matches our expectations

Authored by Apple: Dhruv Govil

This PR is based on an earlier implementation by Brecht van Lommel , as well
as Brian Savery and his teams' work at AMD to implement the general
MaterialX framework within Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/122575
2024-06-05 20:43:44 +02:00
Jeroen Bakker
6a71a91b83 EEVEE-Next: Light Probe RNA
Split `bpy.types.LightProbe` into specialized subclasses.
- Rename all grid_* to remove the prefix in the RNA and limit access to
  volume probe.
- Parallax and other sphere probe only properties should be limited to
  sphere probe.
- `visibility` properties are deprecated (to be removed in a future
  Blender version)

Ref #113976

Pull Request: https://projects.blender.org/blender/blender/pulls/122353
2024-06-04 15:05:22 +02:00
Clément Foucault
cc0d12dd20 EEVEE: Remove EEVEE-Legacy
This handles the transition to EEVEE-Next (now EEVEE).

This removes some things that make no sense to keep
even for compatibility.
- Scene.eevee.light_cache_data
- Scene Light cache operators
- Scene Light cache RNA properties

The remaining legacy properties will be removed later
on to avoid python API breakage.

We keep the identifier of EEVEE-Next as `BLENDER_EEVEE_NEXT`
to avoid addons being incorrectly silently made compatible
with the EEVEE-Next where the Python API is different.
This renaming should be done in 5.0 release.

Thank you EEVEE-Legacy, you served us well.

Pull Request: https://projects.blender.org/blender/blender/pulls/122433
2024-06-04 14:17:58 +02:00
Jesse Yurkovich
05f8d35652 Fix #122606: fully map Blender's INT8 type to USD's UChar
While USD does not have a signed, 8-bit, integer type we can use its
UChar type instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/122610
2024-06-02 22:26:12 +02:00
Charles Wardlaw
e1a6749b3d USD: dome light IO
This commit adds logic to convert between USD dome lights and Blender
world materials.

The USD dome light rotation is represented in a mapping node input to the
environment texture.  If the dome light has a color specified in addition to
the texture map, the color will be converted to a vector multiply on the
the environment texture output.

I the imported USD has multiple dome lights, only the first dome light will
be converted to a world material.

Co-authored-by: kiki <charles@skeletalstudios.com>
Co-authored-by: Michael Kowalski <makowalski@nvidia.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/121800
2024-05-30 20:48:43 +02:00
Sybren A. Stüvel
3f555ee027 Anim: add RNA guards to prevent mixing legacy/layered action operations
Add guards to the RNA code to prevent the creation of legacy data on a
layered Action, and vice versa.

On a legacy Action, it is now impossible to create new layers or bindings.

On a layered Action, it's now impossible to create legacy F-Curves or
groups.

Refactor: Anim: rename bl_animation_id.py to bl_animation_action.py

The `Animation` datablock is no more, and this file tests `Action`.

No functional changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/122483
2024-05-30 13:19:21 +02:00
Sybren A. Stüvel
ef6dd90a6e Refactor: Anim: rename bl_animation_id.py to bl_animation_action.py
The `Animation` datablock is no more, and this file tests `Action`.

No functional changes.
2024-05-30 13:19:21 +02:00
Jesse Yurkovich
9daded5d87 USD: Use nodes for alpha-clip behavior instead of material properties
EEVEE-next has removed the MA_BM_CLIP / alpha_threshold material
properties in favor of using nodes for equivalent functionality. This
changes USD to build and traverse node graphs during import and export
accordingly. Indirectly this allows Cycles to correctly render such
materials now too.

A complicating factor is that the UsdPreviewSurface defines its opacity
threshold using greater-than-equals[1], which Blender does not support
(and for which was technically already incorrect as EEVEE-legacy only
used greater-than for its shaders). Due to this we actually need to use
2 nodes: A less-than, followed by a one-minus invert, to arrive at the
proper value. We'll translate UsdPreviewSurface to this form on Import.

For Export we will look for either this 2-node pattern or a Round
node plugged into Alpha. Looking for Round is a result of the glTF
documentation which recommended the use of this node for thresholds of
0.5[2]. It's a tiny addition that seems reasonable to accommodate.

[1] https://openusd.org/release/spec_usdpreviewsurface.html (search for "opacityThreshold")
[2] https://docs.blender.org/manual/en/4.2/addons/import_export/scene_gltf2.html#alpha-modes

See PR for example images

Pull Request: https://projects.blender.org/blender/blender/pulls/122025
2024-05-25 23:30:13 +02:00
Jesse Yurkovich
21db0daa4e USD: Read and write custom attributes for Curves
Add support for reading and writing custom `Curves` attributes.

This allows us to roundtrip Blender's Hair grooms containing UVs and
other attribute data. Note that animated attribute values are not
supported with this change.

This will also address #120042

Pull Request: https://projects.blender.org/blender/blender/pulls/121928
2024-05-25 22:23:40 +02:00
Campbell Barton
8ff15f1c70 Cleanup: restore error, exclude extensions tests from bl_load_py_modules
Also remove outdated exclusions.
2024-05-16 16:02:25 +10:00
Campbell Barton
ccb1fcb5a5 Cleanup: use more descriptive names for module test exclusion
Include comments for how exclusion works.
2024-05-16 15:57:28 +10:00
Omar Emara
3d1c8a3ff3 Compositor: Explicitly set device in test scripts
This patch explicitly sets the compositing device in the compositor test
scripts. This is done to make the tests more robust, since a developer
might accordantly save a file with a different device.
2024-05-14 19:03:55 +03:00
Sergey Sharybin
727a90a0f1 Compositor: Make GPU compositor an official feature
Effectively, make GPU compositor available without need to enable
an experimental feature set.

The compositor device is now exposed in the Performance panel of
Render Buttons. It is also still available in the compositor's
N-panel, together with some other options which are more about how
editing works, and not exactly related to render performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/121398
2024-05-14 15:49:20 +02:00
Sybren A. Stüvel
d94a56bdad Anim: merge Animation data-block into bAction
The new/experimental, layered `Animation` data-block is merged with the
existing `bAction` data-block.

The `Animation` data-block is considerably newer than `bAction`, so the
supporting code that was written for it is also more modern. When moving
that code into `bAction`, I chose to keep the modernity where possible,
and thus some of the old code has been updated as well. Things like
preferring references over pointers.

The `Animation` data-block is now gone from DNA, the main database, etc.
As this was still an experimental feature, there is no versioning code
to convert any of that to Actions.

The DNA struct `bAction` now has a C++ wrapper `animrig::Action`, that
can be obtained via `some_action->wrap()`.

`animrig::Action` has functions `is_empty()`, `is_action_legacy()`, and
`is_action_layered()`. They **all** return `true` when the Action is
empty, as in that case none of the data that makes an action either
'legacy' or 'layered' is there.

The 'animation filtering' code (for showing things in the dope sheet,
graph editor, etc) that I wrote for `Animation` is intentionally kept
around. These types now target 'layered actions' and the
already-existing ones 'legacy actions'. A future PR may merge these two
together, but given how much work it was to add something new there, I'd
rather wait until the dust has settled on this commit.

There are plenty of variables (and some comments) named `anim` or
`animation` that now are of type `animrig::Action`. I haven't renamed
them all, to keep the noise level low in this commit (it's already big
enough). This can be done in a followup, non-functional PR.

Related task: #121355

Pull Request: https://projects.blender.org/blender/blender/pulls/121357
2024-05-13 15:58:04 +02:00
Clément Foucault
c7bc3334ad EEVEE-Next: Shadow: Add Maximum Resolution Option
This adds a light parameter to avoid near camera pixels
allocating too much shadow resolution.

This is more intuitive than the scale shadow setting and
allows reducing the precision without changing the look
of distant shadows.

For sun lights, the property sets the minimum pixel
size the shadow can contains. This allows to
remove a lot tilemap close up.

For local lights, there is another additional property
to set the maximum resolution in shadow space (like
EEVEE-Legacy) instead of in world space (like sun
lights). This allows making older files lighter and
allow a more conservative approach to resolution.

This add versionning code to handle EEVEE-Legacy files
that had fixed resolution per light type.

The resolution setting is always in world space distance
as the maximum shadow resolution distribution might change
in the future or be dependent on other parameters
(like beam angle). This ensure that there is no
dependency on these parameters, but make the
setting use very small units. But this is more of
a UI problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/121701
2024-05-13 14:34:11 +02:00
Clément Foucault
717f546f91 EEVEE-Next: Increase light threshold
Make tests closer to cycles as the main difference
was the light not going far enough to bounce on
the background.
2024-05-10 19:52:11 +02:00
Clément Foucault
9cb76bd728 Fix: EEVEE-Next: Fix crashing tests 2024-05-10 19:49:21 +02:00
Sergey Sharybin
7b4232e8aa Compositor: Move Execution Mode and Precision from bNodeTree to Scene
This allows to expose these settings in the Performance panel in the
render buttons. Also moves compositor-specific options away from the
generic node tree structure.

For the backwards-compatibility the options are still present in the
DNA for the bNodeTree. This is to minimize the impact on the Studio
which has used the GPU compositor for a while now. They can be
removed in a future release.

There is no functional changes expected.

Pull Request: https://projects.blender.org/blender/blender/pulls/121583
2024-05-10 18:08:33 +02:00