Blender Git Loki

Git Commits -> Revision 9b12b23

Revision 9b12b23 by Sybren A. Stüvel (master)
September 23, 2021, 13:00 (GMT)
Assets: add Asset Catalog system

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

Commit Details:

Full Hash: 9b12b23d0bace4056ed14ff3e3e8415eb4ff75af
Parent Commit: 222fd1a
Lines Changed: +1755, -0

8 Added Paths:

/source/blender/blenkernel/BKE_asset_catalog.hh (+252, -0) (View)
/source/blender/blenkernel/BKE_asset_library.h (+36, -0) (View)
/source/blender/blenkernel/BKE_asset_library.hh (+41, -0) (View)
/source/blender/blenkernel/intern/asset_catalog.cc (+573, -0) (View)
/source/blender/blenkernel/intern/asset_catalog_test.cc (+443, -0) (View)
/source/blender/blenkernel/intern/asset_library.cc (+53, -0) (View)
/source/blender/blenkernel/intern/asset_library_test.cc (+82, -0) (View)
/source/blender/blenkernel/intern/asset_test.cc (+70, -0) (View)

11 Modified Paths:

/release/scripts/startup/bl_ui/space_filebrowser.py (+13, -0) (Diff)
/source/blender/blenkernel/BKE_asset.h (+8, -0) (Diff)
/source/blender/blenkernel/CMakeLists.txt (+8, -0) (Diff)
/source/blender/blenkernel/intern/asset.cc (+25, -0) (Diff)
/source/blender/blenlib/BLI_uuid.h (+15, -0) (Diff)
/source/blender/blenlib/intern/uuid.cc (+32, -0) (Diff)
/source/blender/editors/space_file/CMakeLists.txt (+1, -0) (Diff)
/source/blender/editors/space_file/filelist.c (+27, -0) (Diff)
/source/blender/makesdna/DNA_asset_types.h (+14, -0) (Diff)
/source/blender/makesdna/DNA_uuid_types.h (+6, -0) (Diff)
/source/blender/makesrna/intern/rna_asset.c (+56, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021