31#define U BLI_STATIC_ASSERT(false, "Global 'U' not allowed, only use arguments passed in!")
42 if (!cfgdir.has_value()) {
94 sizeof(library->
name));
121 if (asset_lib_pref->dirpath[0] &&
BLI_path_contains(asset_lib_pref->dirpath, path)) {
122 return asset_lib_pref;
148 library->
dirpath,
sizeof(library->
dirpath), documents_path,
N_(
"Blender"),
N_(
"Assets"));
162 const size_t dst_len_max = dst_maxncpy - 1;
164 size_t i_src = 0, i_dst = 0;
165 while (src[i_src] && (i_dst < dst_len_max)) {
166 const char c = src[i_src++];
167 const bool is_alpha = (c >=
'a' && c <=
'z') || (c >=
'A' && c <=
'Z');
169 if (i_dst == 0 && !is_alpha) {
172 const bool is_num = (is_alpha ==
false) && ((c >=
'0' && c <=
'9') || c ==
'_');
173 if (!(is_alpha || is_num)) {
185 const char *custom_dirpath)
204 if (repo == repo_iter) {
224 userdef,
"extensions.blender.org",
"blender_org",
"");
236 userdef,
"User Default",
"user_default",
"");
260 name =
"User Repository";
294 if (module_len == 0) {
310 const int dirpath_maxncpy)
316 std::optional<std::string> path = std::nullopt;
318 uint8_t source = repo->
source;
344 const int dirpath_maxncpy)
349 return BLI_path_join(dirpath, dirpath_maxncpy, path.value().c_str(),
".user", repo->
module);
369 if (ch >= 32 && ch <= 44) {
373 if (ch >= 58 && ch <= 64) {
376 if (
ELEM(ch,
'/',
'\\')) {
383 const UserDef *userdef,
const char *remote_url_full,
const bool only_enabled)
385 const int path_full_len = strlen(remote_url_full);
397 if (repo->remote_url[0] ==
'\0') {
402 const char *path_repo = repo->remote_url;
403 const char *path_test = remote_url_full;
404 int path_test_len = path_full_len;
408 if (path_full_offset) {
410 if (path_repo_offset) {
411 path_repo += path_repo_offset;
412 path_test += path_full_offset;
413 path_test_len -= path_full_offset;
418 int path_repo_len = strlen(path_repo);
419 while (path_repo_len &&
ELEM(path_repo[path_repo_len - 1],
'/',
'\\')) {
423 if (path_test_len <= path_repo_len) {
426 if (memcmp(path_repo, path_test, path_repo_len) != 0) {
443 const char *scheme_check[] = {
449 const char *scheme = scheme_check[
i];
450 int scheme_len = strlen(scheme);
451 if (strncmp(url, scheme, scheme_len) == 0) {
452 return scheme_len - 3;
462 const bool is_win32 =
true;
464 const bool is_win32 =
false;
466 const bool is_file =
STRPREFIX(remote_url,
"file://");
470 remote_url += (offset + 3);
476 if (remote_url[0] ==
'/' && isalpha(remote_url[1]) && (remote_url[2] ==
':')) {
488 if (
UNLIKELY(remote_url[0] ==
'\0')) {
492 const char *c = remote_url;
555 const char *shelf_idname)
565 const char *shelf_idname)
576 const char *shelf_idname)
585 const char *shelf_idname,
586 const char *catalog_path)
597 const char *shelf_idname,
598 const char *catalog_path)
601 userdef, shelf_idname, catalog_path))
std::optional< std::string > BKE_appdir_folder_id_user_notest(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
#define BLENDER_USERPREF_FILE
bool BKE_appdir_folder_documents(char *dir) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
std::optional< std::string > BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
@ BLENDER_USER_EXTENSIONS
@ BLENDER_SYSTEM_EXTENSIONS
bool BKE_asset_catalog_path_list_has_path(const ListBase &catalog_path_list, const char *catalog_path)
void BKE_asset_catalog_path_list_add_path(ListBase &catalog_path_list, const char *catalog_path)
#define BKE_PREFS_ASSET_LIBRARY_DEFAULT_NAME
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
bool BLI_path_parent_dir(char *path) ATTR_NONNULL(1)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void BLI_path_slash_native(char *path) ATTR_NONNULL(1)
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
bool BLI_path_contains(const char *container_path, const char *containee_path) ATTR_NONNULL(1
#define BLI_path_join(...)
void BLI_path_slash_rstrip(char *path) ATTR_NONNULL(1)
int bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void BLO_write_string(BlendWriter *writer, const char *data_ptr)
@ ASSET_IMPORT_APPEND_REUSE
#define DNA_struct_default_alloc(struct_name)
@ USER_EXTENSION_REPO_SOURCE_SYSTEM
@ USER_EXTENSION_REPO_SOURCE_USER
@ USER_EXTENSION_REPO_FLAG_DISABLED
@ USER_EXTENSION_REPO_FLAG_USE_CUSTOM_DIRECTORY
@ USER_EXTENSION_REPO_FLAG_SYNC_ON_STARTUP
@ USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL
void BKE_preferences_extension_remote_to_name(const char *remote_url, char name[sizeof(bUserExtensionRepo::name)])
bUserExtensionRepo * BKE_preferences_extension_repo_find_by_remote_url_prefix(const UserDef *userdef, const char *remote_url_full, const bool only_enabled)
bool BKE_preferences_extension_repo_module_is_valid(const bUserExtensionRepo *repo)
bUserAssetLibrary * BKE_preferences_asset_library_find_by_name(const UserDef *userdef, const char *name)
bUserExtensionRepo * BKE_preferences_extension_repo_find_by_module(const UserDef *userdef, const char *module)
void BKE_preferences_asset_library_default_add(UserDef *userdef)
size_t BKE_preferences_extension_repo_user_dirpath_get(const bUserExtensionRepo *repo, char *dirpath, const int dirpath_maxncpy)
void BKE_preferences_extension_repo_write_data(BlendWriter *writer, const bUserExtensionRepo *repo)
void BKE_preferences_extension_repo_module_set(UserDef *userdef, bUserExtensionRepo *repo, const char *module)
static size_t strncpy_py_module(char *dst, const char *src, const size_t dst_maxncpy)
int BKE_preferences_extension_repo_remote_scheme_end(const char *url)
bool BKE_preferences_asset_shelf_settings_is_catalog_path_enabled(const UserDef *userdef, const char *shelf_idname, const char *catalog_path)
void BKE_preferences_asset_library_path_set(bUserAssetLibrary *library, const char *path)
bUserAssetLibrary * BKE_preferences_asset_library_find_index(const UserDef *userdef, int index)
bUserExtensionRepo * BKE_preferences_extension_repo_add(UserDef *userdef, const char *name, const char *module, const char *custom_dirpath)
bUserExtensionRepo * BKE_preferences_extension_repo_find_index(const UserDef *userdef, int index)
size_t BKE_preferences_extension_repo_dirpath_get(const bUserExtensionRepo *repo, char *dirpath, const int dirpath_maxncpy)
static bool url_char_is_delimiter(const char ch)
bUserAssetShelfSettings * BKE_preferences_asset_shelf_settings_get(const UserDef *userdef, const char *shelf_idname)
int BKE_preferences_extension_repo_get_index(const UserDef *userdef, const bUserExtensionRepo *repo)
void BKE_preferences_extension_repo_remove(UserDef *userdef, bUserExtensionRepo *repo)
int BKE_preferences_asset_library_get_index(const UserDef *userdef, const bUserAssetLibrary *library)
void BKE_preferences_extension_repo_add_defaults_all(UserDef *userdef)
bUserAssetLibrary * BKE_preferences_asset_library_containing_path(const UserDef *userdef, const char *path)
bUserExtensionRepo * BKE_preferences_extension_repo_add_default_user(UserDef *userdef)
bUserAssetLibrary * BKE_preferences_asset_library_add(UserDef *userdef, const char *name, const char *dirpath)
bUserExtensionRepo * BKE_preferences_extension_repo_add_default_system(UserDef *userdef)
void BKE_preferences_extension_repo_read_data(BlendDataReader *reader, bUserExtensionRepo *repo)
void BKE_preferences_asset_library_name_set(UserDef *userdef, bUserAssetLibrary *library, const char *name)
void BKE_preferences_extension_repo_name_set(UserDef *userdef, bUserExtensionRepo *repo, const char *name)
bUserExtensionRepo * BKE_preferences_extension_repo_add_default_remote(UserDef *userdef)
void BKE_preferences_asset_library_remove(UserDef *userdef, bUserAssetLibrary *library)
bool BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(UserDef *userdef, const char *shelf_idname, const char *catalog_path)
static bUserAssetShelfSettings * asset_shelf_settings_ensure(UserDef *userdef, const char *shelf_idname)
static bUserAssetShelfSettings * asset_shelf_settings_new(UserDef *userdef, const char *shelf_idname)
void BKE_preferences_extension_repo_custom_dirpath_set(bUserExtensionRepo *repo, const char *path)
static struct PyModuleDef module
char no_data_block_packing
UserDef_Experimental experimental
struct ListBase asset_shelves_settings
struct ListBase extension_repos
struct ListBase asset_libraries
ListBase enabled_catalog_paths
char custom_dirpath[1024]