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
2022-11-08Fix deprecation warnings about printf() on macOSSergey Sharybin
The new Xcode 14.1 brings the new Apple Clang compiler which considers sprintf unsafe and geenrates deprecation warnings suggesting to sue snprintf instead. This only happens for C++ code by default, and C code can still use sprintf without any warning. This changes does the following: - Whenever is trivial replace sprintf() with BLI_snprintf. - For all other cases use the newly introduced BLI_sprintf which is a wrapper around sprintf() but without warning. There is a discouragement note in the BLI_sprintf comment to suggest use of BLI_snprintf when the size is known. Differential Revision: https://developer.blender.org/D16410
2022-09-25Cleanup: replace static_casts with functional casts for numeric typesCampbell Barton
2022-03-30Cleanup: use "num" as a suffix in: source/blender/blenlibCampbell Barton
Also replace "num" with: - "number" when it's not used to denote the number of items. - "digits" when digits in a string are being manipulated.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2021-12-08Cleanup: Clang-Tidy modernize-redundant-void-argAaron Carlisle
2021-10-14Cleanup: silence Clang missing-braces warning.Ankit Meel
2021-09-24UUID: add less-than operatorSybren A. Stüvel
Add `operator<` to C++ class to allow lexicographic ordering of UUIDs. This will be necessary when writing asset catalogs to disk in a predictable (i.e. ordered) manner.
2021-09-23Cleanup: UUID, fix clang-tidy warningsSybren A. Stüvel
Use explicit `uint32_t` instead of `uint`, add a missing end-of-namespace comment, and change `auto` to `const auto *`. No functional changes.
2021-09-23UUID: add `!=` operator for comparing UUIDsSybren A. Stüvel
Make it possible to unit test with `EXPECT_NE(uuid1, uuid2)`.
2021-09-23UUID: place C++ code in correct namespaceSybren A. Stüvel
Put the `bUUID` class in the `blender` namespace, instead of the `blender::bke` namespace. As a result, some C++ code now correctly uses the C++ class, where previously it would use the C struct and use implicit casting where necessary. As a result, support for initializer lists had to be explicitly coded and in another place an explicit `::bUUID` was necessary to avoid ambiguity.
2021-09-23Assets: add Asset Catalog systemSybren A. Stüvel
Catalogs work like directories on disk (without hard-/symlinks), in that an asset is only contained in one catalog. See T90066 for design considerations. #### Known Limitations Only a single catalog definition file (CDF), is supported, at `${ASSET_LIBRARY_ROOT}/blender_assets.cats.txt`. In the future this is to be expanded to support arbitrary CDFs (like one per blend file, one per subdirectory, etc.). The current implementation is based on the asset browser, which in practice means that the asset browser owns the `AssetCatalogService` instance for the selected asset library. In the future these instances will be accessible via a less UI-bound asset system. The UI is still very rudimentary, only showing the catalog ID for the currently selected asset. Most notably, the loaded catalogs are not shown yet. The UI is being implemented and will be merged soon. #### Catalog Identifiers Catalogs are internally identified by UUID. In older designs this was a human-readable name, which has the problem that it has to be kept in sync with its semantics (so when renaming a catalog from X to Y, the UUID can be kept the same). Since UUIDs don't communicate any human-readable information, the mapping from catalog UUID to its path (stored in the Catalog Definition File, CDF) is critical for understanding which asset is stored in which human-readable catalog. To make this less critical, and to allow manual data reconstruction after a CDF is lost/corrupted, each catalog also has a "simple name" that's stored along with the UUID. This is also stored on each asset, next to the catalog UUID. #### Writing to Disk Before saving asset catalogs to disk, the to-be-overwritten file gets inspected. Any new catalogs that are found thre are loaded to memory before writing the catalogs back to disk: - Changed catalog path: in-memory data wins - Catalogs deleted on disk: they are recreated based on in-memory data - Catalogs deleted in memory: deleted on disk as well - New catalogs on disk: are loaded and thus survive the overwriting #### Tree Design This implements the initial tree structure to load catalogs into. See T90608, and the basic design in T90066. Reviewed By: Severin Maniphest Tasks: T91552 Differential Revision: https://developer.blender.org/D12589
2021-09-21UUIDs: rename UUID to bUUIDSybren A. Stüvel
Rename the `UUID` struct to `bUUID`. This avoids a symbol clash on Windows, which also defines `UUID`. This only pops up when a `UUID` field is used in the DNA code, which is why it wasn't a problem before (it will be once D12589 lands). No functional changes.
2021-09-20UUID: add nil value for UUIDsSybren A. Stüvel
Add `BLI_uuid_nil()` that returns the nil UUID (used to indicate "not set") and `BLI_uuid_is_nil(uuid)` to do an equality test with the nil value.
2021-09-20UUID: fix seeding the RNG clock on macOSSybren A. Stüvel
On Apple machines, call `clock_gettime()` instead of `timespec_get()`. macOS only introduced `timespec_get()` in version 10.15 (introduced approx two years ago, so in 2019), even though the function is from C11.
2021-09-20UUID: include 'seconds' field of current time in RNG seedSybren A. Stüvel
XOR the 'seconds' and 'nanoseconds' fields of the current time to seed the RNG used for generating random UUIDs. This ensures a better seed just in case the clock as no sub-second resolution.
2021-09-18Cleanup: add missing includesJacques Lucke
2021-09-17Cleanup: clang-tidy warnings in UUID codeSybren A. Stüvel
Use C++ version of C headers, and avoid static function call on instance. No functional changes.
2021-09-17Blenlib: introduce a UUID typeSybren A. Stüvel
Add `BLI_uuid` and `DNA_uuid_types.h` with a UUID implementation following RFC4122 (https://datatracker.ietf.org/doc/html/rfc4122.html). The following features are implemented: - A struct of 128 bits that can be used in DNA definitions. - Generation of version 4 UUIDs, that is, purely random ones. - UUID equality function. - String to UUID and UUID to string conversion functions that are compatible with RFC4122. - C++ stream operator that outputs the UUID as string. This UUID will be used by the asset system, to uniquely identify asset catalogs. Reviewed By: Severin, jacqueslucke Differential Revision: https://developer.blender.org/D12475