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
AgeCommit message (Collapse)Author
2021-03-04BLI: support mutable lookup from multi value mapJacques Lucke
2021-02-23BLI: new FunctionRef typeJacques Lucke
Using `FunctionRef` is better than using `std::function`, templates and c function pointers in some cases. The trade offs are explained in more detail in code documentation. The following are some of the main benefits of using `FunctionRef`: * It is convenient to use with all kinds of callables. * It is cheaper to construct, copy and (possibly) call compared to `std::function`. * Functions taking a `FunctionRef` as parameter don't need to be declared in header files (as is necessary when using templates usually). Differential Revision: https://developer.blender.org/D10476
2021-02-21BLI: cleanup StringRef and Span and improve parameter validationJacques Lucke
Previously, methods like `Span.drop_front` would crash when more elements would be dropped than are available. While this is most efficient, it is not very practical in some use cases. Also other languages silently clamp the index, so one can easily write wrong code accidentally. Now, `Span.drop_front` and similar methods will only crash when n is negative. Too large values will be clamped down to their maximum possible value. While this is slightly less efficient, I did not have a case where this actually mattered yet. If it does matter in the future, we can add a separate `*_unchecked` method. This should not change the behavior of existing code.
2021-02-06Cleanup: malformed web addresses in commentsCampbell Barton
2021-02-05Cleanup: correct spelling in commentsCampbell Barton
2021-01-04Cleanup: use 'pragma once'Campbell Barton
Add explanations for cases the header-guard defines are still used.
2020-12-16BLI: remove implicit casts between some span typesJacques Lucke
Casting pointers from one type to another does change the value of the pointer in some cases. Therefore, casting a span that contains pointers of one type to a span that contains pointers of another type, is not generally safe. In practice, this issue mainly comes up when dealing with classes that have a vtable. There are some special cases that are still allowed. For example, adding const to the pointer does not change the address. Also, casting to a void pointer is fine. In cases where implicit conversion is disabled, but one is sure that the cast is valid, an explicit call of `span.cast<NewType>()` can be used.
2020-12-16BLI: add new InplacePriorityQueue data structureJacques Lucke
This data structure adds priority queue functionality to an existing array. The underlying array is not changed. Instead, the priority queue maintains indices into the original array. Changing priorities of elements dynamically is supported, but the priority queue has to be informed of such changes. This data structure is needed for D9787.
2020-12-16BLI: constexpr Span, IndexRange, StringRef(Null/Base)Ankit Meel
Motivated by `std::string_view` being usable in const (compile-time) context. One functional change was needed for StringRef: `std::char_traits<char>::length(str)` instead of `strlen`. Reviewed By: JacquesLucke, LazyDodo Differential Revision: https://developer.blender.org/D9788
2020-12-14Fix windows build.Alexander Gavrilov
2020-12-13Fix weird Swing+Twist decomposition with noncanonical quaternions.Alexander Gavrilov
It turns out that after the fix to T83196 (rB814b2787cadd) the matrix to quaternion conversion can produce noncanonical results in large areas of the rotation space, when previously this was limited to way smaller areas. This in turn causes Swing+Twist math to produce angles beyond 180 degrees, e.g. outputting a -120..240 range. This fixes both issues, ensuring that conversion outputs a canonical result, and decomposition canonifies its input. This was reported in chat by @jpbouza.
2020-12-10Cleanup: avoid '_ln' suffixCampbell Barton
Use '_len' or '_line_number'.
2020-12-10BLI_string: support escaping additional control characterCampbell Barton
Add support for escaping \a, \b & \f for completeness, currently it's not required.
2020-12-10BLI_string: add BLI_str_unescape utility functionCampbell Barton
Performs the reverse of BLI_str_escape. This allows logic to be removed from RNA path handling.
2020-12-10Fix BLI_str_escape with control characters, add unit testsCampbell Barton
2020-12-07Cleanup: partial Clang-Tidy modernize-loop-convertSybren A. Stüvel
Modernize loops by using the `for(type variable : container)` syntax. Some loops were trivial to fix, whereas others required more attention to avoid semantic changes. I couldn't address all old-style loops, so this commit doesn't enable the `modernize-loop-convert` rule. Although Clang-Tidy's auto-fixer prefers to use `auto` for the loop variable declaration, I made as many declarations as possible explicit. To me this increases local readability, as you don't need to fully understand the container in order to understand the loop variable type. No functional changes.
2020-12-04Cleanup: Clang-Tidy, modernize-use-usingSybren A. Stüvel
Replace `typedef` with `using` in C++ code. In the case of `typedef struct SomeName { ... } SomeName;` I removed the `typedef` altogether, as this is unnecessary in C++. Such cases have been rewritten to `struct SomeName { ... };` No functional changes.
2020-12-04Cleanup: Clang-Tidy, modernize-deprecated-headersSybren A. Stüvel
No functional changes.
2020-11-30Fix T83196: bad matrix to quaternion precision near 180 degrees rotation.Alexander Gavrilov
Adjust the threshold for switching from the base case to trace > 0, based on very similar example code from www.euclideanspace.com to avoid float precision issues when trace is close to -1. Also, remove conversions to and from double, because using double here doesn't really have benefit, especially with the new threshold. Finally, add quaternion-matrix-quaternion round trip tests with full coverage for all 4 branches. Differential Revision: https://developer.blender.org/D9675
2020-11-28Fix T83023: incorrect shape of cyclic F-Curve with only two points.Alexander Gavrilov
The equation solver didn't handle the one unknown case correctly.
2020-11-24Speedups for new boolean. Better hash function for verts.Howard Trickey
The existing hash function didn't work well with Set's method of masking to the lower bits, because many verts have zeros in the lower bits. Also, replaced VectorSet with Set for Vert deduping.
2020-11-21Improve speed of Constrained Delaunay Triangulation with exact arith.Howard Trickey
By using floating point filters, the speed improves by a factor of 2 to 10. This will help speed up some cases of the Exact Boolean modifier. Changed the interface of mpq2::isect_seg_seg to not return mu, as it was not needed and not calculating it saved 15% time.
2020-11-13BLI_math: add floor_power_of_10, ceil_power_of_10Campbell Barton
Add utility functions to get the floor/ceiling of a float value to the next power of 10.
2020-11-09Cleanup: fix wrong merge, remove extra unique_ptr.Ankit Meel
Mistakes added in 3cb4c513080ebeead7c5629a7f0503fae9513803 and bec1765340c3c13f002882ce147762e4c38ed2c6 Reviewed By: sergey Differential Revision: https://developer.blender.org/D9514
2020-11-09Cleanup: clang-formatCampbell Barton
2020-11-07Merge new boolean fix from blender-v2.91-release.Howard Trickey
2020-11-07Fix T82301, exact boolean fail on cube with bump.Howard Trickey
The code for determining coplanar clusters had a bug where it would miss some triangles. The fix for now is to just put triangles in the cluster if their bounding boxes overlap. This works but maybe makes clusters bigger then they have to be. I'll follow this commit with work on making the CDT routine faster when using exact arithmetic. Also removed a lot of unused code, and added some new intersect performance tests.
2020-11-06Cleanup: Clang-Tidy modernize-use-nullptrSybren A. Stüvel
Replace `NULL` with `nullptr` in C++ code. No functional changes.
2020-11-06Cleanup: Clang-Tidy, modernize-make-uniqueSergey Sharybin
2020-11-06Cleanup: Clang-Tidy, modernize-use-bool-literalsSergey Sharybin
2020-11-06Cleanup: use ELEM macro (>2 args)Campbell Barton
2020-10-29BLI: use forwarding reference in MapJacques Lucke
The is necessary when Map.add_or_modify is called with callbacks that return a reference.
2020-10-26Fix own previous commit re testing of `BLI_rel_path`.Bastien Montagne
Windows would need its own version of those tests, for now just disabling them on that platform.
2020-10-26Fix T81421: "Saving As..." a blend file with a Script node file path filled ↵Bastien Montagne
with 1023 symbols crashes Blender. Usual lack of protection against buffer overflows when manipulating strings. Also add some basic tests for `BLI_path_rel`.
2020-10-14BLI_ghash_performance_test: Fix memory leaksAnkit Meel
Reviewed By: mont29 Differential Revision: https://developer.blender.org/D9210
2020-10-12BLI: support looking up a key from a set or adding it when not existantJacques Lucke
2020-10-10Cleanup: spellingCampbell Barton
2020-10-10Cleanup: use C comments for descriptive textCampbell Barton
Follow our code style guide by using C-comments for text descriptions.
2020-10-02Cleanup: trailing spaceCampbell Barton
2020-09-17CMake: clean up setting of platform specific linker flagsBrecht Van Lommel
Set flags directly on the target, and use common function for all cases. This refactoring helps with the next commit for test executables. Ref D8714
2020-09-09BLI: new string search api that supports fuzzy and prefix matchingJacques Lucke
This adds a generic string search library in `BLI_string_search.h`. The library has a simple to use C api that allows it's users to filter and sort a set of possible search results based on some query string. Reviewers: Severin Differential Revision: https://developer.blender.org/D8825
2020-09-07BLI: improve exception safety of VectorSetJacques Lucke
For more information see rB2aff45146f1464ba8899368ad004522cb6a1a98c.
2020-09-05Cleanup: spellingCampbell Barton
2020-09-05New boolean: Fix second example in T79404.Howard Trickey
The code to detect non-trivial coplanar intersection sometimes falsely said there wasn't one. This caused some coplanar intersections to be missed. Also added a test for this case.
2020-09-04Cleanup: Clang-Tidy readability-inconsistent-declaration-parameter-name fixSebastian Parborg
No functional changes
2020-09-04Fix T78084: Search does not accept text fragments everywherePhilipp Oeser
This was reported for the "Add Node" search functionality, but is relevant in other searches as well. So e.g. when searching for "Separate XYZ", typing "sep", then " " (with the intention to type "X" next) would clear the search field. Now use the same method (matching against all search words) as in F3 searching ('menu_search_update_fn') in other searches as well [searching IDs, property objects, finding nodes,...] This should give a much nicer search experience in general. Note: this does not touch other searches in the Dopesheet, Outliner, Filebrowser or User Preferences that have other search implementations. Maniphest Tasks: T78084 Differential Revision: https://developer.blender.org/D8232
2020-09-03Fix clang tidy errors in testsJacques Lucke
2020-09-02Cleanup: spellingCampbell Barton
2020-09-01Fix compilation error with -Werror=array-boundsJacques Lucke
This error happened only with O2 or O3 in my tests. Casting to uintptr_t and back seems to quiet the compiler.
2020-08-30New Boolean: performance improvement.Howard Trickey
Avoided cost of searching for coplanar clusters in many cases.