Blender V5.3
BKE_preferences.h
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#pragma once
10
11#include <optional>
12
13#include "BLI_compiler_attrs.hh"
14#include "BLI_sys_types.hh"
15#include "BLI_uuid.hh"
16
17namespace blender {
18
19struct BlendWriter;
20struct UserDef;
24class StringRef;
25struct EnumPropertyItem;
26
27/* -------------------------------------------------------------------- */
30
32
36bool exists();
37
38} // namespace bke::preferences
39
41
42/* -------------------------------------------------------------------- */
45
47#define BKE_PREFS_ASSET_LIBRARY_DEFAULT_NAME N_("User Library")
48
52struct bUserAssetLibrary *BKE_preferences_asset_library_add(struct UserDef *userdef,
53 const char *name,
54 const char *dirpath) ATTR_NONNULL(1);
55struct bUserAssetLibrary *BKE_preferences_project_asset_library_add(
56 struct UserDef *userdef,
57 const char *name,
58 const char *dirpath,
59 std::optional<UUID> uuid = std::nullopt) ATTR_NONNULL(1);
60struct bUserAssetLibrary *BKE_preferences_remote_asset_library_add(struct UserDef *userdef,
61 const char *name,
62 const char *remote_url,
63 const char *auth_token)
64 ATTR_NONNULL(1, 3);
65bUserAssetLibrary *BKE_preferences_project_remote_asset_library_add(UserDef *userdef,
66 const char *name,
67 const char *remote_url,
68 const char *auth_token)
69 ATTR_NONNULL(1, 3);
70
73 User = 0,
74 Project = 1,
75 Extension = 2,
76};
77
79 const struct bUserAssetLibrary *library) ATTR_NONNULL();
80
86 const struct UserDef *userdef, const struct bUserAssetLibrary *library) ATTR_NONNULL();
87
100 StringRef remote_url);
101
109 StringRef auth_token);
110
117
120 const char *name) ATTR_NONNULL();
121
129 ATTR_NONNULL();
130
132 int index)
135 const char *name)
137
148 const struct UserDef *userdef, const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
149
151 const struct bUserAssetLibrary *library)
153
162 const struct bUserAssetLibrary *library)
164
171 const struct bUserAssetLibrary *library,
172 const bool check_directory_exists) ATTR_NONNULL();
173
175
177 struct bUserAssetLibrary *library);
178
180 const struct bUserAssetLibrary *library);
181
183
184/* -------------------------------------------------------------------- */
187
189 const char *name,
190 const char *module,
191 const char *custom_dirpath);
198
200 bUserExtensionRepo *repo,
201 const char *name);
203 bUserExtensionRepo *repo,
204 const char *module);
205
208 char *dirpath,
209 int dirpath_maxncpy);
210
216 char *dirpath,
217 const int dirpath_maxncpy);
218
225
228 const char *module);
233 const UserDef *userdef, const char *remote_url_full, const bool only_enabled);
235 const bUserExtensionRepo *repo);
236
238 bUserExtensionRepo *repo);
240 const bUserExtensionRepo *repo);
241
243
244/* -------------------------------------------------------------------- */
249
253int BKE_preferences_remote_scheme_end(const char *url);
257void BKE_preferences_remote_to_name(const char *remote_url, char name[64 /*MAX_NAME*/]);
258
260
261/* -------------------------------------------------------------------- */
264
266 const char *shelf_idname);
268 const char *shelf_idname,
269 const char *catalog_path);
276 const char *shelf_idname,
277 const char *catalog_path);
285 const char *shelf_idname,
286 const char *catalog_path);
287
288const EnumPropertyItem *BKE_preferences_active_section_itemf(const UserDef *userdef, bool *r_free);
290
291} // namespace blender
#define ATTR_NONNULL(...)
BMesh Iterators.
bUserExtensionRepo * BKE_preferences_extension_repo_add_default_system(UserDef *userdef)
bool BKE_preferences_extension_repo_module_is_valid(const bUserExtensionRepo *repo)
size_t BKE_preferences_extension_repo_user_dirpath_get(const bUserExtensionRepo *repo, char *dirpath, const int dirpath_maxncpy)
void BKE_preferences_asset_library_default_add(struct UserDef *userdef) ATTR_NONNULL()
bUserExtensionRepo * BKE_preferences_extension_repo_find_by_remote_url_prefix(const UserDef *userdef, const char *remote_url_full, const bool only_enabled)
int BKE_preferences_asset_library_get_index(const struct UserDef *userdef, const struct bUserAssetLibrary *library) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
void BKE_preferences_extension_repo_custom_dirpath_set(bUserExtensionRepo *repo, const char *path)
const EnumPropertyItem * BKE_preferences_active_section_itemf(const UserDef *userdef, bool *r_free)
void BKE_preferences_extension_repo_module_set(UserDef *userdef, bUserExtensionRepo *repo, const char *module)
int BKE_preferences_extension_repo_get_index(const UserDef *userdef, const bUserExtensionRepo *repo)
struct bUserAssetLibrary * BKE_preferences_asset_library_add(struct UserDef *userdef, const char *name, const char *dirpath) ATTR_NONNULL(1)
int BKE_preferences_remote_scheme_end(const char *url)
bUserExtensionRepo * BKE_preferences_extension_repo_add_default_user(UserDef *userdef)
struct bUserAssetLibrary * BKE_preferences_remote_asset_library_add(struct UserDef *userdef, const char *name, const char *remote_url, const char *auth_token) ATTR_NONNULL(1
void BKE_preferences_asset_library_remove(struct UserDef *userdef, struct bUserAssetLibrary *library) ATTR_NONNULL()
void BKE_preferences_extension_repo_name_set(UserDef *userdef, bUserExtensionRepo *repo, const char *name)
struct bUserAssetLibrary * BKE_preferences_asset_library_find_index(const struct UserDef *userdef, int index) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
void BKE_preferences_extension_repo_read_data(struct BlendDataReader *reader, bUserExtensionRepo *repo)
bool BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(UserDef *userdef, const char *shelf_idname, const char *catalog_path)
bool BKE_preferences_asset_library_is_valid(const UserDef *userdef, const struct bUserAssetLibrary *library, const bool check_directory_exists) ATTR_NONNULL()
bUserExtensionRepo * BKE_preferences_extension_repo_find_by_module(const UserDef *userdef, const char *module)
void BKE_preferences_extension_repo_write_data(struct BlendWriter *writer, const bUserExtensionRepo *repo)
bUserAssetShelfSettings * BKE_preferences_asset_shelf_settings_get(const UserDef *userdef, const char *shelf_idname)
struct bUserAssetLibrary * BKE_preferences_project_asset_library_add(struct UserDef *userdef, const char *name, const char *dirpath, std::optional< UUID > uuid=std::nullopt) ATTR_NONNULL(1)
void BKE_preferences_remote_to_name(const char *remote_url, char name[64])
void BKE_preferences_asset_library_write_data(struct BlendWriter *writer, const struct bUserAssetLibrary *library)
bUserExtensionRepo * BKE_preferences_extension_repo_add_default_remote(UserDef *userdef)
struct bUserExtensionRepo * BKE_preferences_extension_asset_library_repo_get(const struct UserDef *userdef, const struct bUserAssetLibrary *library) ATTR_NONNULL()
bUserAssetLibraryOwner BKE_preferences_asset_library_owner_get(const struct bUserAssetLibrary *library) ATTR_NONNULL()
struct bUserAssetLibrary bUserAssetLibrary * BKE_preferences_project_remote_asset_library_add(UserDef *userdef, const char *name, const char *remote_url, const char *auth_token) ATTR_NONNULL(1
void BKE_preferences_remote_asset_library_auth_token_set(bUserAssetLibrary *library, StringRef auth_token)
Update the remote URL authentication token.
struct bUserAssetLibrary * BKE_preferences_asset_library_find_by_name(const struct UserDef *userdef, const char *name) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
bUserExtensionRepo * BKE_preferences_extension_repo_find_index(const UserDef *userdef, int index)
bool BKE_preferences_asset_shelf_settings_disable_catalog_path(UserDef *userdef, const char *shelf_idname, const char *catalog_path)
void BKE_preferences_extension_repo_remove(UserDef *userdef, bUserExtensionRepo *repo)
void BKE_preferences_extension_repo_add_defaults_all(UserDef *userdef)
bool BKE_preferences_asset_library_is_available(const struct UserDef *userdef, const struct bUserAssetLibrary *library) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
void BKE_preferences_asset_library_name_set(struct UserDef *userdef, struct bUserAssetLibrary *library, const char *name) ATTR_NONNULL()
void BKE_preferences_remote_asset_library_url_set(bUserAssetLibrary *library, StringRef remote_url)
Update the remote URL and the cache directory derived from the URL.
bUserExtensionRepo * BKE_preferences_extension_repo_add(UserDef *userdef, const char *name, const char *module, const char *custom_dirpath)
void BKE_preferences_asset_library_path_set(struct bUserAssetLibrary *library, const char *path) ATTR_NONNULL()
bool ATTR_WARN_UNUSED_RESULT
bool BKE_preferences_asset_shelf_settings_is_catalog_path_enabled(const UserDef *userdef, const char *shelf_idname, const char *catalog_path)
void ATTR_NONNULL(1, 2)
void BKE_preferences_asset_library_read_data(struct BlendDataReader *reader, struct bUserAssetLibrary *library)
struct bUserAssetLibrary * BKE_preferences_asset_library_containing_path(const struct UserDef *userdef, const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
size_t BKE_preferences_extension_repo_dirpath_get(const bUserExtensionRepo *repo, char *dirpath, int dirpath_maxncpy)