From 880dc72057003b1651457f3d472c09272a352ad4 Mon Sep 17 00:00:00 2001 From: Joseph HENRY Date: Wed, 3 Dec 2025 16:53:18 +0100 Subject: [PATCH] fix imports --- __init__.py | 36 ++++++++++++++++++------------------ functions.py | 3 +++ operators.py | 6 +++--- properties.py | 1 + 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/__init__.py b/__init__.py index be91140..81d48ba 100644 --- a/__init__.py +++ b/__init__.py @@ -1,19 +1,19 @@ +import os + +import bpy + +from . import operators, properties, ui, functions +from .functions import read_shelves +from .properties import CustomShelfProps, CustomShelfSettings + if "bpy" in locals(): import importlib - importlib.reload(operators) - importlib.reload(panels) - importlib.reload(functions) - importlib.reload(properties) + _ = importlib.reload(operators) + # _ = importlib.reload(panels) + _ = importlib.reload(functions) + _ = importlib.reload(properties) -from .functions import read_shelves -from . import operators -from . import properties -from . import ui -from .properties import CustomShelfSettings, CustomShelfProps - -import bpy -import os bl_info = { "name": "Custom Shelf", @@ -45,7 +45,7 @@ bl_classes = [ ] -def draw_menu(self, context): +def draw_menu(self, context: bpy.types.Context): self.layout.menu("CSHELF_MT_text_editor") @@ -54,9 +54,9 @@ def register(): bpy.utils.register_class(bl_class) bpy.types.Scene.CustomShelf = bpy.props.PointerProperty(type=CustomShelfSettings) - bpy.types.WindowManager.CustomShelf = bpy.props.PointerProperty( - type=CustomShelfProps - ) + # bpy.types.WindowManager.CustomShelf = bpy.props.PointerProperty( + # type=CustomShelfProps + # ) bpy.types.TEXT_MT_editor_menus.append(draw_menu) @@ -85,8 +85,8 @@ def unregister(): pass bpy.types.TEXT_MT_editor_menus.remove(draw_menu) - del bpy.types.Scene.CustomShelf - del bpy.types.WindowManager.CustomShelf + # del bpy.types.Scene.CustomShelf + # del bpy.types.WindowManager.CustomShelf for bl_class in bl_classes: bpy.utils.unregister_class(bl_class) diff --git a/functions.py b/functions.py index 63a3a6f..eef76b1 100644 --- a/functions.py +++ b/functions.py @@ -1,8 +1,11 @@ +from os import scandir +from posixpath import splitext from .utils import * from bpy.props import * from bpy.types import Panel, Operator from .properties import CustomShelfSettings, CustomShelfPrefs from .Types import * +from os.path import join, dirname, exists SHELF_DIR = join(dirname(__file__), "shelves") diff --git a/operators.py b/operators.py index 493bd12..5c0de00 100644 --- a/operators.py +++ b/operators.py @@ -394,11 +394,11 @@ class CSHELF_OT_add_script(Operator): return context.window_manager.invoke_props_dialog(self, width=500) -class TagFilterItem(PropertyGroup): - value: StringProperty(name="Tag") +#class TagFilterItem(PropertyGroup): +# value: StringProperty(name="Tag") class CustomShelfAddonPreferences(AddonPreferences): bl_idname = __name__ - tag_filter_items: CollectionProperty(type=TagFilterItem) + #tag_filter_items: CollectionProperty(type=TagFilterItem) diff --git a/properties.py b/properties.py index c2cc90f..7c4d4e9 100644 --- a/properties.py +++ b/properties.py @@ -1,5 +1,6 @@ from .utils import * from bpy.props import * +from os.path import join, dirname class CustomShelfSettings(bpy.types.PropertyGroup):