Blender
V4.5
source
blender
asset_system
intern
library_types
essentials_library.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2023 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
9
#include "
BKE_appdir.hh
"
10
11
#include "utils.hh"
12
13
#include "
AS_essentials_library.hh
"
14
#include "
essentials_library.hh
"
15
16
namespace
blender::asset_system
{
17
18
EssentialsAssetLibrary::EssentialsAssetLibrary
()
19
:
OnDiskAssetLibrary
(
ASSET_LIBRARY_ESSENTIALS
,
20
{},
21
utils::normalize_directory_path
(
essentials_directory_path
()))
22
{
23
import_method_ =
ASSET_IMPORT_APPEND_REUSE
;
24
}
25
26
std::optional<AssetLibraryReference>
EssentialsAssetLibrary::library_reference
()
const
27
{
28
AssetLibraryReference
library_ref{};
29
library_ref.
custom_library_index
= -1;
30
library_ref.type =
ASSET_LIBRARY_ESSENTIALS
;
31
return
library_ref;
32
}
33
34
StringRefNull
essentials_directory_path
()
35
{
36
static
std::string path = []() {
37
const
std::optional<std::string> datafiles_path =
BKE_appdir_folder_id
(
38
BLENDER_SYSTEM_DATAFILES
,
"assets"
);
39
return
datafiles_path.value_or(
""
);
40
}();
41
return
path;
42
}
43
44
}
// namespace blender::asset_system
AS_essentials_library.hh
BKE_appdir.hh
BLENDER_SYSTEM_DATAFILES
@ BLENDER_SYSTEM_DATAFILES
Definition
BKE_appdir.hh:167
BKE_appdir_folder_id
std::optional< std::string > BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
Definition
appdir.cc:717
ASSET_IMPORT_APPEND_REUSE
@ ASSET_IMPORT_APPEND_REUSE
Definition
DNA_asset_types.h:120
ASSET_LIBRARY_ESSENTIALS
@ ASSET_LIBRARY_ESSENTIALS
Definition
DNA_asset_types.h:102
blender::StringRefNull
Definition
BLI_string_ref.hh:132
blender::asset_system::EssentialsAssetLibrary::EssentialsAssetLibrary
EssentialsAssetLibrary()
Definition
essentials_library.cc:18
blender::asset_system::EssentialsAssetLibrary::library_reference
std::optional< AssetLibraryReference > library_reference() const override
Definition
essentials_library.cc:26
blender::asset_system::OnDiskAssetLibrary
Definition
on_disk_library.hh:15
essentials_library.hh
blender::asset_system::utils::normalize_directory_path
std::string normalize_directory_path(StringRef directory)
Definition
asset_system/intern/utils.cc:17
blender::asset_system
Definition
AS_asset_catalog.hh:24
blender::asset_system::essentials_directory_path
StringRefNull essentials_directory_path()
Definition
essentials_library.cc:34
AssetLibraryReference
Definition
DNA_asset_types.h:141
AssetLibraryReference::custom_library_index
int custom_library_index
Definition
DNA_asset_types.h:149
Generated on Fri Apr 3 2026 06:33:18 for Blender by
doxygen
1.11.0