From ac8da6c72ed22de1533e95e11da96077b81df2ac Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 28 Jun 2024 14:30:11 +1000 Subject: [PATCH 1/4] Extensions: move junction_module to a private location bpy_extras is part of the public API where as the junction_module is part of the internal implementation of extensions. Move to "_bpy_internal". --- .../{bpy_extras => _bpy_internal}/extensions/junction_module.py | 0 scripts/modules/addon_utils.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/modules/{bpy_extras => _bpy_internal}/extensions/junction_module.py (100%) diff --git a/scripts/modules/bpy_extras/extensions/junction_module.py b/scripts/modules/_bpy_internal/extensions/junction_module.py similarity index 100% rename from scripts/modules/bpy_extras/extensions/junction_module.py rename to scripts/modules/_bpy_internal/extensions/junction_module.py diff --git a/scripts/modules/addon_utils.py b/scripts/modules/addon_utils.py index 69db5362995..860538e50d4 100644 --- a/scripts/modules/addon_utils.py +++ b/scripts/modules/addon_utils.py @@ -1174,7 +1174,7 @@ def _initialize_extensions_site_packages(*, create=False): def _initialize_extensions_repos_once(): - from bpy_extras.extensions.junction_module import JunctionModuleHandle + from _bpy_internal.extensions.junction_module import JunctionModuleHandle module_handle = JunctionModuleHandle(_ext_base_pkg_idname) module_handle.register_module() _ext_global.module_handle = module_handle From 92c026c39ba9cfdc92f5a463a6aca963d20d7a22 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Mon, 24 Jun 2024 18:45:07 +0200 Subject: [PATCH 2/4] I18n: Fix multi-context message extraction regex The BLT_I18N_MSGID_MULTI_CTXT() macro allows extracting a single message into up to 16 different contexts. The regex to do that was slightly wrong because it did not account for the macro potentially ending with a ",". The contexts for "New" were also sorted. Pull Request: https://projects.blender.org/blender/blender/pulls/123793 --- scripts/modules/bl_i18n_utils/settings.py | 2 +- .../editors/interface/templates/interface_templates.cc | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/modules/bl_i18n_utils/settings.py b/scripts/modules/bl_i18n_utils/settings.py index 23e278a9aec..eb668688ceb 100644 --- a/scripts/modules/bl_i18n_utils/settings.py +++ b/scripts/modules/bl_i18n_utils/settings.py @@ -312,7 +312,7 @@ PYGETTEXT_KEYWORDS = (() + ((r"/\*name_display\*/\s*" + _msg_re + r"\s*,"),) + tuple((r"{}\(\s*" + _msg_re + r"\s*,\s*(?:" + - r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*\)").format(it) + r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*,?\s*\)").format(it) for it in ("BLT_I18N_MSGID_MULTI_CTXT",)) ) diff --git a/source/blender/editors/interface/templates/interface_templates.cc b/source/blender/editors/interface/templates/interface_templates.cc index ce47afc7e57..5316ec26c35 100644 --- a/source/blender/editors/interface/templates/interface_templates.cc +++ b/source/blender/editors/interface/templates/interface_templates.cc @@ -1230,13 +1230,15 @@ static uiBut *template_id_def_new_but(uiBlock *block, BLT_I18NCONTEXT_ID_LATTICE, BLT_I18NCONTEXT_ID_LIGHT, BLT_I18NCONTEXT_ID_LIGHTPROBE, + BLT_I18NCONTEXT_ID_MASK, BLT_I18NCONTEXT_ID_MATERIAL, - BLT_I18NCONTEXT_ID_MASK, ); + BLT_I18NCONTEXT_ID_MESH, ); BLT_I18N_MSGID_MULTI_CTXT("New", - BLT_I18NCONTEXT_ID_MESH, BLT_I18NCONTEXT_ID_METABALL, BLT_I18NCONTEXT_ID_NODETREE, BLT_I18NCONTEXT_ID_OBJECT, + BLT_I18NCONTEXT_ID_PAINTCURVE, + BLT_I18NCONTEXT_ID_PALETTE, BLT_I18NCONTEXT_ID_PARTICLESETTINGS, BLT_I18NCONTEXT_ID_POINTCLOUD, BLT_I18NCONTEXT_ID_SCENE, @@ -1248,7 +1250,6 @@ static uiBut *template_id_def_new_but(uiBlock *block, BLT_I18NCONTEXT_ID_VOLUME, BLT_I18NCONTEXT_ID_WORKSPACE, BLT_I18NCONTEXT_ID_WORLD, ); - BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_ID_PAINTCURVE, BLT_I18NCONTEXT_ID_PALETTE, ); /* NOTE: BLT_I18N_MSGID_MULTI_CTXT takes a maximum number of parameters, * check the definition to see if a new call must be added when the limit * is exceeded. */ From 84f11da63ab1d202e70a3502758bdc6cbe0936bc Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 28 Jun 2024 11:26:56 +0200 Subject: [PATCH 3/4] UI: Extensions: Fix spacing between Install and Menu This was originally introduced on c6e452d865a0. A subsequent Cleanup commit (c3d18854f381) changed this further, increasing the gap a few extra pixels. Since no functional/visual change should ever come with a cleanup commit I'm treating this small regression as a bug, fixed by this commit. There was something right about c3d18854f381, and one of the align=True is indeed not needed. --- scripts/addons_core/bl_pkg/bl_extension_ui.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/addons_core/bl_pkg/bl_extension_ui.py b/scripts/addons_core/bl_pkg/bl_extension_ui.py index 1f8e8b1c387..47571c1a532 100644 --- a/scripts/addons_core/bl_pkg/bl_extension_ui.py +++ b/scripts/addons_core/bl_pkg/bl_extension_ui.py @@ -1169,7 +1169,7 @@ def extension_draw_item( # Add a top-level row so `row_right` can have a grayed out button/label # without graying out the menu item since# that is functional. - row_right_toplevel = row.row() + row_right_toplevel = row.row(align=True) if operation_in_progress: row_right_toplevel.enabled = False row_right_toplevel.alignment = 'RIGHT' @@ -1197,11 +1197,12 @@ def extension_draw_item( row_right.active = False - row_right = row_right_toplevel.row() + row_right = row_right_toplevel.row(align=True) row_right.alignment = 'RIGHT' + row_right.separator() - # NOTE: keep space between any buttons and this menu to prevent stray clicks accidentally running install. - # Currently there is enough space by default without an explicit separator. + # NOTE: Keep space between any buttons and this menu to prevent stray clicks accidentally running install. + # The separator is around together with the align to give some space while keeping the button and the menu still close-by. # Used `extension_path` so the menu can access "this" extension. row_right.context_string_set("extension_path", "{:s}.{:s}".format(repo_item.module, pkg_id)) row_right.menu("USERPREF_MT_extensions_item", text="", icon='DOWNARROW_HLT') From 51e68fe0ed620c21843f4e92cb266f470787bec0 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 28 Jun 2024 11:31:54 +0200 Subject: [PATCH 4/4] Cleanup: make format --- source/blender/editors/interface/interface_icons.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc index 5b01bdd87fc..ae0a3ae63bc 100644 --- a/source/blender/editors/interface/interface_icons.cc +++ b/source/blender/editors/interface/interface_icons.cc @@ -21,9 +21,9 @@ #include "GPU_state.hh" #include "GPU_texture.hh" -#include "BLI_string.h" #include "BLI_math_color_blend.h" #include "BLI_math_vector.h" +#include "BLI_string.h" #include "BLI_utildefines.h" #include "DNA_brush_types.h"