From 57ad170033d4a3107a7385215e7abc8d1d48b054 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Fri, 20 Mar 2026 07:45:59 -0500 Subject: [PATCH] Fix dasu_panel.py to work as an installable Blender addon Add bl_info dict so Blender recognises the file as an addon, and replace the bare module-level registration code with proper register()/unregister() functions. Previously the addon would install but not appear in the list and threw a RuntimeError on enable. Generated with the assistance of an AI coding tool. --- blender/dasu_panel.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/blender/dasu_panel.py b/blender/dasu_panel.py index 9ee8c46..f9e09ed 100644 --- a/blender/dasu_panel.py +++ b/blender/dasu_panel.py @@ -15,6 +15,16 @@ 6. Dasu picks it up automatically and places it on the active sheet """ +bl_info = { + "name": "Dasu Bridge", + "author": "4nigel", + "version": (0, 1, 0), + "blender": (4, 0, 0), + "location": "View3D > N-Panel > Dasu", + "description": "Send Bonsai BIM drawings to the Dasu sheet layout tool", + "category": "Import-Export", +} + import bpy import json import os @@ -776,14 +786,18 @@ def draw(self, context): DASU_PT_panel, ] -# Self-unregister (safe to re-run in Text Editor) -for cls in CLASSES: - try: bpy.utils.unregister_class(cls) - except Exception: pass -_unregister_props() +def register(): + for cls in CLASSES: + bpy.utils.register_class(cls) + _register_props() + print('\n Dasu panel registered. Press N in the 3D viewport → Dasu tab.\n') + + +def unregister(): + for cls in reversed(CLASSES): + bpy.utils.unregister_class(cls) + _unregister_props() -for cls in CLASSES: - bpy.utils.register_class(cls) -_register_props() -print('\n Dasu panel registered. Press N in the 3D viewport → Dasu tab.\n') +if __name__ == '__main__': + register()