mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 19:54:07 +00:00
5e23030a0f
Three concerns folded into ``load_post`` argue for separation: 1. Save-file invariants every load must re-establish (msgbus subscription, owner-settings, thumbnail cache, draft-flag healing, blend-warning flag, H5 lock probe). 2. User-preference-driven UI setup (toolbar, workspace, viewport shading, panel hijack, snap defaults). 3. Viewport overlay sync (every decorator's install/uninstall). Pull each into its own function (``_apply_save_file_invariants`` / ``_apply_user_preferences`` / ``_install_viewport_overlays``). The ``load_post`` callback becomes a 3-line orchestrator. Each phase is independently call-able from tests and from PR4 features that need to re-trigger one phase without the others. Two new hooks land with the decompose: * ``tool.Parametric.heal_stale_edit_flags()`` + ``discard_pending_previews(scene)`` fire in ``_apply_save_file_invariants``. The first clears object-level ``BIM<Name>Properties.is_editing`` flags that lost their backing IFC element across a load; the second clears scene-level ``BIMPreviewProperties.<x>.is_active`` so saved preview state never resurfaces with no UI to interact with it. * ``install_decorator_cache_handlers`` / ``uninstall_decorator_cache_handlers`` wrap the decorator install/install pass in ``_install_viewport_overlays``. The bump handlers append to ``depsgraph_update_post`` + ``undo_post`` + ``redo_post`` + ``load_post`` so the previous commit's ``TokenCache`` in ``tool.System.get_decoration_data`` finally invalidates on structural scene changes. Generated with the assistance of an AI coding tool.