diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7b62f12 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +.vscode \ No newline at end of file diff --git a/preferences/__init__.py b/preferences/__init__.py index b9ff812..2733204 100644 --- a/preferences/__init__.py +++ b/preferences/__init__.py @@ -1,21 +1,19 @@ from . import data_icon, data_config_prop, data_keymap, data_config_filter_panel, prefs classes = ( - data_icon, data_config_prop, data_config_filter_panel, data_keymap, prefs + data_icon, + data_config_prop, + data_config_filter_panel, + data_keymap, + prefs, ) def register(): - data_icon.register() - data_config_prop.register() - data_config_filter_panel.register() - data_keymap.register() - prefs.register() + for cls in classes: + cls.register() def unregister(): - prefs.unregister() - data_config_prop.unregister() - data_config_filter_panel.unregister() - data_keymap.unregister() - data_icon.unregister() + for cls in reversed(classes): + cls.unregister() diff --git a/preferences/data_icon.py b/preferences/data_icon.py index f3acd59..dd51648 100644 --- a/preferences/data_icon.py +++ b/preferences/data_icon.py @@ -18,7 +18,7 @@ def register_icon(): if file.endswith('.bip'): mats_icon.append(icon_dir.joinpath(file)) # 注册 - pcoll = previews.new() + pcoll = previews.new(lazy_load=not bpy.app.background) for icon_path in mats_icon: pcoll.load(icon_path.name[:-4], str(icon_path), 'IMAGE') @@ -32,8 +32,8 @@ def unregister_icon(): for pcoll in G_PV_COLL.values(): previews.remove(pcoll) - G_PV_COLL.clear() + G_PV_COLL.clear() G_ICON_ID.clear()