Commit Graph

400 Commits

Author SHA1 Message Date
Brecht Van Lommel 6cab53eaaa Tests: fix some tests passing even if there are Python errors
Blender was not configured to exit with non-zero return code on Python errors.
A bunch of tests worked around this but not all. This removes the need for such
workarounds.
2020-04-28 12:50:16 +02:00
Brecht Van Lommel a7bd835644 Fix Python bundled module test error
We don't bundle cffi, rather the ffi library is used for ctypes. This test is
currently passing even when there are errors, that will be fixed next.
2020-04-28 12:48:29 +02:00
Himanshi Kalra b9f422c4be Tests: add physics tests cloth and softybody
This uses the same framework as automated modifier tests. It adds a physics
modifier, bakes and compares vertex coordinates on the end frame.

Differential Revision: https://developer.blender.org/D7017
2020-04-28 12:29:46 +02:00
Howard Trickey 18e9626e41 Strengthen modifiers test validation, from D7397.
Submitting on behalf of Jesse Y (deadpin).
In test harness for modifier testing, now run mesh validation
on output mesh. Also, fix printing so it interleaves properly.
2020-04-28 12:27:33 +02:00
Campbell Barton bae9553848 Test: update bl_run_operators blacklist, add volume object 2020-03-26 15:42:52 +11:00
Brecht Van Lommel c3651adf89 Tests: add OpenVDB volume tests 2020-03-18 11:23:05 +01:00
Julian Eisel dc2df8307f VR: Initial Virtual Reality support - Milestone 1, Scene Inspection
NOTE: While most of the milestone 1 goals are there, a few smaller features and
improvements are still to be done.

Big picture of this milestone: Initial, OpenXR-based virtual reality support
for users and foundation for advanced use cases.
Maniphest Task: https://developer.blender.org/T71347
The tasks contains more information about this milestone.

To be clear: This is not a feature rich VR implementation, it's focused on the
initial scene inspection use case. We intentionally focused on that, further
features like controller support are part of the next milestone.

- How to use?
Instructions on how to use this are here:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/How_to_Test
These will be updated and moved to a more official place (likely the manual) soon.

Currently Windows Mixed Reality and Oculus devices are usable. Valve/HTC
headsets don't support the OpenXR standard yet and hence, do not work with this
implementation.

---------------

This is the C-side implementation of the features added for initial VR
support as per milestone 1. A "VR Scene Inspection" Add-on will be
committed separately, to expose the VR functionality in the UI. It also
adds some further features for milestone 1, namely a landmarking system
(stored view locations in the VR space)

Main additions/features:
* Support for rendering viewports to an HMD, with good performance.
* Option to sync the VR view perspective with a fully interactive,
  regular 3D View (VR-Mirror).
* Option to disable positional tracking. Keeps the current position (calculated
  based on the VR eye center pose) when enabled while a VR session is running.
* Some regular viewport settings for the VR view
* RNA/Python-API to query and set VR session state information.
* WM-XR: Layer tying Ghost-XR to the Blender specific APIs/data
* wmSurface API: drawable, non-window container (manages Ghost-OpenGL and GPU
  context)
* DNA/RNA for management of VR session settings
* `--debug-xr` and `--debug-xr-time` commandline options
* Utility batch & config file for using the Oculus runtime on Windows.
* Most VR data is runtime only. The exception is user settings which are saved
  to files (`XrSessionSettings`).
* VR support can be disabled through the `WITH_XR_OPENXR` compiler flag.

For architecture and code documentation, see
https://wiki.blender.org/wiki/Source/Interface/XR.

---------------

A few thank you's:
* A huge shoutout to Ray Molenkamp for his help during the project - it would
  have not been that successful without him!
* Sebastian Koenig and Simeon Conzendorf for testing and feedback!
* The reviewers, especially Brecht Van Lommel!
* Dalai Felinto for pushing and managing me to get this done ;)
* The OpenXR working group for providing an open standard. I think we're the
  first bigger application to adopt OpenXR. Congratulations to them and
  ourselves :)

This project started as a Google Summer of Code 2019 project - "Core Support of
Virtual Reality Headsets through OpenXR" (see
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/).
Some further information, including ideas for further improvements can be found
in the final GSoC report:
https://wiki.blender.org/wiki/User:Severin/GSoC-2019/Final_Report

Differential Revisions: D6193, D7098

Reviewed by: Brecht Van Lommel, Jeroen Bakker
2020-03-17 21:42:44 +01:00
Sebastián Barschkis 5260aaf3b1 Fix T73921: Eevee volume render test memory leak in Mantaflow
Fixed memory leak that showed up after the original issue (crash) had been fixed in 93ac4709eb. The fix ensures that light cache bakes free up GPU smoke textures and the smoke domain list correctly.

This commit also removes the workaround (f3a33a9298) that disabled light cache bakes for fluid objects.
2020-03-14 00:30:55 +01:00
Bogdan Nagirniak 9075ec8269 Python: add foreach_get and foreach_set methods to pyrna_prop_array
This allows fast access to various arrays in the Python API.
Most notably, `image.pixels` can be accessed much more efficiently now.

**Benchmark**

Below are the results of a benchmark that compares different ways to
set/get all pixel values. I do the tests on 2048x2048 rgba images.
The benchmark tests the following dimensions:
- Byte vs. float per color channel
- Python list vs. numpy array containing floats
- `foreach_set` (new) vs. `image.pixels = ...` (old)

```
Pixel amount: 2048 * 2048 = 4.194.304
Byte buffer size:  16.8 mb
Float buffer size: 67.1 mb

Set pixel colors:
    byte  - new - list:    271 ms
    byte  - new - buffer:   29 ms
    byte  - old - list:    350 ms
    byte  - old - buffer: 2900 ms

    float - new - list:    249 ms
    float - new - buffer:    8 ms
    float - old - list:    330 ms
    float - old - buffer: 2880 ms

Get pixel colors:
    byte - list:   128 ms
    byte - buffer:   9 ms
    float - list:  125 ms
    float - buffer:  8 ms
```

**Observations**

The best set and get speed can be achieved with buffers and a float image,
at the cost of higher memory consumption. Furthermore, using buffers when
using `pixels = ...` is incredibly slow, because it is not optimized.
Optimizing this is possible, but might not be trivial (there were multiple
attempts afaik).

Float images are faster due to overhead introduced by the api for byte images.
If I profiled it correctly, a lot of time is spend in the `[0, 1] -> {0, ..., 255}`
conversion. The functions doing that conversion is `unit_float_to_uchar_clamp`.
While I have an idea on how it can be optimized, I do not know if it can be done
without changing its functionality slightly. Performance wise the best solution
would be to not do this conversion at all and accept byte input from the api
user directly, but that seems to be a more involved task as well.

Differential Revision: https://developer.blender.org/D7053

Reviewers: JacquesLucke, mont29
2020-03-13 12:59:36 +01:00
Brecht Van Lommel f3a33a9298 Fix/workaround Eevee tests crashing with Mantaflow
Skip light cache baking until T73921 is fixed. This should be fixed properly
but being able to run the tests at all is important now.
2020-03-11 14:42:46 +01:00
Campbell Barton 5b0f1e7649 Cleanup: formatting, strip trailing space 2020-03-05 08:05:21 +11:00
Howard Trickey 22a8a3b214 Apply patch D6620, Adde tests for Deform modifiers.
This test is authored by Himanshi Kalra (calra).
It requires a new modifers.blend in the svn tests.
2020-02-29 14:07:14 -05:00
Sybren A. Stüvel 10162d68e3 Constraints: replace 'Set Inverse' operator with an eval-time update
This fixes {T70269}.

Before this commit there was complicated code to try and compute the
correct parent inverse matrix for the 'Child Of' and 'Object Solver'
constraints outside the constraint evaluation. This was done mostly
correctly, but did have some issues. The Set Inverse operator now defers
this computation to be performed during constraint evaluation by just
setting a flag. If the constraint is disabled, and thus tagging it for
update in the depsgraph is not enough to trigger immediate evaluation,
evaluation is forced by temporarily enabling it.

This fix changes the way how the inverse matrix works when some of the
channels of the constraint are disabled. Before this commit, the channel
flags were used to filter both the parent and the inverse matrix. This
meant that it was impossible to make an inverse matrix that would
actually fully neutralize the effect of the constraint. Now only the
parent matrix is filtered, while inverse is applied fully. As a result,
pressing the 'Set Inverse' matrix produces the same transformation as
disabling the constraint. This is also reflected in the changed values
in the 'Child Of' unit test.

This change is not backward compatible, but it should be OK because the
old way was effectively unusable, so it is unlikely anybody relied on
it.

The change in matrix for the Object Solver constraint is due to a
different method of computing it, which caused a slightly different
floating point error that was slightly bigger than allowed by the test,
so I updated the matrix values there as well.

This patch was original written by @angavrilov and subsequently updated
by me.

Differential Revision: https://developer.blender.org/D6091
2020-02-27 10:37:59 +01:00
Sybren A. Stüvel 4f48179437 Constraints: fixed Object Solver 'Clear Inverse' operator
The 'Clear Inverse' operator didn't properly update the constraint, so
it didn't do anything until the entire depsgraph was updated. It's now
properly tagged for update.
2020-02-25 17:22:23 +01:00
Sybren A. Stüvel 65aa55babc Tests: Constraints, enable layer collections before testing
In the collections unit test file developers can now disable layer
collections and declutter the 3D Viewport while working in
`constraints.blend`, without influencing the actual unit tests themselves.
2020-02-25 17:22:23 +01:00
Sybren A. Stüvel 9cdf01085f Constraints: added unit test for Child Of with bone target
No functional changes.
2020-02-25 14:48:32 +01:00
Sybren A. Stüvel 7bc893c827 Start of unit test framework for constraints
Currently this only tests the Child Of constraint. My aim is to cover
constraints with tests before they are refactored/altered.

No functional changes.
2020-02-25 13:30:42 +01:00
Brecht Van Lommel b8567b704b Fix Cycles fluid motion blur not working after recent refactor
This also re-enables the fluid motion blur test.
2020-02-18 17:11:57 +01:00
Bastien Montagne 8a2228a597 Remove debug prints from blendfile_liblink.
rBf35f7bd97a4151 was the proper fix it seems.
2020-02-18 10:28:33 +01:00
Bastien Montagne f35f7bd97a Fix missing output dir for blendfile_liblink test. 2020-02-18 09:53:08 +01:00
Bastien Montagne a5ac142a31 Temp debug prints for liblink tests to check what happens on windows. 2020-02-17 21:41:15 +01:00
Sybren A. Stüvel 395e0c79bd Alembic: fix unit test on Windows
There are two issues solved in this commit:

- Our Windows buildbot has slightly different floating point errors than
  the Linux one, which meant a larger delta was required for float
  comparisons.
- The test performs an export to a temporary Alembic file and
  subsequently imports it. Deleting the temporary file was impossible on
  Windows because it was still in use. This is now resolved by first
  loading the default blend file before deleting the Alembic file.
2020-02-17 11:31:09 +01:00
Campbell Barton 1135c2cd17 Cleanup: CMake formatting 2020-02-15 10:40:41 +11:00
Sybren A. Stüvel 7c5a44c71f Alembic: refactor import and export of transformations
The Alembic importer now works with local coordinates. Previously, the
importer converted transformations from Alembic to world coordinates
before processing them further; this processing often included
re-converting to local coordinates. This change made it possible to
remove some code that assumed that a child transform was only read after
its parent transform.

Blender's Alembic code follows the Maya convention, where in the zero
orientation the camera looks forward instead of down. This extra
rotation is now handled more consistently, and now also properly handles
children of cameras. This fixes T73269.

Unit tests were added to at least ensure that the importer and exporter
are compatible with each other, and that static and animated camera
transforms are handled in the same way.
2020-02-14 15:41:17 +01:00
Sybren A. Stüvel f457dc122d Cleanup: Alembic, rename unit test
This rename is to prepare for a future addition to the unit test file.
Currently it's named "import" and I will add an export test as well. The
rename is a separate commit to easily see the difference between the
rename and the addition of another test.

No functional changes.
2020-02-14 15:41:11 +01:00
Bastien Montagne 0c5014aaef Cleanup: Deduplicate some code in new blenfile io/linking tests. 2020-02-14 12:18:21 +01:00
Bastien Montagne d46273563e Add initial, very basic save/open & library linking blendfile tests.
Do not do much for now, but would have been enough to catch the crash
introduced the other day in linking code...
2020-02-13 17:48:00 +01:00
Brecht Van Lommel 757da61606 Fix T68243: Python sqlite module not working on macOS 2020-02-11 10:17:35 +01:00
Howard Trickey 051ee76f7f Applying patch D6576, more tests for modifiers.
Patch from Jesse Y, reviewed by Habib Gahbiche.
Addes tests for modifiers: array, decimiate, mirror, screw, solidify,
subd, and weld.
2020-01-29 07:11:42 -05:00
Sybren A. Stüvel 84c537e685 Document that tessellate_polygon() doesn't handle degenerate geometry
This 'fixes' T68554: 'API mathutils.geometry.tessellate_polygon returns
bad results sometimes' by documenting the limitations of the current
implementation.

I've also added a unit test for the function, so that any change in this
behaviour will get noticed.

No functional changes.
2020-01-27 16:42:25 +01:00
Brecht Van Lommel 9cacadc8a6 Fix tests failing when building without Cycles
The purpose of this line was to not use Blender Internal and associated old
materials, now either Eevee or Cycles is fine.
2020-01-27 12:22:01 +01:00
Hans Goudey 9d90cad3ed Cleanup: Fix typo in instruction comments 2020-01-16 19:13:37 -05:00
Howard Trickey 3fdc04d3ee Accepting patch D5357: Modifiers and operators automated testing.
Patch from Habib Gahbiche (zazizizou) moves the "run operator and
compare mesh to a golden" paradigm used in bevel and boolean tests
into a general framework that separates the test specs from the
blend files. Then adds some other operator and modifier tests using
the new framework. Diff D5357.id20724.diff was applied.
New .blend files, modifiers.blend and operators.blend are needed
in the tests/modeling svn directory; those were separately committed.
2020-01-13 07:11:45 -05:00
Sergey Sharybin 002f5b826c Cycles: Disable fluid motion blur regression test
There are deeper issues than just updating the regression test .blend file
and the solution is dragging for far too long.

Considering this a known broken feature, which will either be fixed next week
or completely removed from the interface for the coming release.
2020-01-09 11:40:10 +01:00
Bastien Montagne 9984dd332f ID Management: Add some basic tests regarding name handling.
Those tests are here mostsly to ensure ID name management is working as
expected (the code ensuring we never have two ilocal data-blocks of the
same type with the same name in a .blend file).

Note: Currently fails in some cases, fixes are incoming.

Note: Ideally this would be in C, but we already have too many tests
linking the whole Blender and its libraries, this is becoming a real
pain to link debug + ASAN + tests build these days... So until we find a
better way to handle those dependencies, sticking to simple python
scripts.
2019-12-20 14:29:35 +01:00
Sybren A. Stüvel 846e402b08 Alembic: fixed unit test for exporter API change 2019-11-29 15:36:07 +01:00
Bastien Montagne eb798de101 Clean/Fix remaining cases of props assignments in resgistrable structs def.
We still had a few deprecated assignements of `bpy.props.xxx` to class
members in our API documentation and one of our py tests. Annotations
are to be used now.

Also remove the section about `register_module` utils, this has been
removed in 2.8.

Fix T71877: Python API overview sample code warning: class MyMaterialProps contains a property which should be an annotation!
Fix T71876: Python API overview references old bpy.utils.register_module function
2019-11-27 12:19:10 +01:00
Campbell Barton 312075e688 CMake: add missing headers, use space before comments 2019-10-29 01:33:44 +11:00
Sybren A. Stüvel 71f2229b0d Fix T68091: Adding a corrupt video crashes/confuses Blender
The problematic video from T68091 clearly has an invalid stream duration
(it would be 55 centuries long if interpreted at 30 FPS, and given that
it was recorded with an Android 9 device, it's unlikely that recording
started that long ago). I've added a heuristic to check the stream
duration against the container duration; if the stream is more than 4x
longer than the container, Blender now falls back to the container
duration.

We could use MIN(stream duration, container duration), but there might
be video files out there where the container duration is less precise
than the stream duration; they are measured in different units of time
(microseconds for the container vs. frames for the stream).

Includes a unit test for the above heuristic.

Reviewed by: jbakker

Differential revision: https://developer.blender.org/D5853
2019-09-19 15:12:53 +02:00
Brecht Van Lommel ad21a6c224 Fix script_load_modules test failure in power sequencer 2019-09-08 15:17:06 +02:00
Brecht Van Lommel 4764362ebb Fix GTests failing on Windows buildbot
Run these tests from the install directory so they can find dlls.
2019-09-07 22:51:19 +02:00
Brecht Van Lommel 2028302f44 Tests: run tests from install path
Blender can only be run correctly from the install path since it requires Python
scripts, dynamic libraries and other files to be present. By default the install
path is the same as the build path, so it works anyway. But on the buildbot it
isn't. There was a workaround but it failed on Windows and macOS.

Now tests run from the install path. Detecting that path for ctest is more
complicated than I would like, but I couldn't find a better solution.

Ref T69541.
2019-09-07 18:09:41 +02:00
Campbell Barton 1b0dd5a215 Cleanup: style, spelling 2019-09-07 21:28:05 +10:00
Clément Foucault 963a266faf EEVEE: Fix tests crashing if file is in edit mode 2019-09-07 00:44:20 +02:00
Clément Foucault 073624d4cc Eevee: Improve Test setup
- Remove use_screen_refraction as it conflict with SSR and SSS
- Increase GTAO distance
- Add a simple lightprobe setup that works well in most cases
- Enable soft shadows

Baking the lightprobes adds some overhead to the test time (+33%).

Reviewers: brecht

Differential Revision: https://developer.blender.org/D5507
2019-09-06 18:31:30 +02:00
Brecht Van Lommel bed321f6da Cleanup: remove debug print 2019-08-30 18:13:10 +02:00
Brecht Van Lommel 86b9470037 Tests: reorder render tests so cycles/eevee/workbench are not interleaved 2019-08-30 18:01:50 +02:00
Brecht Van Lommel dc216c89e0 Fix render test Python error on crashes 2019-08-26 10:10:35 +02:00
Brecht Van Lommel 256c412b31 Tests: also don't fail on memory leaks for gtests 2019-08-02 17:25:25 +02:00
Brecht Van Lommel 5f4e99b7a2 Fix broken add_python_test after recent changes 2019-08-02 15:45:01 +02:00