Add preference for mass and time units visibility in project wizard

This commit is contained in:
falken10vdl
2025-12-15 13:39:46 +01:00
parent a98cad161e
commit 5294fa1cbe
3 changed files with 21 additions and 13 deletions
+12 -12
View File
@@ -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"
+1 -1
View File
@@ -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=[
+8
View File
@@ -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