Merge branch 'blender-v4.2-release'

This commit is contained in:
Campbell Barton 2024-06-10 22:23:24 +10:00
commit 8749a9c917
6 changed files with 19 additions and 15 deletions

@ -267,7 +267,7 @@ def repos_to_notify():
bl_extension_ops.RepoItem(
name=repo_item.name,
directory=repo_directory,
source="" if repo_item.use_custom_directory else repo_item.source,
source="" if repo_item.use_remote_url else repo_item.source,
remote_url=remote_url,
module=repo_item.module,
use_cache=repo_item.use_cache,

@ -254,7 +254,7 @@ def repo_iter_valid_local_only(context, *, exclude_system):
if not repo_item.enabled:
continue
if exclude_system:
if (not repo_item.use_custom_directory) and (repo_item.source == 'SYSTEM'):
if (not repo_item.use_remote_url) and (repo_item.source == 'SYSTEM'):
continue
# Ignore repositories that have invalid settings.
directory, remote_url = repo_paths_or_none(repo_item)
@ -520,7 +520,7 @@ def extension_repos_read_index(index, *, include_disabled=False):
return RepoItem(
name=repo_item.name,
directory=directory,
source="" if repo_item.use_custom_directory else repo_item.source,
source="" if repo_item.use_remote_url else repo_item.source,
remote_url=remote_url,
module=repo_item.module,
use_cache=repo_item.use_cache,
@ -558,7 +558,7 @@ def extension_repos_read(*, include_disabled=False, use_active_only=False):
result.append(RepoItem(
name=repo_item.name,
directory=directory,
source="" if repo_item.use_custom_directory else repo_item.source,
source="" if repo_item.use_remote_url else repo_item.source,
remote_url=remote_url,
module=repo_item.module,
use_cache=repo_item.use_cache,

@ -2145,7 +2145,7 @@ class USERPREF_MT_extensions_active_repo_remove(Menu):
except IndexError:
active_repo = None
is_system_repo = (active_repo.use_custom_directory is False) and (active_repo.source == 'SYSTEM')
is_system_repo = (active_repo.use_remote_url is False) and (active_repo.source == 'SYSTEM')
props = layout.operator("preferences.extension_repo_remove", text="Remove Repository")
props.index = active_repo_index
@ -2203,7 +2203,8 @@ class USERPREF_PT_extensions_repos(Panel):
# For now it can be accessed from Python if someone is.
# `layout.prop(active_repo, "use_remote_url", text="Use Remote URL")`
if active_repo.use_remote_url:
use_remote_url = active_repo.use_remote_url
if use_remote_url:
row = layout.row()
split = row.split(factor=0.936)
if active_repo.remote_url == "":
@ -2244,15 +2245,13 @@ class USERPREF_PT_extensions_repos(Panel):
# valid UTF-8 which will raise a Python exception when passed in as text.
sub.prop(active_repo, "directory", text="")
row = layout_panel.row()
row.active = not use_custom_directory
row.prop(active_repo, "source")
if active_repo.use_remote_url:
if use_remote_url:
row = layout_panel.row(align=True, heading="Authentication")
row.prop(active_repo, "use_access_token")
layout_panel.prop(active_repo, "use_cache")
else:
layout_panel.prop(active_repo, "source")
layout_panel.separator()

@ -279,7 +279,12 @@ size_t BKE_preferences_extension_repo_dirpath_get(const bUserExtensionRepo *repo
std::optional<std::string> path = std::nullopt;
switch (repo->source) {
uint8_t source = repo->source;
if (repo->flag & USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL) {
source = USER_EXTENSION_REPO_SOURCE_USER;
}
switch (source) {
case USER_EXTENSION_REPO_SOURCE_SYSTEM: {
path = BKE_appdir_folder_id(BLENDER_SYSTEM_EXTENSIONS, nullptr);
break;

@ -604,7 +604,7 @@ static int preferences_extension_repo_remove_invoke(bContext *C,
}
if (remove_files) {
if ((repo->flag & USER_EXTENSION_REPO_FLAG_USE_CUSTOM_DIRECTORY) == 0) {
if ((repo->flag & USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL) == 0) {
if (repo->source == USER_EXTENSION_REPO_SOURCE_SYSTEM) {
remove_files = false;
}
@ -649,7 +649,7 @@ static int preferences_extension_repo_remove_exec(bContext *C, wmOperator *op)
BKE_callback_exec_null(bmain, BKE_CB_EVT_EXTENSION_REPOS_UPDATE_PRE);
if (remove_files) {
if ((repo->flag & USER_EXTENSION_REPO_FLAG_USE_CUSTOM_DIRECTORY) == 0) {
if ((repo->flag & USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL) == 0) {
if (repo->source == USER_EXTENSION_REPO_SOURCE_SYSTEM) {
/* The UI doesn't show this option, if it's accessed disallow it. */
BKE_report(op->reports, RPT_WARNING, "Unable to remove files for \"System\" repositories");

@ -669,7 +669,7 @@ typedef enum eUserExtensionRepo_Flag {
/**
* The source to use (User or System), only valid when the
* #USER_EXTENSION_REPO_FLAG_USE_CUSTOM_DIRECTORY flag isn't set.
* #USER_EXTENSION_REPO_FLAG_USE_REMOTE_URL flag isn't set.
*/
typedef enum eUserExtensionRepo_Source {
USER_EXTENSION_REPO_SOURCE_USER = 0,