|
Blender V5.0
|
#include <cstring>#include "BLI_fileops.h"#include "BLI_listbase.h"#include "BLI_path_utils.hh"#include "BLI_string.h"#include "BLI_string_utf8.h"#include "BLI_string_utils.hh"#include "BKE_appdir.hh"#include "BKE_asset.hh"#include "BKE_preferences.h"#include "BLT_translation.hh"#include "BLO_read_write.hh"#include "DNA_defaults.h"#include "DNA_userdef_types.h"Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
| namespace | blender::bke::preferences |
Macros | |
| #define | U BLI_STATIC_ASSERT(false, "Global 'U' not allowed, only use arguments passed in!") |
User defined asset library API.
Definition in file preferences.cc.
| #define U BLI_STATIC_ASSERT(false, "Global 'U' not allowed, only use arguments passed in!") |
Definition at line 31 of file preferences.cc.
|
static |
Definition at line 564 of file preferences.cc.
References asset_shelf_settings_new(), and BKE_preferences_asset_shelf_settings_get().
Referenced by BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled().
|
static |
Definition at line 554 of file preferences.cc.
References UserDef::asset_shelves_settings, BLI_addtail(), BLI_assert, BLI_listbase_is_empty(), DNA_struct_default_alloc, bUserAssetShelfSettings::enabled_catalog_paths, bUserAssetShelfSettings::shelf_idname, and STRNCPY().
Referenced by asset_shelf_settings_ensure().
| bUserAssetLibrary * BKE_preferences_asset_library_add | ( | UserDef * | userdef, |
| const char * | name, | ||
| const char * | dirpath ) |
Definition at line 59 of file preferences.cc.
References ASSET_IMPORT_APPEND_REUSE, UserDef::asset_libraries, BKE_preferences_asset_library_name_set(), BLI_addtail(), bUserAssetLibrary::dirpath, DNA_struct_default_alloc, UserDef::experimental, bUserAssetLibrary::import_method, name, UserDef_Experimental::no_data_block_packing, and STRNCPY().
Referenced by BKE_preferences_asset_library_default_add(), preferences_asset_library_add_exec(), and blender::asset_system::tests::AssetCatalogTest::save_from_memory_into_existing_asset_lib().
| bUserAssetLibrary * BKE_preferences_asset_library_containing_path | ( | const UserDef * | userdef, |
| const char * | path ) |
Definition at line 117 of file preferences.cc.
References UserDef::asset_libraries, BLI_path_contains(), and LISTBASE_FOREACH.
| void BKE_preferences_asset_library_default_add | ( | UserDef * | userdef | ) |
Definition at line 134 of file preferences.cc.
References BKE_appdir_folder_documents(), BKE_preferences_asset_library_add(), BKE_PREFS_ASSET_LIBRARY_DEFAULT_NAME, BLI_path_join, DATA_, bUserAssetLibrary::dirpath, FILE_MAXDIR, and N_.
Referenced by BKE_blendfile_userdef_from_defaults(), BKE_preferences_asset_library_get_index(), and blo_do_versions_userdef().
| bUserAssetLibrary * BKE_preferences_asset_library_find_by_name | ( | const UserDef * | userdef, |
| const char * | name ) |
Definition at line 110 of file preferences.cc.
References UserDef::asset_libraries, BLI_findstring(), name, and offsetof.
| bUserAssetLibrary * BKE_preferences_asset_library_find_index | ( | const UserDef * | userdef, |
| int | index ) |
Definition at line 105 of file preferences.cc.
References UserDef::asset_libraries, and BLI_findlink().
| int BKE_preferences_asset_library_get_index | ( | const UserDef * | userdef, |
| const bUserAssetLibrary * | library ) |
Definition at line 128 of file preferences.cc.
References UserDef::asset_libraries, and BLI_findindex().
| void BKE_preferences_asset_library_name_set | ( | UserDef * | userdef, |
| bUserAssetLibrary * | library, | ||
| const char * | name ) |
Definition at line 84 of file preferences.cc.
References UserDef::asset_libraries, BLI_uniquename(), bUserAssetLibrary::name, name, offsetof, and STRNCPY_UTF8.
Referenced by BKE_preferences_asset_library_add(), and blo_do_versions_userdef().
| void BKE_preferences_asset_library_path_set | ( | struct bUserAssetLibrary * | library, |
| const char * | path ) |
Set the library path, ensuring it is pointing to a directory. Single blend files can only act as "Current File" library; libraries on disk should always be directories. If the path does not exist, that's fine; it can created as directory if necessary later.
Definition at line 97 of file preferences.cc.
References BLI_is_file(), BLI_path_parent_dir(), bUserAssetLibrary::dirpath, and STRNCPY().
| void BKE_preferences_asset_library_remove | ( | struct UserDef * | userdef, |
| struct bUserAssetLibrary * | library ) |
Unlink and free a library preference member.
Definition at line 79 of file preferences.cc.
References UserDef::asset_libraries, and BLI_freelinkN().
Referenced by preferences_asset_library_remove_exec(), and blender::asset_system::tests::AssetCatalogTest::save_from_memory_into_existing_asset_lib().
| bool BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled | ( | UserDef * | userdef, |
| const char * | shelf_idname, | ||
| const char * | catalog_path ) |
Enable a catalog path for a asset shelf identified by shelf_idname. Will create the shelf settings in the Preferences if necessary.
Definition at line 596 of file preferences.cc.
References asset_shelf_settings_ensure(), BKE_asset_catalog_path_list_add_path(), BKE_preferences_asset_shelf_settings_is_catalog_path_enabled(), and bUserAssetShelfSettings::enabled_catalog_paths.
Referenced by BKE_blendfile_userdef_from_defaults(), BKE_preferences_extension_remote_to_name(), blo_do_versions_userdef(), and blender::ed::asset::shelf::settings_set_catalog_path_enabled().
| bUserAssetShelfSettings * BKE_preferences_asset_shelf_settings_get | ( | const UserDef * | userdef, |
| const char * | shelf_idname ) |
Definition at line 575 of file preferences.cc.
References UserDef::asset_shelves_settings, BLI_findstring(), and offsetof.
Referenced by asset_shelf_settings_ensure(), BKE_preferences_asset_shelf_settings_is_catalog_path_enabled(), BKE_preferences_extension_remote_to_name(), and blender::ed::asset::shelf::get_enabled_catalog_path_list().
| bool BKE_preferences_asset_shelf_settings_is_catalog_path_enabled | ( | const UserDef * | userdef, |
| const char * | shelf_idname, | ||
| const char * | catalog_path ) |
Definition at line 584 of file preferences.cc.
References BKE_asset_catalog_path_list_has_path(), BKE_preferences_asset_shelf_settings_get(), and bUserAssetShelfSettings::enabled_catalog_paths.
Referenced by BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(), and BKE_preferences_extension_remote_to_name().
| void BKE_preferences_extension_remote_to_name | ( | const char * | remote_url, |
| char | name[sizeof(bUserExtensionRepo::name)] ) |
Definition at line 458 of file preferences.cc.
References BKE_preferences_extension_repo_remote_scheme_end(), BLI_path_basename(), BLI_path_slash_native(), BLI_str_startswith(), BLI_strncpy_utf8(), bUserExtensionRepo::name, name, STRPREFIX, UNLIKELY, and url_char_is_delimiter().
| bUserExtensionRepo * BKE_preferences_extension_repo_add | ( | UserDef * | userdef, |
| const char * | name, | ||
| const char * | module, | ||
| const char * | custom_dirpath ) |
Definition at line 182 of file preferences.cc.
References BKE_preferences_extension_repo_module_set(), BKE_preferences_extension_repo_name_set(), BLI_addtail(), BLI_path_cmp, BLI_path_normalize(), BLI_path_slash_rstrip(), bUserExtensionRepo::custom_dirpath, DNA_struct_default_alloc, UserDef::extension_repos, LISTBASE_FOREACH, module, name, and STRNCPY().
Referenced by BKE_preferences_asset_library_get_index(), BKE_preferences_extension_repo_add_default_remote(), BKE_preferences_extension_repo_add_default_system(), BKE_preferences_extension_repo_add_default_user(), and preferences_extension_repo_add_exec().
| bUserExtensionRepo * BKE_preferences_extension_repo_add_default_remote | ( | UserDef * | userdef | ) |
Definition at line 221 of file preferences.cc.
References BKE_preferences_extension_repo_add(), bUserExtensionRepo::flag, bUserExtensionRepo::remote_url, STRNCPY(), USER_EXTENSION_REPO_FLAG_SYNC_ON_STARTUP, and USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL.
Referenced by BKE_preferences_asset_library_get_index(), BKE_preferences_extension_repo_add_defaults_all(), and blo_do_versions_userdef().
| bUserExtensionRepo * BKE_preferences_extension_repo_add_default_system | ( | UserDef * | userdef | ) |
Definition at line 240 of file preferences.cc.
References BKE_preferences_extension_repo_add(), bUserExtensionRepo::source, and USER_EXTENSION_REPO_SOURCE_SYSTEM.
Referenced by BKE_preferences_asset_library_get_index(), BKE_preferences_extension_repo_add_defaults_all(), and blo_do_versions_userdef().
| bUserExtensionRepo * BKE_preferences_extension_repo_add_default_user | ( | UserDef * | userdef | ) |
Definition at line 233 of file preferences.cc.
References BKE_preferences_extension_repo_add().
Referenced by BKE_preferences_asset_library_get_index(), BKE_preferences_extension_repo_add_defaults_all(), and blo_do_versions_userdef().
| void BKE_preferences_extension_repo_add_defaults_all | ( | UserDef * | userdef | ) |
Create all default repositories, only use when repositories are empty.
Definition at line 247 of file preferences.cc.
References BKE_preferences_extension_repo_add_default_remote(), BKE_preferences_extension_repo_add_default_system(), BKE_preferences_extension_repo_add_default_user(), BLI_assert, BLI_listbase_is_empty(), and UserDef::extension_repos.
Referenced by BKE_blendfile_userdef_from_defaults(), and BKE_preferences_asset_library_get_index().
| void BKE_preferences_extension_repo_custom_dirpath_set | ( | bUserExtensionRepo * | repo, |
| const char * | path ) |
Definition at line 303 of file preferences.cc.
References bUserExtensionRepo::custom_dirpath, and STRNCPY().
Referenced by BKE_preferences_asset_library_get_index().
| size_t BKE_preferences_extension_repo_dirpath_get | ( | const bUserExtensionRepo * | repo, |
| char * | dirpath, | ||
| const int | dirpath_maxncpy ) |
Definition at line 308 of file preferences.cc.
References BKE_appdir_folder_id(), BKE_appdir_folder_id_user_notest(), BLENDER_SYSTEM_EXTENSIONS, BLENDER_USER_EXTENSIONS, BLI_path_join, BLI_strncpy_rlen(), bUserExtensionRepo::custom_dirpath, bUserExtensionRepo::flag, bUserExtensionRepo::module, bUserExtensionRepo::source, USER_EXTENSION_REPO_FLAG_USE_CUSTOM_DIRECTORY, USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL, USER_EXTENSION_REPO_SOURCE_SYSTEM, and USER_EXTENSION_REPO_SOURCE_USER.
Referenced by BKE_preferences_asset_library_get_index(), preferences_extension_repo_remove_exec(), and preferences_extension_repo_remove_invoke().
| bUserExtensionRepo * BKE_preferences_extension_repo_find_by_module | ( | const UserDef * | userdef, |
| const char * | module ) |
Definition at line 359 of file preferences.cc.
References BLI_findstring(), UserDef::extension_repos, module, and offsetof.
Referenced by BKE_preferences_asset_library_get_index().
| bUserExtensionRepo * BKE_preferences_extension_repo_find_by_remote_url_prefix | ( | const UserDef * | userdef, |
| const char * | remote_url_full, | ||
| const bool | only_enabled ) |
Using a full URL/remote path to find a repository that shares its prefix.
Definition at line 382 of file preferences.cc.
References BKE_preferences_extension_repo_remote_scheme_end(), ELEM, UserDef::extension_repos, LISTBASE_FOREACH, url_char_is_delimiter(), USER_EXTENSION_REPO_FLAG_DISABLED, and USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL.
Referenced by BKE_preferences_asset_library_get_index(), and drop_extension_url_poll().
| bUserExtensionRepo * BKE_preferences_extension_repo_find_index | ( | const UserDef * | userdef, |
| int | index ) |
Definition at line 354 of file preferences.cc.
References BLI_findlink(), and UserDef::extension_repos.
Referenced by BKE_preferences_asset_library_get_index().
| int BKE_preferences_extension_repo_get_index | ( | const UserDef * | userdef, |
| const bUserExtensionRepo * | repo ) |
Definition at line 528 of file preferences.cc.
References BLI_findindex(), and UserDef::extension_repos.
Referenced by BKE_preferences_extension_remote_to_name().
| bool BKE_preferences_extension_repo_module_is_valid | ( | const bUserExtensionRepo * | repo | ) |
Check the module name is valid, while this should always be the case, use this as an additional safely check before performing destructive operations such as recursive file removal to prevent file/memory corruption causing user data loss.
Definition at line 288 of file preferences.cc.
References bUserExtensionRepo::module, strncpy_py_module(), and STRNLEN.
Referenced by BKE_preferences_asset_library_get_index(), and preferences_extension_repo_remove_exec().
| void BKE_preferences_extension_repo_module_set | ( | UserDef * | userdef, |
| bUserExtensionRepo * | repo, | ||
| const char * | module ) |
Definition at line 272 of file preferences.cc.
References BLI_uniquename(), UserDef::extension_repos, bUserExtensionRepo::module, module, offsetof, STRNCPY(), and strncpy_py_module().
Referenced by BKE_preferences_asset_library_get_index(), and BKE_preferences_extension_repo_add().
| void BKE_preferences_extension_repo_name_set | ( | UserDef * | userdef, |
| bUserExtensionRepo * | repo, | ||
| const char * | name ) |
Definition at line 255 of file preferences.cc.
References BLI_uniquename(), UserDef::extension_repos, bUserExtensionRepo::name, name, offsetof, and STRNCPY_UTF8.
Referenced by BKE_preferences_asset_library_get_index(), and BKE_preferences_extension_repo_add().
| void BKE_preferences_extension_repo_read_data | ( | BlendDataReader * | reader, |
| bUserExtensionRepo * | repo ) |
Definition at line 534 of file preferences.cc.
References bUserExtensionRepo::access_token, and BLO_read_string().
Referenced by BKE_preferences_extension_remote_to_name(), and read_userdef().
| int BKE_preferences_extension_repo_remote_scheme_end | ( | const char * | url | ) |
Skip the https or http part of a URL https://, return zero if none is found.
Definition at line 440 of file preferences.cc.
References ARRAY_SIZE, and i.
Referenced by BKE_preferences_asset_library_get_index(), BKE_preferences_extension_remote_to_name(), BKE_preferences_extension_repo_find_by_remote_url_prefix(), and drop_extension_url_poll().
| void BKE_preferences_extension_repo_remove | ( | UserDef * | userdef, |
| bUserExtensionRepo * | repo ) |
Definition at line 216 of file preferences.cc.
References BLI_freelinkN(), and UserDef::extension_repos.
Referenced by BKE_preferences_asset_library_get_index(), blo_do_versions_userdef(), and preferences_extension_repo_remove_exec().
| size_t BKE_preferences_extension_repo_user_dirpath_get | ( | const bUserExtensionRepo * | repo, |
| char * | dirpath, | ||
| const int | dirpath_maxncpy ) |
Returns a user editable directory associated with this repository. Needed so extensions may have local data.
Definition at line 342 of file preferences.cc.
References BKE_appdir_folder_id_user_notest(), BLENDER_USER_EXTENSIONS, BLI_path_join, and bUserExtensionRepo::module.
Referenced by BKE_preferences_asset_library_get_index(), preferences_extension_repo_remove_exec(), and preferences_extension_repo_remove_invoke().
| void BKE_preferences_extension_repo_write_data | ( | BlendWriter * | writer, |
| const bUserExtensionRepo * | repo ) |
Definition at line 541 of file preferences.cc.
References bUserExtensionRepo::access_token, and BLO_write_string().
Referenced by BKE_preferences_extension_remote_to_name(), and write_userdef().
|
static |
A string copy that ensures: [A-Za-z]+[A-Za-z0-9_]*.
Definition at line 160 of file preferences.cc.
Referenced by BKE_preferences_extension_repo_module_is_valid(), and BKE_preferences_extension_repo_module_set().
|
static |
Definition at line 366 of file preferences.cc.
References ELEM.
Referenced by BKE_preferences_extension_remote_to_name(), and BKE_preferences_extension_repo_find_by_remote_url_prefix().