Commit Graph

1224 Commits

Author SHA1 Message Date
Jeroen Bakker 49d07653f9 RenderTests: Fix Incorrect Command in Report
When running the render test for EEVEE-Next the command printed on
the report to update the reference images was incorrect. In stead of
displaying
`BLENDER_TEST_UPDATE=1 ctest -R eevee_next` it displayed
`BLENDER_TEST_UPDATE=1 ctest -R eevee next`.

The cause of this is that the title of the report is used to create
the command. EEVEE-Next has a space in its title which generates
an incorrect command.

A quick fix would be to replace spaces with underscores. But it would
be better to fix this more clearly by adding an attribute containing the
engine name.

This PR adds a `set_engine_name` method to the Report class. By
default the engine name is set based on the title.

Pull Request: https://projects.blender.org/blender/blender/pulls/117503
2024-01-25 18:55:28 +01:00
Sergey Sharybin 9fdf3bc1f4 Fix missing generation of alpha difference images in render tests
The part of the patch wasn't properly applied from a working branch,
and it wasn't very visible because the development environment already
had all files on disk.

Pull Request: https://projects.blender.org/blender/blender/pulls/117504
2024-01-25 14:20:30 +01:00
Sergey Sharybin f11292104d Render Tests: Separate difference of Color and Alpha
This change fixes confusion situation when the render output
is an RGBA image: the difference in color was not visible in
the report because alpha channel was all zeros. This is due
to idiff performing per-channel difference.

The solution to this problem is to have separate images for
color and alpha difference, which makes it clear where the
difference actually is coming from.
2024-01-25 10:04:16 +01:00
Campbell Barton 6aede44fb7 PyAPI: remove checks for add-ons pre 2.8x
This made sense when migrating from 2.7x, now 2.8x add-ons may also
have issues in 4.1 so this check isn't so relevant.
2024-01-25 13:00:48 +11:00
Campbell Barton c5dd51a4dc Fix syntax error in workbench_render_tests
Correct even if the test isn't used, since syntax errors can trip up
checking tools.
2024-01-25 10:37:30 +11:00
Jeroen Bakker 481bc7a777 EEVEE: Update Render tests script
Last month we have been in the process of fixing the render tests of EEVEE-Next.
These render tests had some issues. Currently we are in a state that render
differences can be explained or related to an existing issue.

Having these render tests will also enable testing differences between Metal and OpenGL.

The new setup alters the position of the reflection probe so it doesn't intersect the ground
or the sphere at the same time. An offset was added, which adds a small difference
between cycles and eevee-next renders.

There is a known issue with the HiZ buffers when render size is too small. We change the
reflection probe render size as a temporary fix.

Pull Request: https://projects.blender.org/blender/blender/pulls/117447
2024-01-23 15:11:15 +01:00
Christoph Lendenfeld 5e28601d69 Anim: Separate keying flags
Splits the flag `..._FLAG_INSERTNEEDED` between autokey and
manual keying. The fact that this flag was shared between the two
systems has been the cause of issues in the past. It wouldn't
let you insert a keyframe even though you explicitly used an operator
to do so.

In order to be clearer what options are used where, the user preferences
have been reordered.

By default "Only Insert Needed" will be enabled for auto-keying, but not for manual keying.
The versioning code will enable both if it was enabled previously.

# Code side changes

The keying system has flags that define the behavior
when keys are inserted. Some of those flags were shared
between keying and auto-keying. Some were only used for
auto-keying.
To clarify that, prefix flags that used exclusively in one or the other
system with `AUTOKEY`/`MANUALKEY`

Also the flag name on the user preferences and the tool settings was renamed.
Previously it was called `autokey_flag`. To indicated that it is not only used
for autokeying, rename it `keying_flag`.

Fixes: #73773

Pull Request: https://projects.blender.org/blender/blender/pulls/115525
2024-01-19 16:26:10 +01:00
Omar Emara 2bff75c303 Tests: Enable blacklisted GPU compositor tests
Those tests are now expected to work.
2024-01-19 16:36:31 +02:00
Brecht Van Lommel 9c8a9662c0 Tests: Cache revision builds in benchmark script
In the mode where the script automatically builds Blender at given git
hashes, cache the builds instead of rebuilding them before running.
2024-01-18 21:28:23 +01:00
Hans Goudey 55131f6f90 Tests: Enable new triangulate geometry node test files 2024-01-16 15:59:33 -05:00
laurynas a6fd1f5034 Fix: Curves extrude with all points selected
CurvesGeometry has no ".selection" attribute when all control points
are selected. The earlier code assumed that the attribute always exists.
Also Python tests are added for the "extrude" operator.

Pull Request: https://projects.blender.org/blender/blender/pulls/117095
2024-01-16 21:59:15 +01:00
Lukas Tönne 83d3ba8a58 Fix #116477: Node group sockets with subtypes have broken idnames
Loading pre-4.0.20 node groups with sockets using subtypes causes
broken socket identifiers. This is because the node tree interface now
expects sockets to use the base identifiers ("NodeSocketFloat" instead
of "NodeSocketFloatFactor" etc.).

To correct this the conversion code now replaces socket idnames that
include a subtype suffix with their base names. This fix is also applied
to files between versions 4.0.20 and 4.1.10, where the socket types
may have been converted incorrectly.

Pull Request: https://projects.blender.org/blender/blender/pulls/117133
2024-01-16 15:32:33 +01:00
Jeroen Bakker 6e2572116d EEVEE: Fix running render tests
Render test would hide objects from probes. It still referred to
the old name of the spherical probes. This change will replace it
with the correct name.

It also hides objects from the planar probes as they were also
recently added.

Pull Request: https://projects.blender.org/blender/blender/pulls/116093
2024-01-15 08:36:56 +01:00
Thomas Barlow 5139a9c064 Fix: foreach_get/set does not work on multidimensional arrays
The foreach_get/foreach_set methods of bpy_prop_array get/set the entire
contents of the array, but they were checking that the length of the
input sequence was equal to the length of the current array dimension
rather than the total length of all dimensions of the array.

This would read/write memory after the end of the passed in sequence
when the property was a multidimensional array. Performing
`foreach_get` with a Python list with length matching the length of the
current dimension of a multidimensional array would crash a debug build
due to the trailing pad bytes of the temporarily allocated array being
overwritten.

This patch fixes `pyprop_array_foreach_getset` by changing the function
used to get the expected sequence size, to the RNA function that gets
the total length of the array across all its dimensions.

The tests have be updated to additionally test multidimensional array
properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/116457
2024-01-12 18:38:32 +01:00
Sybren A. Stüvel 135b42c3c4 Anim: fix Python bone collection unit tests
The bone collection unit tests in Python were failing, but this failure
was not propagated to `ctest` and thus went unnoticed.

Both issues are now fixed.
2024-01-11 14:37:11 +01:00
Dyvine57 eca14d5b40 Nodes: add int and bool to shader nodegroups
These are handled as floats by Cycles and EEVEE.

Pull Request: https://projects.blender.org/blender/blender/pulls/115026
2024-01-10 20:09:37 +01:00
Alexander Gavrilov d0ef66ddff Drivers: implement fallback values for RNA path based variables.
As discussed in #105407, it can be useful to support returning
a fallback value specified by the user instead of failing the driver
if a driver variable cannot resolve its RNA path. This especially
applies to context variables referencing custom properties, since
when the object with the driver is linked into another scene, the
custom property can easily not exist there.

This patch adds an optional fallback value setting to properties
based on RNA path (including ordinary Single Property variables
due to shared code and similarity). When enabled, RNA path lookup
failures (including invalid array index) cause the fallback value
to be used instead of marking the driver invalid.

A flag is added to track when this happens for UI use. It is
also exposed to python for lint type scripts.

When the fallback value is used, the input field containing
the property RNA path that failed to resolve is highlighted in red
(identically to the case without a fallback), and the driver
can be included in the With Errors filter of the Drivers editor.
However, the channel name is not underlined in red, because
the driver as a whole evaluates successfully.

Pull Request: https://projects.blender.org/blender/blender/pulls/110135
2024-01-08 15:24:59 +01:00
Campbell Barton 5dd91346e1 Cleanup: remove unused imports 2024-01-08 11:40:53 +11:00
Hans Goudey e90d844dd7 Cleanup: Grammar in comments
"it's own" -> "its own" again. Start new sentences properly.
2024-01-06 09:02:56 -05:00
Bastien Montagne 3e744db9fe Tests: Refactor handling of environment variables when invoking tests.
The current handling had a fairly bad issue: multiple calls to
`set_tests_properties` to set envvars of a same test.

This does not work, only the last call is effective, all previous
ones have absolutely no effect.

This has been addressed by moving all 'set envvar for test' logic into a
single CMake function, `blender_test_set_envvars`.

This function takes optional extra envvars if needed, and define a set
of default ones (currently, `PATH` from `PLATFORM_ENV_INSTALL` if
defined, and the 'nuke' `exitcode=0` `LSAN_OPTIONS` if relevant).

NOTE: The way `blender_test_set_envvars` handles extra envvars passed to
it as parameter is fairly basic and unsafe, in that there is no check
whether a same envvar is defined more than once. Think for now this is
an acceptable limitation.

NOTE: Although this commit _should_ be a non-functional change one, the
unification of the handling of all envvars makes it hard to ensure there is no
side effects.
The `PATH` envvar e.g. was set to either `PLATFORM_ENV_INSTALL` if defined,
or a copy of that variable's definition, but only in Windows case. So technically,
the behavior for this envvar is changed.
2024-01-05 21:13:54 +01:00
Sybren A. Stüvel 66cdc112fc Anim: Bone Collections, replace `.move_to_parent()` with `.child_number`
Instead of moving bone collections by absolute index, they can now be
moved by manipulating `.child_number`. This is the relative index of the
bone collection within the list of its siblings.

This replaces the much more cumbersome `collections.move_to_parent()`
function. Since that function is now no longer necessary (it's been
replaced by assignment to `.parent` and `.child_number`), it's removed
from RNA. Note that this function was never part of even a beta build of
Blender.
2024-01-05 16:54:46 +01:00
Christoph Lendenfeld 73f968dbe5 Refactor: keyframing unit tests
This PR changes two things

Move setup/cleanup code into `setUp`/`tearDown`

Change the `_fcurve_paths_match` to raise an error instead of returning a bool.
That makes it easier to see what the actual error is.

Pull Request: https://projects.blender.org/blender/blender/pulls/116816
2024-01-05 13:38:45 +01:00
Christoph Lendenfeld 03a66af318 Anim: Unit tests for "Insert Needed"
Add unit tests for the user preference option "Insert Needed"

Basic tests for objects and bones that check if autokeying in
combination with "Insert Needed" only
* keys all location channels on the first key
* keys only the modified channel on the second key

It is supposed to add only keyframes that have been affected
by the used transform operation.
E.g. translating an object will only add keys on translation keys.

The behavior of keying all property array channels first, and then
only add keys on values that have actually changed may change
in the future. Ideally it would only key actual changes to begin
with. But there is no way to do this right now.

Pull Request: https://projects.blender.org/blender/blender/pulls/116419
2024-01-05 09:52:22 +01:00
Sybren A. Stüvel 29be81ec23 Anim: make RNA property `bone_collection.parent` writable
Moving a bone collection to another parent is now possible in Python by
assigning to `bone_collection.parent`.

Thanks to Sergey for the implementation.
2024-01-04 15:41:19 +01:00
Brecht Van Lommel 364beee159 Tests: add option to build one binary per GTest file
Bundling many tests in a single binary reduces build time and disk space
usage, but is less convenient for running individual tests command line
as filter flags need to be used.

This adds WITH_TESTS_SINGLE_BINARY to generate one executable file per
source file. Note that enabling this option requires a significant amount
of disk space.

Due to refactoring, the resulting ctest names are a bit different than
before. The number of tests is also a bit different depending if this
option is used, as one uses gtests discovery and the other is organized
purely by filename, which isn't always 1:1.

Co-authored-by: Sergey Sharybin <sergey@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/114604
2024-01-03 18:35:50 +01:00
Sybren A. Stüvel 65d25ed813 Anim: add `bone_collection.bones_recursive` property
Add a `bone_collection.bones_recursive` property that returns the set of
bones assigned to that bone collection or any of its child collections.

This property is implemented in Python, as that made it considerably
simpler to create the set semantics.
2024-01-02 16:55:55 +01:00
Sybren A. Stüvel 99d43c9198 Anim: add test for `bone_collection.bones`
Add Python test for access to `bone_collection.bones`.
2024-01-02 16:55:55 +01:00
Sybren A. Stüvel bb7468260c Anim: tests, load factory-startup homefile in unit tests
Use `bpy.ops.wm.read_homefile(use_factory_startup=True)` to load the
default 'homefile'. Otherwise Blender will load the saved-as-default file,
which can be quite different from the default startup file.
2024-01-02 16:55:55 +01:00
Sybren A. Stüvel 9f38c6e887 Anim: Add `bone_collection.parent` accessor to RNA
Add a read-only property `bone_collection.parent` to RNA that returns
the parent bone collection.

This performs two scans of the array (one to find the bone collection's
index, and the other to find the parent index). This might look bad, but
as long as `Object.children` still loops, in Python, over all of
`bpy.data.objects`, this should also be acceptable.
2024-01-02 12:49:04 +01:00
Sybren A. Stüvel 2aac1528f2 Anim: add unit test for armature bone collections
Add a Python unit test that covers some of the armature/bone collections.
Some of these tests cover the same functionality as the C++ tests, albeit
via the Python/RNA API.

Another test was added to check that joining armatures works as expected.
2023-12-29 12:31:38 +01:00
Jeroen Bakker d37f9e6587 Cleanup: Make format 2023-12-21 10:47:42 +01:00
Christoph Lendenfeld de61ec3e6f Anim: Unit Tests for "Insert Available"
In preparation to the upcoming refactor of the keying set code,
extend the unit tests with more sophisticated
tests for "Insert Available".

This PR tests
* key available using the preference setting with autokeying on an object and a bone
* key available using the keyingset "Available"

Pull Request: https://projects.blender.org/blender/blender/pulls/116327
2023-12-21 10:22:21 +01:00
Bastien Montagne 25ab53a4af Cleanup: Remove LibOverride Template experimental feature.
This was added at the start of the project, as a way for the source
library to control what would be overridable by the user of the data
(production files).

The implementation never went beyond the experimental area, and only
exposed in the python API then. The idea has been superseeded by the
'cherry-pick' design, so there is no point in keeping this code any
longer.
2023-12-20 17:57:24 +01:00
Lukas Tönne 92cf9dd2f2 ID properties: Support enum values with items
Add support for enum values in ID properties.

This is needed for the "Menu Switch" node implementation (#113445) which
relies on ID properties for the top-level modifier UI.

Enums items can optionally be added to the UI data of integer
properties. Each property stores a full set of the enum items to keep
things simple.

Enum items can be added to properties using the `id_properties_ui`
function in the python API. A detailed example can be found in the
`bl_pyapi_idprop.py` test.

There is currently no support yet for editing enum items through the UI.
This is because the "Edit Property" feature is implemented entirely
through a single operator (`WM_OT_properties_edit`) and its properties.
Buttons to add/remove/move items would be operators changing another
operator's properties. A refactor of the custom properties UI is likely
required to make this work.

Pull Request: https://projects.blender.org/blender/blender/pulls/114362
2023-12-15 10:20:44 +01:00
Jeroen Bakker c11004579e GPU: Remove the Word OpenGL from Build Scripts
The build scripts are still referring to gpu tests as being opengl.
Although they can also use Metal or Vulkan. This PR only replaces
the work `opengl` with `gpu` for build options.

Special note is that the windows argument `with_opengl_tests` is
also replaced with `with_gpu_tests` for consistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/116030
2023-12-12 16:02:29 +01:00
dupoxy e67a0b9350 Cleanup: Correct path used in example help text for bl_run_operators_event_simulate.py
It was using tests/python instead of the tests/utils directory where the script is now hosted.

Pull Request: https://projects.blender.org/blender/blender/pulls/113873
2023-11-27 23:42:12 +01:00
Hans Goudey db17c4bff5 Cleanup: Remove redundant selection comparison from mesh tests
The `unit_test_compare` function already compares selection attributes.
2023-11-27 13:36:20 -05:00
Bastien Montagne 9b08352b21 RNA: Expose ID type identifier in ID structs, add coherence test.
Expose the ID type identifier as defined by the `rna_enum_id_type_items`
enum items as `ID.id_type` in RNA.

Add some test to `id_management` ensuring that all ID types exposed in
`bpy.data` have a valid `id_type` value, i.e. that they have a matching
entry in `rna_enum_id_type_items`.

This will hopefully prevent future cases like #115151 .
2023-11-21 18:54:00 +01:00
Christoph Lendenfeld 09e93ecc23 Anim: Add basic autokey tests
Add basic unit tests for the auto keying system.

Part of #113278

Pull Request: https://projects.blender.org/blender/blender/pulls/115064
2023-11-21 16:08:16 +01:00
Hans Goudey 29f3d54e91 Cleanup: Grammar in comments
- it's self vs. itself
- boiler plate vs boilerplate
2023-11-21 09:42:39 -05:00
Christoph Lendenfeld a99e419b6e Anim: Insert keyframes without keying sets
When animators want to key something in the viewport,
the code needs to know *which properties* should be keyed of that selected thing.
So far that was done with keying sets, and a pop-up that let's
you choose the keying set to use. You can get rid of the popup by
choosing a keying set ahead of time. But that is also not always desirable.

That pop-up is quite confusing and gives way too many options.
To simplify this process this PR adds a User Preference option to choose one or more of:
* Location
* Rotation
* Scale
* Rotation Mode
* Custom Properties

Now whenever the `I` key is pressed in the viewport,
and no keying set is enabled, it reads the preferences for which channels to insert.

# User Facing changes
* The popup will not be shown when pressing the hotkey,
 but you can still explicitly use keying sets by going to the menu
* Which channels are keyed is defined by a User Preference setting under animation
* when a keying set is used explicitly, the User Preference settings are ignored

Part of #113278

Pull Request: https://projects.blender.org/blender/blender/pulls/113504
2023-11-21 15:38:01 +01:00
Paolo Amadini da29519c7a Anim: Add regression tests for NLA strip evaluation
Adding in regression tests for NLA strip evaluation

Co-authored-by: Paolo Amadini <paolo.blender.dev@amadzone.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/109212
2023-11-20 17:52:28 +01:00
Aras Pranckevicius 0d0aad6280 IO: add STL import/export tests
Pull Request: https://projects.blender.org/blender/blender/pulls/115164
2023-11-20 11:19:50 +01:00
Jeroen Bakker 81eec5ff44 Cleanup: Make format 2023-11-16 07:59:20 +01:00
Lukas Tönne ec36296913 Geometry Nodes: Test for field type inferencing
Adds a python test script for the field inferencing mechanism in geometry nodes.

Tests various combinations of field-to-value and value-to-field combinations as well as unconnected base nodes. Zones are tested because they can require multiple passes to resolve, especially when nesting.

Testing is based on socket display shapes as a proxy for field type, since the field type is not exposed in RNA yet. Likewise, testing for red links caused by field dependencies can only be done indirectly currently, because such links are not actually made invalid by the inferencing code, and just drawn red by the editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/114903
2023-11-15 12:26:48 +01:00
Campbell Barton 5ebaf8af59 Build: correct package name & code-comment for WESTON in lib/ 2023-11-09 14:57:09 +11:00
Campbell Barton 6bba008325 Cleanup: format 2023-11-09 09:34:49 +11:00
Brecht Van Lommel dccbc27eab Tests: add WIITH_TESTS_BATCHED option to execute Blender once per test
Some tests like cycles, sequencer and compositor batch together multiple
tests in a single Blender invocation. This makes them run faster, but
makes debugging harder. This is an option to disable that batching.

Pull Request: https://projects.blender.org/blender/blender/pulls/114603
2023-11-08 18:41:33 +01:00
Christoph Lendenfeld 40dccc1975 Anim: Unit tests for inserting keyframes
Cover the current behavior of keyframe insertion with unit tests,
so the changes planned in #113278 are less likely to break things.

Unit tests added:

InsertKeyTest
very basic test to ensure keying things by
name or with a keying set adds the right keys

VisualKeyingTest
check if visual keying produces the
correct keyframe values

CycleAwareKeyingTest
check if cycle aware keying remaps
the keyframes correctly and adds fcurve modifiers

Pull Request: https://projects.blender.org/blender/blender/pulls/114465
2023-11-07 16:17:32 +01:00
Campbell Barton 6297bbe931 License headers: attribute copyright to "Blender Authors"
See #110784, it seems that merging functionality reintroduced the old
convention.
2023-11-07 15:42:52 +11:00