Merge branch 'blender-v4.2-release'

This commit is contained in:
Campbell Barton 2024-06-11 22:41:06 +10:00
commit b0db7e980d

@ -1273,6 +1273,51 @@ class EXTENSIONS_OT_repo_refresh_all(Operator):
return {'FINISHED'}
# Show a dialog when dropping a URL from an unknown repository,
# with the option to add the repository.
class EXTENSIONS_OT_repo_add_from_drop(Operator):
bl_idname = "extensions.repo_add_from_drop"
bl_label = "Add Repository Drop"
bl_options = {'INTERNAL'}
url: rna_prop_url
def invoke(self, context, _event):
wm = context.window_manager
wm.invoke_props_dialog(
self,
width=400,
confirm_text="Add Repository",
title="Unknown Repository",
)
return {'RUNNING_MODAL'}
def execute(self, context):
# Open an "Add Remote Repository" popup with the URL pre-filled.
bpy.ops.preferences.extension_repo_add('INVOKE_DEFAULT', type='REMOTE', remote_url=self.url)
return {'CANCELLED'}
def draw(self, context):
url = self.url
# Skip the URL prefix scheme, e.g. `https://` for less "noisy" outpout.
url_split = url.partition("://")
url_for_display = url_split[2] if url_split[2] else url
layout = self.layout
col = layout.column()
lines = (
iface_("The dropped URL comes from an unknown repository from:"),
url_for_display,
iface_("You may optionally add this repository now."),
iface_("Once the repository has been created the URL"),
iface_("will need to be dropped again."),
)
for line in lines:
col.label(text=line, translate=False)
class EXTENSIONS_OT_package_upgrade_all(Operator, _ExtCmdMixIn):
"""Upgrade all the extensions to their latest version for all the remote repositories"""
bl_idname = "extensions.package_upgrade_all"
@ -2191,7 +2236,11 @@ class EXTENSIONS_OT_package_install(Operator, _ExtCmdMixIn):
repo_index, repo_name, pkg_id, item_remote, item_local = extension_url_find_repo_index_and_pkg_id(url)
if repo_index == -1:
self.report({'ERROR'}, "Extension: URL not found in remote repositories!\n{:s}".format(url))
# The `remote_url` may not be defined, in this case there is not much we can do.
if not remote_url:
self.report({'ERROR'}, "Extension: URL not found in remote repositories!\n{:s}".format(url))
else:
bpy.ops.extensions.repo_add_from_drop('INVOKE_DEFAULT', url=remote_url)
return {'CANCELLED'}
if item_local is not None:
@ -2765,6 +2814,7 @@ classes = (
EXTENSIONS_OT_repo_sync,
EXTENSIONS_OT_repo_sync_all,
EXTENSIONS_OT_repo_refresh_all,
EXTENSIONS_OT_repo_add_from_drop,
EXTENSIONS_OT_package_install_files,
EXTENSIONS_OT_package_install,