Blender  V3.3
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | List of all members
blender::bke::AssetCatalog Class Reference

#include <BKE_asset_catalog.hh>

Classes

struct  Flags
 

Public Member Functions

 AssetCatalog ()=default
 
 AssetCatalog (CatalogID catalog_id, const AssetCatalogPath &path, const std::string &simple_name)
 
void simple_name_refresh ()
 

Static Public Member Functions

static std::unique_ptr< AssetCatalogfrom_path (const AssetCatalogPath &path)
 

Public Attributes

CatalogID catalog_id
 
AssetCatalogPath path
 
std::string simple_name
 
struct blender::bke::AssetCatalog::Flags flags
 

Static Protected Member Functions

static std::string sensible_simple_name_for_path (const AssetCatalogPath &path)
 

Detailed Description

Asset Catalog definition, containing a symbolic ID and a path that points to a node in the catalog hierarchy.

Definition at line 424 of file BKE_asset_catalog.hh.

Constructor & Destructor Documentation

◆ AssetCatalog() [1/2]

blender::bke::AssetCatalog::AssetCatalog ( )
default

◆ AssetCatalog() [2/2]

blender::bke::AssetCatalog::AssetCatalog ( CatalogID  catalog_id,
const AssetCatalogPath path,
const std::string &  simple_name 
)

Definition at line 1048 of file blenkernel/intern/asset_catalog.cc.

Member Function Documentation

◆ from_path()

std::unique_ptr< AssetCatalog > blender::bke::AssetCatalog::from_path ( const AssetCatalogPath path)
static

Create a new Catalog with the given path, auto-generating a sensible catalog simple-name.

NOTE: the given path will be cleaned up (trailing spaces removed, etc.), so the returned AssetCatalog's path differ from the given one.

Definition at line 1055 of file blenkernel/intern/asset_catalog.cc.

References BLI_uuid_generate_random(), blender::bke::AssetCatalogPath::cleanup(), path, sensible_simple_name_for_path(), and simple_name.

Referenced by blender::bke::AssetCatalogService::create_catalog(), and blender::bke::tests::TEST_F().

◆ sensible_simple_name_for_path()

std::string blender::bke::AssetCatalog::sensible_simple_name_for_path ( const AssetCatalogPath path)
staticprotected

Generate a sensible catalog ID for the given path.

Definition at line 1069 of file blenkernel/intern/asset_catalog.cc.

References MAX_NAME, path, blender::bke::AssetCatalogPath::SEPARATOR, and blender::bke::AssetCatalogPath::str().

Referenced by from_path(), and simple_name_refresh().

◆ simple_name_refresh()

void blender::bke::AssetCatalog::simple_name_refresh ( )

Make a new simple name for the catalog, based on its path.

Definition at line 1064 of file blenkernel/intern/asset_catalog.cc.

References path, sensible_simple_name_for_path(), and simple_name.

Referenced by blender::bke::AssetCatalogService::update_catalog_path().

Member Data Documentation

◆ catalog_id

CatalogID blender::bke::AssetCatalog::catalog_id

◆ flags

struct blender::bke::AssetCatalog::Flags blender::bke::AssetCatalog::flags

◆ path

AssetCatalogPath blender::bke::AssetCatalog::path

◆ simple_name

std::string blender::bke::AssetCatalog::simple_name

Simple, human-readable name for the asset catalog. This is stored on assets alongside the catalog ID; the catalog ID is a UUID that is not human-readable, so to avoid complete data-loss when the catalog definition file gets lost, we also store a human-readable simple name for the catalog.

It should fit in sizeof(AssetMetaData::catalog_simple_name) bytes.

Definition at line 438 of file BKE_asset_catalog.hh.

Referenced by from_path(), blender::bke::AssetCatalogTree::insert_item(), blender::bke::AssetLibrary::refresh_catalog_simplename(), simple_name_refresh(), and blender::bke::tests::TEST_F().


The documentation for this class was generated from the following files: