Files
test/source/blender/asset_system/intern/asset_storage.hh
Campbell Barton e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00

56 lines
1.8 KiB
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup asset_system
*
* The database implementation for asset representations within a library. Not part of the public
* API, storage access happens via the #AssetLibrary API.
*/
#pragma once
#include <memory>
#include "BLI_set.hh"
struct AssetMetaData;
struct ID;
struct IDRemapper;
namespace blender::asset_system {
class AssetIdentifier;
class AssetRepresentation;
class AssetStorage {
using StorageT = Set<std::unique_ptr<AssetRepresentation>>;
StorageT external_assets_;
/* Store local ID assets separately for efficient lookups.
* TODO(Julian): A [ID *, asset] or even [ID.session_uuid, asset] map would be preferable for
* faster lookups. Not possible until each asset is only represented once in the storage. */
StorageT local_id_assets_;
public:
/** See #AssetLibrary::add_external_asset(). */
AssetRepresentation &add_external_asset(AssetIdentifier &&identifier,
StringRef name,
int id_type,
std::unique_ptr<AssetMetaData> metadata,
const AssetLibrary &owner_asset_library);
/** See #AssetLibrary::add_external_asset(). */
AssetRepresentation &add_local_id_asset(AssetIdentifier &&identifier,
ID &id,
const AssetLibrary &owner_asset_library);
/** See #AssetLibrary::remove_asset(). */
bool remove_asset(AssetRepresentation &asset);
/** See #AssetLibrary::remap_ids_and_remove_nulled(). */
void remap_ids_and_remove_invalid(const IDRemapper &mappings);
};
} // namespace blender::asset_system