|
Blender V5.0
|
Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
| namespace | blender::bke::preferences |
| #define BKE_PREFS_ASSET_LIBRARY_DEFAULT_NAME N_("User Library") |
Name of the asset library added by default. Needs translation with DATA_() still.
Definition at line 40 of file BKE_preferences.h.
Referenced by BKE_preferences_asset_library_default_add(), and blo_do_versions_userdef().
| struct bUserAssetLibrary * BKE_preferences_asset_library_add | ( | struct 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().
| struct bUserAssetLibrary * BKE_preferences_asset_library_containing_path | ( | const struct UserDef * | userdef, |
| const char * | path ) |
Return the bUserAssetLibrary that contains the given file/directory path. The given path can be the library's top-level directory, or any path inside that directory.
When more than one asset libraries match, the first matching one is returned (no smartness when there nested asset libraries).
Return NULL when no such asset library is found.
References ATTR_NONNULL, ATTR_WARN_UNUSED_RESULT, and BKE_preferences_asset_library_containing_path().
Referenced by AS_asset_library_find_suitable_root_path_from_path(), blender::ed::asset::asset_bundle_install_poll(), blender::bke::asset_edit_weak_reference_from_id(), blender::bke::asset_link_id(), and BKE_preferences_asset_library_containing_path().
| void BKE_preferences_asset_library_default_add | ( | struct 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().
| struct bUserAssetLibrary * BKE_preferences_asset_library_find_by_name | ( | const struct UserDef * | userdef, |
| const char * | name ) |
References ATTR_NONNULL, ATTR_WARN_UNUSED_RESULT, BKE_preferences_asset_library_find_by_name(), and name.
Referenced by BKE_preferences_asset_library_find_by_name(), blender::ed::sculpt_paint::brush_asset_delete_exec(), blender::ed::sculpt_paint::brush_asset_save_exec(), and blender::asset_system::AssetLibraryService::find_custom_preferences_asset_library_from_asset_weak_ref().
| struct bUserAssetLibrary * BKE_preferences_asset_library_find_index | ( | const struct UserDef * | userdef, |
| int | index ) |
References ATTR_WARN_UNUSED_RESULT.
Referenced by blender::ed::animrig::create_pose_asset_user_library(), filelist_compare_asset_libraries(), fileselect_refresh_asset_params(), blender::asset_system::AssetLibraryService::find_custom_asset_library_from_library_ref(), blender::ed::asset::get_asset_library_from_opptr(), blender::ed::asset::library_reference_from_enum_value(), blender::ed::asset::library_reference_to_enum_value(), and blender::ed::asset::selected_asset_library().
| int BKE_preferences_asset_library_get_index | ( | const struct UserDef * | userdef, |
| const struct bUserAssetLibrary * | library ) |
References ATTR_NONNULL, ATTR_WARN_UNUSED_RESULT, BKE_preferences_asset_library_default_add(), BKE_preferences_asset_library_get_index(), BKE_preferences_extension_repo_add(), BKE_preferences_extension_repo_add_default_remote(), BKE_preferences_extension_repo_add_default_system(), BKE_preferences_extension_repo_add_default_user(), BKE_preferences_extension_repo_add_defaults_all(), BKE_preferences_extension_repo_custom_dirpath_set(), BKE_preferences_extension_repo_dirpath_get(), BKE_preferences_extension_repo_find_by_module(), BKE_preferences_extension_repo_find_by_remote_url_prefix(), BKE_preferences_extension_repo_find_index(), BKE_preferences_extension_repo_module_is_valid(), BKE_preferences_extension_repo_module_set(), BKE_preferences_extension_repo_name_set(), BKE_preferences_extension_repo_remote_scheme_end(), BKE_preferences_extension_repo_remove(), BKE_preferences_extension_repo_user_dirpath_get(), module, and name.
Referenced by BKE_preferences_asset_library_get_index().
| void BKE_preferences_asset_library_name_set | ( | struct UserDef * | userdef, |
| struct 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[64] ) |
Set a name based on a URL, e.g. https://www.example.com/path -> example.com.
References BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(), BKE_preferences_asset_shelf_settings_get(), BKE_preferences_asset_shelf_settings_is_catalog_path_enabled(), BKE_preferences_extension_remote_to_name(), BKE_preferences_extension_repo_get_index(), BKE_preferences_extension_repo_read_data(), BKE_preferences_extension_repo_write_data(), and name.
Referenced by BKE_preferences_extension_remote_to_name(), and preferences_extension_repo_add_exec().
| 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, | ||
| 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 | ( | struct 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 | ( | struct 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().