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`
This commit is contained in:
parent
1a71fe37df
commit
1da0dbc40d
@ -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",
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user