Blender V5.0
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
8
9#include "BKE_appdir.hh"
10
11#include "utils.hh"
12
13#include "DNA_userdef_types.h"
14
16#include "essentials_library.hh"
17
18namespace blender::asset_system {
19
22 {},
24{
25 import_method_ = ASSET_IMPORT_PACK;
26 if (U.experimental.no_data_block_packing) {
27 import_method_ = ASSET_IMPORT_APPEND_REUSE;
28 }
29}
30
31std::optional<AssetLibraryReference> EssentialsAssetLibrary::library_reference() const
32{
33 AssetLibraryReference library_ref{};
34 library_ref.custom_library_index = -1;
35 library_ref.type = ASSET_LIBRARY_ESSENTIALS;
36 return library_ref;
37}
38
46
48{
49 static std::string path = []() {
50 const std::optional<std::string> datafiles_path = BKE_appdir_folder_id(
51 BLENDER_SYSTEM_DATAFILES, "assets");
52 return datafiles_path.value_or("");
53 }();
54 return path;
55}
56
57} // namespace blender::asset_system
std::optional< std::string > BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
Definition appdir.cc:721
@ BLENDER_SYSTEM_DATAFILES
@ ASSET_IMPORT_PACK
@ ASSET_IMPORT_APPEND_REUSE
@ ASSET_LIBRARY_ESSENTIALS
#define U
std::optional< eAssetImportMethod > import_method_
std::optional< AssetLibraryReference > library_reference() const override
OnDiskAssetLibrary(eAssetLibraryType library_type, StringRef name="", StringRef root_path="")
std::string normalize_directory_path(StringRef directory)
StringRefNull essentials_directory_path()