Add mass and time units as a panel to project wizard UI

This commit is contained in:
falken10vdl
2025-09-29 09:13:18 +02:00
parent f902c7a50a
commit f222a8ba4f
2 changed files with 22 additions and 9 deletions
@@ -114,6 +114,7 @@ def register():
kmi = km.keymap_items.new("bim.save_project", "S", "PRESS", ctrl=True)
kmi.properties.should_save_as = False
addon_keymaps.append((km, kmi))
bpy.utils.register_class(ui.BIM_PT_mass_time_units)
def unregister():
@@ -131,3 +132,4 @@ def unregister():
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
bpy.utils.unregister_class(ui.BIM_PT_mass_time_units)
+20 -9
View File
@@ -358,19 +358,30 @@ class BIM_PT_new_project_wizard(Panel):
row.prop(props, "volume_unit", text="Volume Unit")
row = self.layout.row()
prop_with_search(self.layout, pprops, "template_file", text="Template")
self.layout.use_property_split = False
row = self.layout.row()
label = "Add Mass and Time Units" if not props.add_mass_time_units else "Remove Mass and Time Units"
row.prop(props, "add_mass_time_units", toggle=True, text=label)
self.layout.use_property_split = True
if props.add_mass_time_units:
row = self.layout.row()
row.prop(props, "mass_unit", text="Mass Unit")
row = self.layout.row()
row.prop(props, "time_unit", text="Time Unit")
row = self.layout.row()
row.operator("bim.create_project")
class BIM_PT_mass_time_units(Panel):
bl_label = "Mass and Time Units"
bl_idname = "BIM_PT_mass_time_units"
bl_options = {"DEFAULT_CLOSED"}
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
bl_parent_id = "BIM_PT_new_project_wizard"
def draw(self, context):
layout = self.layout
props = tool.Blender.get_bim_props()
label = "Add Mass and Time Units" if not props.add_mass_time_units else "Remove Mass and Time Units"
layout.prop(props, "add_mass_time_units", toggle=True, text=label)
if props.add_mass_time_units:
row = layout.row()
row.prop(props, "mass_unit", text="Mass Unit")
row = layout.row()
row.prop(props, "time_unit", text="Time Unit")
class BIM_PT_project_library(Panel):
bl_label = "Project Library"
bl_idname = "BIM_PT_project_library"