Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
The implicit default constructor zeroes all plain data fields, and now
this behaviour is explicit & tested for in a unit test.
|
|
Use explicit `uint32_t` instead of `uint`, add a missing end-of-namespace
comment, and change `auto` to `const auto *`.
No functional changes.
|
|
Make it possible to unit test with `EXPECT_NE(uuid1, uuid2)`.
|
|
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.
|
|
No functional changes.
|
|
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
|
|
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.
|
|
Mention that `UUID_STRING_LEN` exists in the documentation of
`BLI_uuid_format()`.
No functional changes.
|
|
"iff" was intended as "if and only if". while exact use of abbreviations
isn't clear cut, I assumed this was a typo & it's not used anywhere
else in source/, expand to "only if" (suggested by Sybren).
|
|
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.
|
|
|
|
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
|