Commit Graph

1201 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Campbell Barton
dfd363edbd Cleanup: add SPDX-FileCopyrightText 2023-11-07 15:37:47 +11:00
Campbell Barton
79917e7bb3 Cleanup: minor corrections & clarifications for undo tests 2023-11-07 15:17:26 +11:00
Campbell Barton
f2fcfc8730 Tests: move undo tests from SVN into tests/python/ui_simulate 2023-11-07 14:55:30 +11:00
Campbell Barton
1496aa9d3e Tests: support running Blender with pre-compiled WAYLAND libraries 2023-11-07 14:15:12 +11:00
Campbell Barton
126f3bcfc1 Tests: support running graphical tests as part of CTests
User a Blender wrapper `tests/utils/blender_headless.py` to runs a
graphical instance of Blender within a headless weston compositor.

Currently only WAYLAND is supported as a back-end, support for other
platforms is possible. The tests can run from X11 since the tests don't
depend on existing instances of X11 or WAYLAND.

- Each test runs a separate headless instance of WESTON
  since the overhead is minimal, this allows tests to run in parallel
  without interfering with each other.

- There is a CMake option WESTON_BIN, when left empty the weston
  from LIBDIR is used. Otherwise this can point to the weston binary
  installed on the users system.

- In most cases simulated events are needed to implement these tests
  (running blender with `--enable-event-simulate`).

- This commit adds 14 undo tests - simulating user interaction as well
  as undo/redo actions, ensuring the desired result is reached.
  Other kinds of UI tests could be added in the future.

Ref !114164
2023-11-07 12:40:12 +11:00
Campbell Barton
2b508f7ae3 Cleanup: cmake indentation 2023-11-04 16:41:18 +11:00
Campbell Barton
ee3da7c26c Tests: add wrapper script to launch a graphical headless session
This wrapper script can be used instead of executing "blender"
to launch blender in it's own display server which is closed
when Blender quits.
The BLENDER_BIN environment variable is used to run Blender,
forwarding arguments & passing the exit-code back to the script.

This can be used to run automated graphical-tests while still being
in background (from a user perspective).
This has the advantage that windows don't popup in the foreground,
or on servers/VM's that aren't running a graphical session.
Running many Blender instances, each in their own display server
is also supported, allowing for tests to make use of multiple jobs.

Tested with graphical undo tests which have not yet been made part of
CTests (needs further investigation).

Currently this only supports WAYLAND however it can run on X11
since it launches it's own WAYLAND compositor instance for each
Blender session. The wrapper has been written with the intention of
adding support for other back-ends in the future (if practical).

Use the WESTON compositor since it's widely available and has a
headless server, any other WAYLAND-server could likely be used without
much trouble.
2023-11-04 14:29:38 +11:00
Michael B Johnson
b262655d39 USD: export to a single root prim by default
This PR adds the following changes:

A single root is always set as default. After talking to Wave and
Spiff, we settled on root being the best default. Users who don't
want a single root prim inserted, can choose to clear the field
The root prim no longer requires the user to prefix the field with /.
It will implicitly insert that for them.

On export, the root_prim hierarchy is now defined all as Xform
instead of just the final prim in the path. Each prim also has
custom metadata added to show that it was generated by Blender.
This follows convention in other DCCs as well.

On import, the code now finds the hierarchy of generated prims
using that metadata. It then skips importing them. This means that
you can roundtrip hierarchies even with an inserted root.

Co-authored-by: Dhruv Govil <dgovil2@apple.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113187
2023-10-20 10:58:40 -04:00
Bastien Montagne
b684864561 Fix USD I/O crashing on reports by using new wmJob report system.
Calling `WM_report` & co API from wmJob worker thread is utterly unsafe,
and should never have been done. It 'worked' so far presumably because
worker threads were barely (if ever) reporting anything that way, but
now USD IO code is spamming reports in some cases, leading to fairly
common crashes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113883
2023-10-20 11:08:27 +02:00
Miguel Pozo
1ba16edaf0 EEVEE-Next: Rename light probes
Update to the new naming convention for `Light Probes`:

`Reflection Cubemap` -> `Sphere`
`Reflection Plane` -> `Plane`
`Irradiance Grid` -> `Volume`

Note that this breaks the Python API (`bpy.types.LightProbe.type`).

Pull Request: https://projects.blender.org/blender/blender/pulls/113452
2023-10-11 19:38:42 +02:00
Campbell Barton
b434d40dbf CMake: quiet noisy messages on every run
Printing that a library is found every time CMake runs isn't helpful.
Restrict these messages for the first execution so messages are limited
to information developers may need to know such as features being
disabled because of incompatible configurations.
2023-10-07 18:20:30 +11:00
Brecht Van Lommel
f9bf2a71b4 Merge branch 'blender-v4.0-release' into main 2023-10-06 21:43:56 +02:00
Brecht Van Lommel
60ffec5a91 Tests: add dedicated directory for principled BSDF tests 2023-10-06 21:17:50 +02:00
Jeroen Bakker
79ca1b16ab Cleanup: Make format 2023-10-06 07:40:26 +02:00
Brecht Van Lommel
9e8ded92e5 Merge branch 'blender-v4.0-release' into main 2023-10-05 20:00:07 +02:00
Denis Kovacs
7a9284107d USD: Improve camera import/export and round-tripping
Fix various issues in import and export of cameras.

* Wrong units and flipped shift values on import
* Wrong clip start lower range on import
* Wrong units for aperture and focal length properties on export
* Issue with auto sensor fit and height > width on export

Pull Request: https://projects.blender.org/blender/blender/pulls/112905
2023-10-05 19:47:11 +02:00
Miguel Pozo
b4de568cc4 EEVEE-Next: Tests support
Enable tests for EEVEE Next.

As a workaround for allowing the use of EEVEE Next (still an
experimental feature) with `--factory-startup`, `arg_handle_engine_set`
enables the feature when `-E BLENDER_EEVEE_NEXT` is used.
In addition, EEVEE Next is always registered, so it's available when
calling `WM_init`.
If it's actually disabled, it will be immediately unregistered after that.

Notes:
- `get_gpu_device_type` always fails with error:
  > GPU API is not available in background mode
- Setup and tests are the same as EEVEE. There are many tests that
  only make sense for Cycles, and many EEVEE Next features that are
  not actually tested.

Pull Request: https://projects.blender.org/blender/blender/pulls/112161
2023-10-05 16:02:49 +02:00
Campbell Barton
9d20632925 Cleanup: ensure trailing newline, delete trailing space 2023-10-05 13:57:14 +11:00
Brecht Van Lommel
61f982f0d1 Cleanup: make format 2023-10-04 21:30:41 +02:00
Bastien Montagne
3d5c6dc218 Tests: Add test to open all blendfiles in current /lib/tests/ repository.
This is fairly brute force and rough, but there are quite a few old
files in there, helps a bit with versioning and readfile code testing.

Note: Five files are currently excluded since failing in debug builds
at least, most of the time for memleaks issues. The two other 'errors'
may also not be actual issues, but this needs to be investigated further.

Also, in the future, when time allows, it may be better to generate a
set of dedicated testing files, with as many official releases versions
as possible?

Re. #112649.
2023-10-04 14:15:06 +02:00
Campbell Barton
93aa1654be Fix crash caused by bl_keymap_validate clearing key-maps
The fix for disabling add-ons #113206 caused a crash when the
bl_keymap_validate test exited.

This happened because add-on unregister would try to remove key-map
items that had been freed.

Resolve by disabling all addons instead of clearing the keymaps.
2023-10-04 22:20:38 +11:00
Lukas Tönne
8a20bd4182 Test fix: Node groups outputs now placed before inputs
#113060 enforces output/input ordering of node group sockets.
The bf_node_group_interface test needs to be updated to reflect
these changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113213
2023-10-03 17:24:12 +02:00
Campbell Barton
fc8b1411cd Cleanup: correct struct comments & help text for batch loading utility 2023-09-28 14:28:12 +10:00