()
| 263 | |
| 264 | |
| 265 | def register(): |
| 266 | register_classes(classes) |
| 267 | |
| 268 | bpy.app.handlers.depsgraph_update_post.append(on_register) |
| 269 | bpy.app.handlers.undo_post.append(handler.undo_post) |
| 270 | bpy.app.handlers.redo_post.append(handler.redo_post) |
| 271 | bpy.app.handlers.load_post.append(handler.load_post) |
| 272 | bpy.app.handlers.load_post.append(handler.loadIfcStore) |
| 273 | bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties) |
| 274 | bpy.types.Scene.BIMSnapProperties = bpy.props.PointerProperty(type=prop.BIMSnapProperties) |
| 275 | bpy.types.Scene.BIMSnapGroups = bpy.props.PointerProperty(type=prop.BIMSnapGroups) |
| 276 | bpy.types.Screen.BIMAreaProperties = bpy.props.CollectionProperty(type=prop.BIMAreaProperties) |
| 277 | bpy.types.Screen.BIMTabProperties = bpy.props.PointerProperty(type=prop.BIMTabProperties) |
| 278 | bpy.types.Collection.BIMCollectionProperties = bpy.props.PointerProperty(type=prop.BIMCollectionProperties) |
| 279 | bpy.types.Object.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties) |
| 280 | bpy.types.Mesh.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) |
| 281 | bpy.types.Curve.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) |
| 282 | bpy.types.Camera.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) |
| 283 | bpy.types.PointLight.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) |
| 284 | |
| 285 | if hasattr(bpy.types, "UI_MT_button_context_menu"): |
| 286 | bpy.types.UI_MT_button_context_menu.append(ui.draw_custom_context_menu) |
| 287 | bpy.types.STATUSBAR_HT_header.append(ui.draw_statusbar) |
| 288 | |
| 289 | for mod in modules.values(): |
| 290 | mod.register() |
| 291 | |
| 292 | # Delay registering classes that depend on module classes |
| 293 | register_classes(late_classes) |
| 294 | |
| 295 | wm = bpy.context.window_manager |
| 296 | if wm.keyconfigs.addon: |
| 297 | km = wm.keyconfigs.addon.keymaps.new(name="Window", space_type="EMPTY") |
| 298 | kmi = km.keymap_items.new("bim.switch_tab", "TAB", "PRESS", ctrl=True) |
| 299 | addon_keymaps.append((km, kmi)) |
| 300 | |
| 301 | global icons |
| 302 | |
| 303 | icons_dir = os.path.join(cwd, "data", "icons") |
| 304 | icon_preview = bpy.utils.previews.new() |
| 305 | for filename in os.listdir(icons_dir): |
| 306 | if filename.endswith(".png"): |
| 307 | icon_name = os.path.splitext(filename)[0] |
| 308 | icon_path = os.path.join(icons_dir, filename) |
| 309 | icon_preview.load(icon_name, icon_path, "IMAGE") |
| 310 | |
| 311 | icons = icon_preview |
| 312 | bpy.app.translations.register("bonsai", translations_dict) |
| 313 | |
| 314 | import bonsai.tool as tool |
| 315 | |
| 316 | tool.Blender.ensure_bin_in_path() |
| 317 | # RestrictedContext doesn't allow accessing scene attribute, postpone it for a bit. |
| 318 | bpy.app.timers.register(tool.Blender.setup_user_data_dir, first_interval=0.1) |
| 319 | |
| 320 | |
| 321 | def unregister(): |
nothing calls this directly
no test coverage detected