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-12-25Cleanup: use new c++ guarded allocator APIAaron Carlisle
API added in rBa3ad5abf2fe85d623f9e78fefc34e27bdc14632e
2021-12-22Mesh: Parallelize bounding box calculation (WIP)Hans Goudey
This replaces the single-threaded calculation of mesh min and max positions with a `parallel_reduce` loop. Since the bounding box of a mesh is retrieved quite often (at the end of each evaluation, currently 2(?!) times when leaving edit mode, etc.), this makes for a quite noticeable speedup actually. On my Ryzen 3700x and a 4.2 million vertex mesh, I observed a 4.4x performance increase, from 14 ms to 4.4 ms. I added some methods to `float3` so they would be inlined, but they're also a nice addition, since they're used often anyway. Differential Revision: https://developer.blender.org/D13572
2021-12-22Fix: Build issue on 32 bit archsRay Molenkamp
The cast to size_t leads to a build issue on 32 bit archs. cursor_delim_type_utf8 expects an int so an additional cast to size_t is not required. Reported by user frispete on devtalk.
2021-12-21Fix T93960: Asset Catalogs I/O fails with unicode file paths on WindowsSybren A. Stüvel
On Windows, encode file paths as UTF-16 before trying to open the file for reading/writing. This introduces a new class `blender::fstream`, which wraps `std::fstream` and provides this UTF-16 encoding. This class should also be used in other areas, like the Alembic importer/exporter. Manifest Task: T93960 Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13633
2021-12-20BLI: fix Vector.prepend declarationJacques Lucke
Using `&&` there was a typo. With `&&` the `prepend` method could not be called with a const reference as argument.
2021-12-20Docs: use doxygen formatting for BLICampbell Barton
Differentiate doc-strings from title/section text.
2021-12-17Fix T94116: Drivers can have multiple variables with same nameSybren A. Stüvel
The RNA setter now ensures that driver variables are uniquely named (within the scope of the driver). Versioning code has been added to ensure this uniqueness. The last variable with the non-unique name retains the original name; this ensures that the driver will still evaluate to the same value as before this fix. This also introduces a new blenlib function `BLI_listbase_from_link()`, which can be used to find the entire list from any item within the list. Manifest Task: T94116 Reviewed By: mont29, JacquesLucke Maniphest Tasks: T94116 Differential Revision: https://developer.blender.org/D13594
2021-12-17Allocator: simplify using guarded allocator in C++ codeJacques Lucke
Using the `MEM_*` API from C++ code was a bit annoying: * When converting C to C++ code, one often has to add a type cast on returned `void *`. That leads to having the same type name three times in the same line. This patch reduces the amount to two and removes the `sizeof(...)` from the line. * The existing alternative of using `OBJECT_GUARDED_NEW` looks a out of place compared to other allocation methods. Sometimes `MEM_CXX_CLASS_ALLOC_FUNCS` can be used when structs are defined in C++ code. It doesn't look great but it's definitely better. The downside is that it makes the name of the allocation less useful. That's because the same name is used for all allocations of a type, independend of where it is allocated. This patch introduces three new functions: `MEM_new`, `MEM_cnew` and `MEM_delete`. These cover the majority of use cases (array allocation is not covered). The `OBJECT_GUARDED_*` macros are removed because they are not needed anymore. Differential Revision: https://developer.blender.org/D13502
2021-12-16Docs: add doc-strings for BLI_path functionsCampbell Barton
2021-12-16Fix compile error on Windows.Thomas Dinges
2021-12-16WM: various changes to file writing behaviorCampbell Barton
Saving with only a filename (from Python) wasn't being prevented, while it would successfully write the file to the working-directory, path remapping and setting relative paths wouldn't work afterwards as `Main.filepath` would have no directory component. Disallow this since it's a corner case which only ever occurs when path names without any directories are used from Python, the overhead of expanding the working-directory for all data saving operations isn't worthwhile. The following changes have been made: - bpy.ops.wm.save_mainfile() without a filepath argument fails & reports and error when the file hasn't been saved. Previously it would write to "untitled.blend" and set the `G.main->filepath` to this as well. - bpy.ops.wm.save_mainfile(filepath="untitled.blend") fails & reports and error as the filename has no directory component. - `BLI_path_is_abs_from_cwd` was added to check if the path would attempt to expand to the CWD.
2021-12-14Cleanup: resolve parameter mis-matches in doc-stringsCampbell Barton
Renamed or removed parameters which no longer exist.
2021-12-14Cleanup: correct unbalanced doxygen groupsCampbell Barton
Also add groups in some files.
2021-12-13UI: String Search: Add an optional weight parameterHans Goudey
This builds off of rBf951aa063f7, adding a weight parameter which can be used to change the order of items when they have the same match score. In the future, if string searching gets a C++ API, we could use an optional parameter for the weight, since it is not used yet. This will be used for the node link drag search menu (D8286). Differential Revision: https://developer.blender.org/D13559
2021-12-13Cleanup: spelling in commentsCampbell Barton
Also move notes about where noise functions come from into the function body as it's not relavant to the public doc-string.
2021-12-11macOS: add tilde-based path expanderAnkit Meel
Replaces `HOME` environment variable usage for user directories like in D12802. Reviewed By: #platform_macos, brecht Differential Revision: https://developer.blender.org/D13212
2021-12-10Cleanup: move public doc-strings into headers for various API'sCampbell Barton
Some doc-strings were skipped because of blank-lines between the doc-string and the symbol and needed to be moved manually. - Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. Ref T92709
2021-12-10Cleanup: spelling in commentsCampbell Barton
2021-12-09Cleanup: spelling in commentsCampbell Barton
2021-12-09Cleanup: move public doc-strings into headers for 'blenlib'Campbell Barton
- Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. - Minor improvements to doc-strings. Ref T92709
2021-12-09Fix T93858: Zstd-compressed .blend files from external tools aren't recognizedLukas Stockner
The issue here was that after the seek table check, the underlying file wasn't rewound to the start, so the code that checks for the BLENDER header immediately reaches EOF and fails. Since Blender always writes files with a seek table, this bug isn't triggered by files saved in Blender itself. However, files compressed in external tools generally don't have a seek table.
2021-12-08Cleanup: Clang-Tidy modernize-redundant-void-argAaron Carlisle
2021-12-07Cleanup: Use rcti marking dirty regions when texture painting.Jeroen Bakker
Dirty regions when painting are not using rcti. Meaning less understandable code. Found issue when refactoring the image_gpu partial update. In a future change gpu partial update API will be using rcti also what makes the code even cleaner. Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D13260
2021-12-02BLI: avoid invoking tbb for small workloadsJacques Lucke
We often call `parallel_for` in places with very variable sized workloads. When many elements are processed, using multi-threading is great, but when processing few elements (possibly many times) using `parallel_for` can result in significant overhead. I measured that this improves performance by >20% in the refactored realize instances code I'm working on separately. The change might also help with debugging sometimes, because the stack trace is smaller and contains fewer irrevelant symbols.
2021-11-30Cleanup: capitalize NOTE tagCampbell Barton
2021-11-30Cleanup: spelling in comments & stringsCampbell Barton
2021-11-27Merge branch 'blender-v3.0-release'Brecht Van Lommel
2021-11-27Fix build error with TBB 2021 and booleansBrecht Van Lommel
Linux distributions are using newer TBB versions than official releases, and TBB 2021 is an API breaking release. In general we should avoid using TBB directly and go through the abstractions in BLI_task.hh, though there is no abstraction for this. For 3.0 the safe option is to just not cancel the task but instead early out in the lambda function. Given the grain size of 2048 there should be no significant performance difference. Differential Revision: https://developer.blender.org/D13382
2021-11-26Cleanup: remove warningsJacques Lucke
This assert was producing warning in debug builds because it was never hit under some circumstances.
2021-11-26Geometry Nodes: optimize Set Position nodeJacques Lucke
This implements four optimizations in the Set Position node: * Check whether the position input is the current position and ignore it if it is. This results in a speedup when only the Offset input is used. * Use multi-threading when copying to computed values to the position attribute. All geometry types benefit from this. * Use devirtualization for the offset and position input. This optimizes the common case that they are either single values or computed in the fly in a span. * Write to `Mesh->mvert` directly instead of creating a temporary span. This makes setting mesh vertex positions even more efficient. In my simple benchmark I'm using a White Noise node to offset the position of 1,000,000 vertices. The speed is `20 ms -> 4.5 ms` in the multi-threaded case and `32 ms -> 22 ms` in the single-threaded case.
2021-11-26Geometry Nodes: deduplicate virtual array implementationsJacques Lucke
For some underlying data (e.g. spans) we had two virtual array implementations. One for the mutable and one for the immutable case. Now that most code does not deal with the virtual array implementations directly anymore (since rBrBd4c868da9f97a), we can get away with sharing one implementation for both cases. This means that we have to do a `const_cast` in a few places, but this is an implementation detail that does not leak into "user code" (only when explicitly casting a `VArrayImpl` to a `VMutableArrayImpl`, which should happen nowhere).
2021-11-25BLI: remove special cases for is_span and is_single methodsJacques Lucke
Those were not implemented consistently and don't really help in practice.
2021-11-24Fix T92962 Boolean output indices unstable.Howard Trickey
A parallel loop to create the interesection meshes for each triangle meant that with parallelism, the output order of the created meshes could vary with each execution. Keep the parallelism for doing the CDTs for interesection, but move the extraction of the new faces into a serial loop afterwards, for repeatability.
2021-11-24BLI: add slice method to index mask and generic spanJacques Lucke
2021-11-24Geometry Nodes: use simpler types when devirtualizing virtual arrayJacques Lucke
The compiler is more likely to optimize away the function call overhead when the used type is simpler and not virtual.
2021-11-23Cleanup: clang tidyJacques Lucke
The parameter name was inconsistent with the declaration.
2021-11-23Clean-up: Fix BLI_rect.h collision with windows.hRay Molenkamp
windows.h `#defines rct1` as a number which is problematic if we include `BLI_rect.h` after `windows.h` . by renaming `rct1/2` to `rct_a/b` we side step the collision and straighten up the naming with the functions directly above it.
2021-11-23Cleanup: Suppress clang-tidy warning.Jeroen Bakker
2021-11-19Merge branch 'blender-v3.0-release'Bastien Montagne
Conflicts: source/blender/blenkernel/BKE_blender_version.h source/blender/blenloader/intern/versioning_300.c
2021-11-19BLI_listbase: Add utils to search from string or index.Bastien Montagne
If a valid matching string is found, return that item, otherwise fallback to the item matching the given index, if any. This will be useful in RNA override code, and potentially other areas where data in lists can be referenced by their names or indices.
2021-11-19Cleanup: fix typos in comments and docsBrecht Van Lommel
Contributed by luzpaz. Differential Revision: https://developer.blender.org/D13264
2021-11-16Geometry Nodes: refactor virtual array systemJacques Lucke
Goals of this refactor: * Simplify creating virtual arrays. * Simplify passing virtual arrays around. * Simplify converting between typed and generic virtual arrays. * Reduce memory allocations. As a quick reminder, a virtual arrays is a data structure that behaves like an array (i.e. it can be accessed using an index). However, it may not actually be stored as array internally. The two most important implementations of virtual arrays are those that correspond to an actual plain array and those that have the same value for every index. However, many more implementations exist for various reasons (interfacing with legacy attributes, unified iterator over all points in multiple splines, ...). With this refactor the core types (`VArray`, `GVArray`, `VMutableArray` and `GVMutableArray`) can be used like "normal values". They typically live on the stack. Before, they were usually inside a `std::unique_ptr`. This makes passing them around much easier. Creation of new virtual arrays is also much simpler now due to some constructors. Memory allocations are reduced by making use of small object optimization inside the core types. Previously, `VArray` was a class with virtual methods that had to be overridden to change the behavior of a the virtual array. Now,`VArray` has a fixed size and has no virtual methods. Instead it contains a `VArrayImpl` that is similar to the old `VArray`. `VArrayImpl` should rarely ever be used directly, unless a new virtual array implementation is added. To support the small object optimization for many `VArrayImpl` classes, a new `blender::Any` type is added. It is similar to `std::any` with two additional features. It has an adjustable inline buffer size and alignment. The inline buffer size of `std::any` can't be relied on and is usually too small for our use case here. Furthermore, `blender::Any` can store additional user-defined type information without increasing the stack size. Differential Revision: https://developer.blender.org/D12986
2021-11-12Cleanup: Improve commentHans Goudey
2021-11-03Cleanup: Remove effect-less constJulian Eisel
Using `const` on an enum type returned by value doesn't have an effect.
2021-11-03Cleanup: Avoid redundant template parameter in BLI serializing APIJulian Eisel
The `ContainerValue` template can obtain the type of the contained value via the given `Container` type, simply using `Container::value_type`. Use this as the default way to determine the value type which simplifies using the template. If necessary the value type can be passed explicitly still.
2021-11-02Fix T77681, T92634: noise texture artifacts with high detailBrecht Van Lommel
We run into float precision issues here, clamp the number of octaves to one less, which has little to no visual difference. This was empirically determined to work up to 16 before, but with additional inputs like roughness only 15 appears to work. Also adds misisng clamp for the geometry nodes implementation.
2021-11-02Fix T92736: Hole in mesh after Set PositionCharlie Jolly
The geometry node port of voronoi_smooth_f1 function has a division by zero when smoothness is set to zero. Using a safe_divide within the function causes issues and was noted in the original patch D12725. Solution in this case is to clamp zero smoothness to FLT_EPSILON. Reviewed By: JacquesLucke Maniphest Tasks: T92736 Differential Revision: https://developer.blender.org/D13069
2021-11-02BLI: avoid passing nullptr to strncmpJacques Lucke
This resulted in an ASAN warning.
2021-11-01Fix crash when "HOME" environment variable isn't definedCampbell Barton
Accessing the default directory in the file selector would crash if HOME was undefined. Add BKE_appdir_folder_default_or_root which never returns NULL.
2021-11-01BLI_path_util: assert to ensure BLI_join_dirfile is used correctlyCampbell Barton