Commit Graph

1187 Commits

Author SHA1 Message Date
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
Campbell Barton 5126677c6f Tests: add batch blend file loading utility
Useful for finding regression in file reading as well as issues reported
by ASAN, including memory leaks.
2023-09-27 16:50:09 +10:00
Campbell Barton 01bc51e7eb Tests: move utilities into their own directory
These programs don't run as part of automated tests but can be useful
utilities for developers to expose issues or bisecting
(in the case of event simulation).
2023-09-27 16:50:09 +10:00
Campbell Barton 224e623e3c Fix bf_animation_fcurves tests failing depending on preferences
User preferences could cause this test to fail,
tests should never read the users configuration.
2023-09-23 21:17:50 +10:00
Campbell Barton d2c271ec84 CMake: use bf_io_ prefix for IO tests
This simplifies running built-in IO tests with:

  ctest -R bf_io_

Also use "bf_io_" prefix for the libraries since it was already used
by some and it's a useful hint the libraries are used for IO.
2023-09-23 20:22:19 +10:00
Lukas Tönne 354915cf3c Nodes: revert the inline (pass-through) socket feature
Inlined sockets in the same vertical space are no longer supported.
This removes `input_output` socket declarations, the inlining feature in
node drawing, and the `Both` option for node group interface sockets.

Versioning code splits existing node group sockets into individual
sockets again. Unfortunately some links may get lost in versioning files
using the feature, because of an unnoticed bug: Socket identifiers have
to be unique in the node group items list but inlined input/output
sockets have the same identifier. This still works for most situations
because uniqueness is only required within input/output lists. Creating
proper unique identifiers will discard any link from the previous output
socket. This cannot easily be fixed without `after_linking` versioning
code, which should be avoided.

Pull Request: https://projects.blender.org/blender/blender/pulls/112560
2023-09-22 16:56:59 +02:00
Lukas Tönne 742f3b233f Nodes: Rename `ui_items` property to `items_tree`
DNA names are unchanged, just affects the RNA API.

Resolves #112523

Pull Request: https://projects.blender.org/blender/blender/pulls/112527
2023-09-18 18:07:26 +02:00
Hans Goudey 1cfed92c84 Fix: Exception creating geometry node group or node group socket
c951464b8a didn't update the uses of the API.
2023-09-18 11:01:05 -04:00
Campbell Barton def4a06fc9 Cleanup: format 2023-09-15 10:44:40 +10:00
Habib Gahbiche 64bd2091cf Realtime Compositor tests: enable keying tests.
Tests are not crashing anymore, so no reason to skip them.

Blend files are already available in svn. Reference images have been updated in svn revision `r63481`

Pull Request: https://projects.blender.org/blender/blender/pulls/112198
2023-09-14 20:27:31 +02:00
Christoph Lendenfeld 8f1bd71992 Fix #112085: Not able to insert keys on subframes
When subframes were enabled, and the time cursor was at a subframe position,
the keying would still insert the key at the full frame.

This was because the value passed to the key insertion
functions was just the full frame value and not the subframe part.
Fixing it by using `BKE_scene_frame_get()` which
returns the floating point frame including the subframe part.

I've added unit tests to ensure that inserting keys at subframe values doesn't cause issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/112131
2023-09-14 15:07:08 +02:00
Campbell Barton b7f3e0d84e Cleanup: spelling & punctuation in comments
Also remove some unhelpful/redundant comments.
2023-09-14 13:25:24 +10:00
Campbell Barton 6d6a99974d Fix script_validate_keymap test failing (mistake parsing --relaxed arg) 2023-09-14 12:38:34 +10:00
Campbell Barton 716d1b9e29 Tests: bl_keymap_validate failure wasn't causing tests to fail
bl_keymap_validate wasn't exiting with a non-zero exit code
on failure since [0] which unintentionally removed the assignment.

[0]: 167c4c6962
2023-09-13 15:11:38 +10:00
Campbell Barton 6adc6675ad Fix bl_keymap_validate.py failure caused by add-on key-maps 2023-09-13 15:09:54 +10:00