From 5294fa1cbe0276a73ee28f9a3e303d5d5fb8cc53 Mon Sep 17 00:00:00 2001 From: falken10vdl Date: Mon, 15 Dec 2025 13:39:46 +0100 Subject: [PATCH] Add preference for mass and time units visibility in project wizard --- src/bonsai/bonsai/bim/module/project/ui.py | 24 +++++++++++----------- src/bonsai/bonsai/bim/prop.py | 2 +- src/bonsai/bonsai/bim/ui.py | 8 ++++++++ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/project/ui.py b/src/bonsai/bonsai/bim/module/project/ui.py index b0dae84afe..6fe5b55604 100644 --- a/src/bonsai/bonsai/bim/module/project/ui.py +++ b/src/bonsai/bonsai/bim/module/project/ui.py @@ -359,24 +359,24 @@ class BIM_PT_new_project_wizard(Panel): row = self.layout.row() prop_with_search(self.layout, pprops, "template_file", text="Template") - header, body = self.layout.panel("Mass and Time Units", default_closed=True) - if header: - header.label(text="Mass and Time Units") - if body: - label = "Add Mass and Time Units" if not props.add_mass_time_units else "Remove Mass and Time Units" - body.prop(props, "add_mass_time_units", toggle=True, text=label) - if props.add_mass_time_units: - row = body.row() - row.prop(props, "mass_unit", text="Mass Unit") - row = body.row() - row.prop(props, "time_unit", text="Time Unit") + if tool.Blender.get_addon_preferences().mass_time_units_in_wizard: + header, body = self.layout.panel("Mass and Time Units", default_closed=True) + if header: + header.label(text="Mass and Time Units") + if body: + label = "Add Mass and Time Units" if not props.add_mass_time_units else "Remove Mass and Time Units" + body.prop(props, "add_mass_time_units", toggle=True, text=label) + if props.add_mass_time_units: + row = body.row() + row.prop(props, "mass_unit", text="Mass Unit") + row = body.row() + row.prop(props, "time_unit", text="Time Unit") self.layout.use_property_split = True row = self.layout.row() row.operator("bim.create_project") - class BIM_PT_project_library(Panel): bl_label = "Project Library" bl_idname = "BIM_PT_project_library" diff --git a/src/bonsai/bonsai/bim/prop.py b/src/bonsai/bonsai/bim/prop.py index c5a5bd9300..08137a133e 100644 --- a/src/bonsai/bonsai/bim/prop.py +++ b/src/bonsai/bonsai/bim/prop.py @@ -589,7 +589,7 @@ class BIMProperties(PropertyGroup): add_mass_time_units: bpy.props.BoolProperty( name="Add Mass and Time Units", description="Enable to define mass and time units for the project", - default=False + default=False, ) mass_unit: EnumProperty( items=[ diff --git a/src/bonsai/bonsai/bim/ui.py b/src/bonsai/bonsai/bim/ui.py index b7ed2180c1..d41546904c 100644 --- a/src/bonsai/bonsai/bim/ui.py +++ b/src/bonsai/bonsai/bim/ui.py @@ -684,6 +684,12 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): default=False, ) + mass_time_units_in_wizard: BoolProperty( + name="Mass and time units in project wizard", + description="Show mass and time units section in the new project wizard panel", + default=False, + ) + if TYPE_CHECKING: svg2pdf_command: str svg2dxf_command: str @@ -720,6 +726,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): doc: DocPreferences default_parameters: DefaultParameters container_hide_show_isolate: bool + mass_time_units_in_wizard: bool def draw(self, context: bpy.types.Context) -> None: layout = self.layout @@ -901,6 +908,7 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences): def draw_extras_settings(self, layout: bpy.types.UILayout, context: bpy.types.Context) -> None: layout.prop(self, "container_hide_show_isolate") + layout.prop(self, "mass_time_units_in_wizard") # Scene panel groups