Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2020-07-27Fix USD unit test on buildbotSybren A. Stüvel
The buildbot uses a separate `CMAKE_INSTALL_PREFIX`. This means that the unit test could not find its USD JSON files in the build directory. Using `${CMAKE_INSTALL_PREFIX}` instead of `$<TARGET_FILE_DIR:blender>` solved this.
2020-07-27CTest: Fix blender_test not working on windows.Ray Molenkamp
MSVC does need the wholearchive flag but it was not set, so no tests were actually linked into the binary. Reviewed By: sybren Differential Revision: https://developer.blender.org/D8404
2020-07-26Functions: move tests closer to codeJacques Lucke
2020-07-24Merge branch 'blender-v2.90-release'Jacques Lucke
2020-07-24Allocator: make leak detection work with static variablesJacques Lucke
When definining static variables that own memory, you should use the "construct on first use" idiom. Otherwise, you'll get a warning when Blender exits. More details are provided in D8354. Differential Revision: https://developer.blender.org/D8354
2020-07-23Cleanup: unify naming between different spansJacques Lucke
2020-07-23BLI: move some tests into blenlib/testsJacques Lucke
Reviewers: sybren Differential Revision: https://developer.blender.org/D8315
2020-07-21Bevel: Refactor "Vertex Only" to an enumHans Goudey
This matches the change that was done to the bevel modifier so that the interface for the modifier, the active tool, and the operator are consistent. This commit extends the refactor to the bmesh implementation too, so that the parameters in the implementation don't stray too far from what is exposed. Tests are adjusted and still pass.
2020-07-21Drivers: add lerp and clamp functions to namespace.Alexander Gavrilov
Implementation of lerp without a function requires repeating one of the arguments, which is not ideal. To avoid that, add a new function to the driver namespace. In addition, provide a function for clamping between 0 and 1 to support easy clamped lerp, and a smoothstep function from GLSL that is somewhat related. The function implementations are added to a new bl_math module. As an aside, add the round function and two-argument log to the pylike expression subset. Differential Revision: https://developer.blender.org/D8205
2020-07-20BLI: add Vector/Array.fill methodsJacques Lucke
2020-07-20Refactor: Update integer type usageJacques Lucke
This updates the usage of integer types in code I wrote according to our new style guides. Major changes: * Use signed instead of unsigned integers in many places. * C++ containers in blenlib use `int64_t` for size and indices now (instead of `uint`). * Hash values for C++ containers are 64 bit wide now (instead of 32 bit). I do hope that I broke no builds, but it is quite likely that some compiler reports slightly different errors. Please let me know when there are any errors. If the fix is small, feel free to commit it yourself. I compiled successfully on linux with gcc and on windows.
2020-07-17Cleanup: avoid static initialization order issues when accessing CPPTypesJacques Lucke
Instead of depending on static initialization order of globals use static variables within functions. Those are initialized on first use. This is every so slighly less efficient, but avoids a full class of problems.
2020-07-16Tests: disable ASAN when discovering testsSybren A. Stüvel
CMake, when it's configuring the project, runs the `blender_test` test runner (if it exists from a previous build) to discover which tests it contains. At this time none of the tests themselves are run, so it's not that useful to run ASAN and have it break things when there are memory leaks. This commit disables ASAN by injecting `ASAN_OPTIONS="detect_leaks=0"` in the environment variables. It is not enough to use `set(ENV{ASAN_OPTIONS} "detect_leaks=0")` in `tests/gtests/runner/CMakeLists.txt`, as it wouldn't be passed to the child process.
2020-07-16Tests: move tests from USD test directory into `io/common` and `io/usd`Sybren A. Stüvel
This commit is a followup of {D7649}, and ports the USD tests to the new testing approach. It moves test code from `tests/gtests/usd` into `source/blender/io/common` and `source/blender/io/usd`, and adjusts the use of namespaces to be consistent with the other tests. I decided to put one test into `io/usd/tests`, instead of `io/usd/intern`. The reason is that this test does not correspond with a single file in that directory; instead, it tests Blender's integration with the USD library itself. There are two new CLI arguments for the Big Test Runner: - `--test-assets-dir`, which points to the `lib/tests` directory in the SVN repository. This allows unit tests to find test assets. - `--test-release-dir`, which points to `bin/{BLENDER_VERSION}` in the build directory. At the moment this is only used by the USD test. The CLI arguments are automatically passed to the Big Test Runner when using `ctest`. When manually running the tests, the arguments are only required when there is a test run that needs them. For more info about splitting some code into 'common', see rB084c5d6c7e2cf8. No functional changes to the tests themselves, only to the way they are built & run. Differential Revision: https://developer.blender.org/D8314 Reviewed by: brecht, mont29
2020-07-16T73268: Link C/C++ unit tests into single executableSybren A. Stüvel
This commit introduces a new way to build unit tests. It is now possible for each module to generate its own test library. The tests in these libraries are then bundled into a single executable. The test executable can be run with `ctest`. Even though the tests reside in a single executable, they are still exposed as individual tests to `ctest`, and thus can be selected via its `-R` argument. Not yet ported tests still build & run as before. The following rules apply: - Test code should reside in the same directory as the code under test. - Tests that target functionality in `somefile.{c,cc}` should reside in `somefile_test.cc`. - The namespace for tests is the `tests` sub-namespace of the code under test. For example, tests for `blender::bke` should be in `blender::bke:tests`. - The test files should be listed in the module's `CMakeLists.txt` in a `blender_add_test_lib()` call. See the `blenkernel` module for an example. Reviewed By: brecht Differential Revision: https://developer.blender.org/D7649
2020-07-16BLI: move safe math functions to separate headerJacques Lucke
2020-07-16BLI: add safe_divide, safe_modf and safe_logfJacques Lucke
Those are defined exactly as their corresponding functions in Cycles.
2020-07-16BLI: add safe_powf functionJacques Lucke
The same function is also used by cycles.
2020-07-15Fix signed/unsigned comparisonJacques Lucke
2020-07-13Fix: Fix build error with MSVC in BLI_span_testRay Molenkamp
span.size() returns an uint, causing a signed/unsigned comparison using 3u sidesteps the issue
2020-07-13BLI: fix constructor regression for Vector and ArrayJacques Lucke
This was introduced in rB403384998a6bb5f428e15ced5.
2020-07-11Nodes: support implicit conversions and incorrectly linked socketsJacques Lucke
2020-07-10Functions: make generic types hashableJacques Lucke
2020-07-10Functions: make generic types equality comparableJacques Lucke
2020-07-08BLI: improve constructors and conversions to spanJacques Lucke
This allows us to avoid many calls to `as_span()` methods. I will remove those in the next commit. Furthermore, constructors of Vector and Array can convert from one type to another now. I tested these changes on Linux with gcc and on Windows.
2020-07-08Cleanup: add correct license header to testsJacques Lucke
2020-07-08BLI: add disjoint set data structureJacques Lucke
This can be used to find separate islands in meshes efficiently (as is done in cycles already). Furthermore, this helps to implement some algorithms on node trees more efficiently.
2020-07-07Functions: add generic functions that output constantsJacques Lucke
2020-07-07Functions: Add debug print and destruct callback to CPPTypeJacques Lucke
2020-07-07IO: Reversed persistent ID order in exports to Alembic and USDSybren A. Stüvel
Each duplicated (a.k.a. instanced) object has a Persistent ID, which identifies a dupli within the context of its duplicator. This ID consists of several numbers when there are nested duplis (for example a mesh instancing empties on its vertices, where each empty instances a collection). When exporting to Alembic/USD, these are used to uniquely name the duplicated objects in the export. This commit reverses the order of the persistent ID numbers, so that the first number identifies the first level of recursion. This produces trees like this: ABC `--Triangle |--Triangle |--Empty-1 | `--Pole-1-0 | |--Pole | `--Block-1-1 | `--Block |--Empty | `--Pole-0 | |--Pole | `--Block-1 | `--Block |--Empty-2 | `--Pole-2-0 | |--Pole | `--Block-2-1 | `--Block `--Empty-0 `--Pole-0-0 |--Pole `--Block-0-1 `--Block It is now clearer that `Pole-2-0` and `Block-2-1` are instanced by `Empty-2`. Before this commit, they would have been named `Pole-0-2` and `Block-1-2`.
2020-07-07IO: Fix bug exporting dupli parent/child relationsSybren A. Stüvel
Exporting a scene to USD or Alembic would fail when there are multiple duplicates of parent & child objects, duplicated by the same object. For example, this happens when such a hierarchy of objects is contained in a collection, and that collection is instanced multiple times by mesh vertices. The problem here is that the 'parent' pointer of each duplicated object points to the real parent; Blender would not figure out properly which duplicated parent should be used. This is now resolved by keeping track of the persistent ID of each duplicated instance, which makes it possible to reconstruct the parent-child relations of duplicated objects. This does use up some memory for each dupli, so it could be heavy to export a Spring scene (with all the pebbles and leaves), but it's only a small addition on top of the USD/Alembic writer objects that have to be created anyway. At least with this patch, they're created correctly. Code-wise, the following changes are made: - The export graph (that maps export parent to its export children) used to have as its key (Object, Duplicator). This is insufficient to correctly distinguish between multiple duplis of the same object by the same duplicator, so this is now extended to (Object, Duplicator, Persistent ID). To make this possible, new classes `ObjectIdentifier` and `PersistentID` are introduced. - Finding the parent of a duplicated object is done via its persistent ID. In Python notation, the code first tries to find the parent instance where `child_persistent_id[1:] == parent_persistent_id[1:]`. If that fails, the dupli with persistent ID `child_persistent_id[1:]` is used as parent. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8233
2020-07-07Fix sign conversion errorJacques Lucke
2020-07-06Fix build error with tests for removed functionsHans Goudey
These GHash functions were removed in 12817083ec61, so the tests should be removed too.
2020-07-06BLI: add methods to lookup a stored key in a setJacques Lucke
2020-07-06BLI: improve exception safety of memory utilsJacques Lucke
Even if we do not use exception in many places in Blender, our core C++ library should become exception safe. Otherwise, we don't even have the option to work with exceptions if we decide to do so.
2020-07-06BLI: refactor how buffers for small object optimization are storedJacques Lucke
Previously, there was an error when operator-> was returning an invalid type. See error C2839.
2020-07-05Revert "BLI: refactor how buffers for small object optimization are stored"Jacques Lucke
This reverts commit 5d79f9f276b4b3e6289308c534c58e7ee3bb5e2d. This was introducing build errors in windows. Need a bit more time to check it.
2020-07-05BLI: refactor how buffers for small object optimization are storedJacques Lucke
2020-07-03Fix T72214: Fluids: noise does not work with negative frame numbersJacques Lucke
The issue is duplicated code. There are two functions that zero-fill the frame number. They worked the same for positive frames numbers, but behaved differently for negative ones. On frame `-100`, `BLI_path_frame` outputs `-0100` and `fluid_cache_get_framenr_formatted_$ID$` outputted `-100`. I changed the behavior of the latter, because we depend on the behavior of the former for much longer already. Reviewers: sebbas Differential Revision: https://developer.blender.org/D8107
2020-07-03Cleanup: use nested namespacesJacques Lucke
2020-06-30Fix compile errorJacques Lucke
This is the same issue as in rBbcf49d13e53454.
2020-06-30Functions: add two more customizable multi-functionsJacques Lucke
2020-06-30Cleanup: move tests into their corresponding namespaceJacques Lucke
2020-06-30BLI: add Array constructor that does not initialize non-trivial typesJacques Lucke
This should rarely be necessary, but I have a use case coming up soon.
2020-06-30Alembic: new exporter based on the USD exporter structureSybren A. Stüvel
The Alembic exporter has been restructured by leverages the `AbstractHierarchyIterator` introduced by the USD exporter. The produced Alembic files have not changed much (details below), as the Alembic writing code has simply been moved from the old exporter to the new. How the export hierarchy is handled changed a lot, though, and also the way in which transforms are computed. As a result, T71395 is fixed. Differences between the old and new exporter, in terms of the produced Alembic file: - Duplicated objects now have a unique numerical suffix. - Matrices are computed differently, namely by simply computing the evaluated transform of the object relative to the evaluated transform of its export-parent. This fixes {T71395}, but otherwise should produce the same result as before (but with simpler code). Compared to the old Alembic exporter, Subdivision modifiers are now disabled in a cleaner, more efficient way (they are disabled when exporting with the "Apply Subdivisions" option is unchecked). Previously the exporter would move to a new frame, disable the modifier, evaluate the object, and enable the modifier again. This is now done before exporting starts, and modifiers are only restored when exporting ends. Some issues with the old Alembic exporter that have NOT been fixed in this patch: - Exporting NURBS patches and curves (see T49114 for example). - Exporting flattened hierarchy in combination with dupli-objects. This seems to be broken in the old Alembic exporter as well, but nobody reported this yet. Differential Revision: https://developer.blender.org/D7664 Reviewed By: Sergey
2020-06-29BLI: remove blender::Optional in favor of std::optionalJacques Lucke
`std::optional` can be used now, because we switched to C++17.
2020-06-27Functions: add MutableAttributesRef data structureJacques Lucke
This will be used to reference the content of a CustomData structure in C++ code, that does not need to know who owns the data but only works with it.
2020-06-27Cleanup: make it easier to check if a CPPType is a specific compile time typeJacques Lucke
2020-06-23Functions: Multi Function NetworkJacques Lucke
A multi-function network is a graph data structure, where nodes are multi-functions (or dummies) and links represent data flow. New multi-functions can be derived from such a network. For that one just has to specify two sets of sockets in the network that represent the inputs and outputs of the new function. It is possible to do optimizations like constant folding on this data structure, but that is not implemented in this patch yet. In a next step, user generated node trees are converted into a MFNetwork, so that they can be evaluated efficiently for many particles. This patch also includes some tests that cover the majority of the code. However, this seems to be the kind of code that is best tested by some .blend files. Building graph structures in code is possible, but is not easy to understand afterwards. Reviewers: brecht Differential Revision: https://developer.blender.org/D8049
2020-06-22Functions: add utilities that allow creating some multi-functions with less ↵Jacques Lucke
typing