Blender  V3.3
Classes | Namespaces | Functions | Variables
asset_indexer.cc File Reference
#include <fstream>
#include <iomanip>
#include <optional>
#include "ED_asset_indexer.h"
#include "DNA_asset_types.h"
#include "DNA_userdef_types.h"
#include "BLI_fileops.h"
#include "BLI_hash.hh"
#include "BLI_linklist.h"
#include "BLI_path_util.h"
#include "BLI_serialize.hh"
#include "BLI_set.hh"
#include "BLI_string_ref.hh"
#include "BLI_uuid.h"
#include "BKE_appdir.h"
#include "BKE_asset.h"
#include "BKE_asset_catalog.hh"
#include "BKE_idprop.hh"
#include "BKE_preferences.h"
#include "CLG_log.h"

Go to the source code of this file.

Classes

class  blender::ed::asset::index::AbstractFile
 
class  blender::ed::asset::index::BlendFile
 Reference to a blend file that can be indexed. More...
 
struct  blender::ed::asset::index::AssetEntryReader
 Single entry inside a #AssetIndexFile for reading. More...
 
struct  blender::ed::asset::index::AssetEntryWriter
 
struct  blender::ed::asset::index::AssetLibraryIndex
 References the asset library directory. More...
 
struct  blender::ed::asset::index::AssetIndex
 
class  blender::ed::asset::index::AssetIndexFile
 

Namespaces

 blender
 
 blender::ed
 
 blender::ed::asset
 
 blender::ed::asset::index
 

Functions

constexpr StringRef blender::ed::asset::index::ATTRIBUTE_VERSION ("version")
 Indexer for asset libraries. More...
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES ("entries")
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES_NAME ("name")
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES_CATALOG_ID ("catalog_id")
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES_CATALOG_NAME ("catalog_name")
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES_DESCRIPTION ("description")
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES_AUTHOR ("author")
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES_TAGS ("tags")
 
constexpr StringRef blender::ed::asset::index::ATTRIBUTE_ENTRIES_PROPERTIES ("properties")
 
static void blender::ed::asset::index::init_value_from_file_indexer_entry (AssetEntryWriter &result, const FileIndexerEntry *indexer_entry)
 
static void blender::ed::asset::index::init_value_from_file_indexer_entries (DictionaryValue &result, const FileIndexerEntries &indexer_entries)
 
static void blender::ed::asset::index::init_indexer_entry_from_value (FileIndexerEntry &indexer_entry, const AssetEntryReader &entry)
 
static int blender::ed::asset::index::init_indexer_entries_from_value (FileIndexerEntries &indexer_entries, const DictionaryValue &value)
 
static eFileIndexerResult blender::ed::asset::index::read_index (const char *filename, FileIndexerEntries *entries, int *r_read_entries_len, void *user_data)
 
static void blender::ed::asset::index::update_index (const char *filename, FileIndexerEntries *entries, void *user_data)
 
static voidblender::ed::asset::index::init_user_data (const char *root_directory, size_t root_directory_maxlen)
 
static void blender::ed::asset::index::free_user_data (void *user_data)
 
static void blender::ed::asset::index::filelist_finished (void *user_data)
 
constexpr FileIndexerType blender::ed::asset::index::asset_indexer ()
 

Variables

static CLG_LogRef LOG = {"ed.asset"}
 
const FileIndexerType file_indexer_asset = blender::ed::asset::index::asset_indexer()
 

Variable Documentation

◆ file_indexer_asset

File Indexer Service for indexing asset files.

Opening and parsing a large collection of asset files inside a library can take a lot of time. To reduce the time it takes the files are indexed.

  • Index files are created for each blend file in the asset library, even when the blend file doesn't contain any assets.
  • Indexes are stored in an persistent cache folder (BKE_appdir_folder_caches + asset_library_indexes/{asset_library_dir}/{asset_index_file.json}).
  • The content of the indexes are used when:
    • Index exists and can be opened
    • Last modification date is earlier than the file it represents.
    • The index file version is the latest.
  • Blend files without any assets can be determined by the size of the index file for some additional performance.

Definition at line 796 of file asset_indexer.cc.

Referenced by file_refresh(), and blender::ed::asset::AssetList::setup().

◆ LOG

CLG_LogRef LOG = {"ed.asset"}
static