From 1da0dbc40deaeadc5b81864ec729070e5bc7571e Mon Sep 17 00:00:00 2001 From: Pullusb Date: Sun, 3 May 2026 17:04:22 +0200 Subject: [PATCH] Compatibility with Blender 5+ Fix error with tag_filter_items preference item. Can no longer receive dict-style data. Moved to a class attribute on `CustomShelfSettings` --- __init__.py | 2 +- functions.py | 8 +++----- operators.py | 3 +-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index 7181dd7..03b6514 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ bl_info = { "name": "Custom Shelf", "author": "Christophe Seux", "description": "Adds buttons to launch custom python scripts in the User panel.", - "version": (0, 3, 2), + "version": (0, 3, 3), "blender": (4, 0, 2), "location": "View3D > User Panel", "doc_url": "https://gitlab.com/autour-de-minuit/blender/custom_shelf/-/blob/main/README.md", diff --git a/functions.py b/functions.py index 818258e..549b9c6 100644 --- a/functions.py +++ b/functions.py @@ -81,7 +81,6 @@ def get_category_tabs(category): def read_shelves(): tag_filter_items = [] - # unregister panel : for panel in CustomShelfSettings.panel_list: print(panel) @@ -93,6 +92,8 @@ def read_shelves(): CustomShelfSettings.panel_list.remove(panel) for cat in get_dirs(get_shelves_folder()): + if cat.name == '.git': + continue cat_name = cat.name.replace("_", " ").title() header_info = { @@ -206,13 +207,10 @@ def read_shelves(): panel.scripts = sorted(scripts, key=lambda x: x["text"]) # Register tag filter enum - # setattr(Pre, v) - prefs = bpy.context.preferences.addons[__package__].preferences - tag_filter_items.sort() tag_filter_items.insert(0, "__clear__") - prefs["tag_filter_items"] = tag_filter_items + CustomShelfSettings.tag_filter_items = tag_filter_items # bpy.utils.unregister_class(CustomShelfPrefs) # bpy.utils.register_class(CustomShelfPrefs) diff --git a/operators.py b/operators.py index e6b48fb..7e24cb8 100644 --- a/operators.py +++ b/operators.py @@ -16,8 +16,7 @@ class CSHELF_OT_refresh(Operator): def get_tag_items(self, context): - prefs = bpy.context.preferences.addons[__package__].preferences - return [(i, i.title(), "") for i in prefs["tag_filter_items"]] + return [(i, i.title(), "") for i in CustomShelfSettings.tag_filter_items] class CSHELF_OT_set_tag_filter(Operator):