diff --git a/CHANGELOG.md b/CHANGELOG.md index 810e8b7..3b5a506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +- **HUD On** (Preferences, Dashboard): the checkbox now shows or hides the viewport dashboard immediately in every open + scene, not only in new ones. It is still the starting state of scenes that have not used CurioMesh yet. + ## 0.9.8 - 2026-11-06 ### Hard surface diff --git a/__init__.py b/__init__.py index a8219c4..894265a 100644 --- a/__init__.py +++ b/__init__.py @@ -36,6 +36,10 @@ def _redraw(self, context): overlay.tag_redraw() +def _hud_default_update(self, context): + overlay.set_hud_everywhere(bool(self.hud_default)) + + def _color(name: str, label: str, description: str): return bpy.props.FloatVectorProperty( name=label, @@ -108,9 +112,10 @@ class CURIOMESH_AP_preferences(bpy.types.AddonPreferences): ) hud_default: bpy.props.BoolProperty( - name="HUD On in New Scenes", - description="Whether the viewport dashboard starts on in scenes that have not used CurioMesh yet", + name="HUD On", + description="Show or hide the viewport dashboard right away, in every open scene. Also the starting state of scenes that have not used CurioMesh yet", default=D["hud_default"], + update=_hud_default_update, ) hud_corner: bpy.props.EnumProperty( name="Corner", @@ -256,6 +261,7 @@ def execute(self, context): except Exception: pass apply_category() + overlay.set_hud_everywhere(bool(prefs.hud_default)) # property_unset skips update callbacks overlay.tag_redraw() return {"FINISHED"} diff --git a/overlay.py b/overlay.py index 2a4b2f7..78393e4 100644 --- a/overlay.py +++ b/overlay.py @@ -249,6 +249,14 @@ def apply_hud_default(scene=None) -> None: settings.hud_enabled = False +def set_hud_everywhere(enabled: bool) -> None: + """Show or hide the HUD right now in every open scene (live switch from the Preferences).""" + for sc in bpy.data.scenes: + settings = getattr(sc, "curiomesh_settings", None) + if settings is not None and settings.hud_enabled != enabled: + settings.hud_enabled = enabled # its update callback redraws the viewports + + def tag_redraw() -> None: wm = bpy.context.window_manager if wm is None: diff --git a/tests/blender_smoke.py b/tests/blender_smoke.py index 61d8532..bcacaec 100644 --- a/tests/blender_smoke.py +++ b/tests/blender_smoke.py @@ -1080,6 +1080,13 @@ def run_ui_prefs_case(module): if not settings.hud_enabled: raise AssertionError("ui prefs: hud default applied twice") prefs.hud_default = True + # The preference is also a live switch: it flips the HUD of the open scenes at once. + if not settings.hud_enabled: + raise AssertionError("ui prefs: hud_default True did not switch the HUD back on live") + prefs.hud_default = False + if settings.hud_enabled: + raise AssertionError("ui prefs: hud_default False did not hide the HUD live") + prefs.hud_default = True # Every panel draws, in several states, with no unknown icon / property / operator. states = []