|
Blender V5.0
|
References the asset library directory. More...
Classes | |
| struct | PreexistingFileIndexInfo |
Public Member Functions | |
| AssetLibraryIndex (const StringRef library_path) | |
| uint64_t | hash () const |
| StringRefNull | get_library_file_path () const |
| void | init_indices_base_path () |
| Initializes #AssetLibraryIndex.indices_base_path. | |
| std::string | index_file_path (const BlendFile &asset_file) const |
| void | collect_preexisting_file_indices () |
| void | mark_as_used (const std::string &filename) |
| bool | delete_file_index (const std::string &filename) |
| int | remove_broken_index_files () |
| int | remove_unused_index_files () |
Public Attributes | |
| Map< std::string, PreexistingFileIndexInfo > | preexisting_file_indices |
| std::string | indices_base_path |
| Absolute path where the indices of library are stored. | |
| std::string | library_path |
References the asset library directory.
The AssetLibraryIndex instance collects file indices that are existing before the actual reading/updating starts. This way, the reading/updating can tag pre-existing files as used when they are still needed. Remaining ones (indices that are not tagged as used) can be removed once reading finishes.
Definition at line 287 of file asset_indexer.cc.
|
inline |
Definition at line 310 of file asset_indexer.cc.
References init_indices_base_path(), and library_path.
|
inline |
Check for pre-existing index files to be able to track what is still used and what can be removed. See #AssetLibraryIndex::preexisting_file_indices.
Definition at line 362 of file asset_indexer.cc.
References BLI_filelist_dir_contents(), BLI_filelist_free(), BLI_is_dir(), BLI_str_endswith(), i, direntry::path, and direntry::relname.
Referenced by blender::ed::asset::index::init_user_data().
|
inline |
Removes the file index from disk and preexisting_file_indices (invalidating its iterators, so don't call while iterating).
Definition at line 393 of file asset_indexer.cc.
References BLI_delete().
Referenced by remove_broken_index_files(), and remove_unused_index_files().
|
inline |
Definition at line 320 of file asset_indexer.cc.
|
inline |
Definition at line 315 of file asset_indexer.cc.
References blender::get_default_hash().
Referenced by init_indices_base_path().
|
inline |
{indices_base_path}/{asset-file_hash}_{asset-file-filename}.index.json.
Definition at line 349 of file asset_indexer.cc.
References blender::ed::asset::index::BlendFile::get_filename(), and blender::ed::asset::index::BlendFile::hash().
|
inline |
Initializes #AssetLibraryIndex.indices_base_path.
BKE_appdir_folder_caches/asset-library-indices/<asset-library-name-hash>/
Definition at line 330 of file asset_indexer.cc.
References BKE_appdir_folder_caches(), BLI_path_append(), FILE_MAX, hash(), and SEP_STR.
Referenced by AssetLibraryIndex().
|
inline |
Definition at line 380 of file asset_indexer.cc.
References blender::ed::asset::index::AssetLibraryIndex::PreexistingFileIndexInfo::is_used.
Referenced by blender::ed::asset::index::AssetIndexFile::mark_as_used().
| int blender::ed::asset::index::AssetLibraryIndex::remove_broken_index_files | ( | ) |
A bug was creating empty index files for a while (see D16665). Remove empty index files from this period, so they are regenerated.
Definition at line 600 of file asset_indexer.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), BLI_stat(), CLOG_DEBUG, blender::ed::asset::index::AssetIndexFile::constains_entries(), delete_file_index(), blender::ed::asset::index::AssetIndexFile::get_file_path(), IN_RANGE, LOG, and preexisting_file_indices.
Referenced by blender::ed::asset::index::init_user_data().
|
inline |
Definition at line 409 of file asset_indexer.cc.
References blender::Set< Key, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add(), CLOG_DEBUG, delete_file_index(), and LOG.
Referenced by blender::ed::asset::index::filelist_finished().
| std::string blender::ed::asset::index::AssetLibraryIndex::indices_base_path |
Absolute path where the indices of library are stored.
Definition at line 306 of file asset_indexer.cc.
| std::string blender::ed::asset::index::AssetLibraryIndex::library_path |
Definition at line 308 of file asset_indexer.cc.
Referenced by AssetLibraryIndex().
| Map<std::string , PreexistingFileIndexInfo> blender::ed::asset::index::AssetLibraryIndex::preexisting_file_indices |
File indices that are existing already before reading/updating performs changes. The key is the absolute path. The value can store information like if the index is known to be used.
Note that when deleting a file index (#delete_index_file()), it's also removed from here, since it doesn't exist and isn't relevant to keep track of anymore.
Definition at line 299 of file asset_indexer.cc.
Referenced by remove_broken_index_files().