added lb_labels

This commit is contained in:
falken10
2025-04-25 02:47:01 +02:00
committed by falken10vdl
parent c8306d44b9
commit d0dbdbc205
3 changed files with 120 additions and 98 deletions
+17 -14
View File
@@ -233,37 +233,40 @@ def on_register(scene):
is_registering = False is_registering = False
def register_panel_visibility_properties(): def register_panel_visibility_properties():
for panel_name in ui.TAB_PANELS.values(): for panel_list in ui.TAB_PANELS.values():
for panel in panel_name: for panel in panel_list:
prop_name = f"show_{panel.lower()}" bl_idname = panel.get("bl_idname", "")
prop_name = f"show_{bl_idname.lower()}"
setattr( setattr(
bpy.types.Scene, bpy.types.Scene,
prop_name, prop_name,
bpy.props.BoolProperty( bpy.props.BoolProperty(
name=f"Show {panel}", name=f"Show {bl_idname}",
description=f"Show or hide the {panel} panel", description=f"Show or hide the {bl_idname} panel",
default=True, # Panels are visible by default default=True,
), ),
) )
prop_name = f"bookmark_{panel.lower()}" prop_name = f"bookmark_{bl_idname.lower()}"
setattr( setattr(
bpy.types.Scene, bpy.types.Scene,
prop_name, prop_name,
bpy.props.BoolProperty( bpy.props.BoolProperty(
name=f"Bookmark {panel}", name=f"Bookmark {bl_idname}",
description=f"Move to Bookmark or not {panel} panel", description=f"Move to Bookmark or not {bl_idname} panel",
default=False, # Panels are visible by default default=False,
), ),
) )
def unregister_panel_visibility_properties(): def unregister_panel_visibility_properties():
for panel_name in ui.TAB_PANELS.values(): for panel_list in ui.TAB_PANELS.values():
for panel in panel_name: for panel in panel_list:
prop_name = f"show_{panel.lower()}" bl_idname = panel.get("bl_idname", "")
prop_name = f"show_{bl_idname.lower()}"
if hasattr(bpy.types.Scene, prop_name): if hasattr(bpy.types.Scene, prop_name):
delattr(bpy.types.Scene, prop_name) delattr(bpy.types.Scene, prop_name)
prop_name = f"bookmark_{panel.lower()}" prop_name = f"bookmark_{bl_idname.lower()}"
if hasattr(bpy.types.Scene, prop_name): if hasattr(bpy.types.Scene, prop_name):
delattr(bpy.types.Scene, prop_name) delattr(bpy.types.Scene, prop_name)
+19 -11
View File
@@ -1614,7 +1614,7 @@ class BIM_UL_tab_panels(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# Draw the panel name # Draw the panel name
row = layout.row(align=True) row = layout.row(align=True)
row.label(text=item.name) row.label(text=item["bl_label"])
# Add the eye icon for toggling visibility # Add the eye icon for toggling visibility
row.operator( row.operator(
@@ -1692,18 +1692,21 @@ class BIM_OT_bookmark_panel(bpy.types.Operator):
print(f"Property '{prop_name}' not found on Scene.") print(f"Property '{prop_name}' not found on Scene.")
# Add or remove the panel from the TAB_PANELS["BOOKMARK"] list # Add or remove the panel from the TAB_PANELS["BOOKMARK"] list
panel_label = item["bl_label"]
if item["bookmarked"]: if item["bookmarked"]:
if panel_name not in TAB_PANELS["BOOKMARK"]: if not any(p.get("bl_idname") == panel_name for p in TAB_PANELS["BOOKMARK"]):
TAB_PANELS["BOOKMARK"].append(panel_name) TAB_PANELS["BOOKMARK"].append({"bl_idname": panel_name, "bl_label": panel_label})
print(f"Added {panel_name} to BOOKMARK tab.") print(f"Added {panel_name} to BOOKMARK tab.")
else: else:
if panel_name in TAB_PANELS["BOOKMARK"]: for i, p in enumerate(TAB_PANELS["BOOKMARK"]):
TAB_PANELS["BOOKMARK"].remove(panel_name) if p.get("bl_idname") == panel_name:
print(f"Removed {panel_name} from BOOKMARK tab.") del TAB_PANELS["BOOKMARK"][i]
# Remove the panel from the tab_panels collection if in BOOKMARK tab print(f"Removed {panel_name} from BOOKMARK tab.")
if context.scene.active_tab_name == "BOOKMARK": if context.scene.active_tab_name == "BOOKMARK":
context.scene.tab_panels.remove(context.scene.tab_panels.find(panel_name)) index = context.scene.tab_panels.find(panel_name)
break if index != -1:
context.scene.tab_panels.remove(index)
break
# Redraw the UI to reflect the changes # Redraw the UI to reflect the changes
for area in bpy.context.window.screen.areas: for area in bpy.context.window.screen.areas:
@@ -1728,9 +1731,14 @@ class BIM_OT_manage_tab_panels(bpy.types.Operator):
# Populate the tab_panels collection # Populate the tab_panels collection
context.scene.tab_panels.clear() context.scene.tab_panels.clear()
for panel_name in TAB_PANELS.get(self.tab_name, []): for panel_data in TAB_PANELS.get(self.tab_name, []):
panel_name = panel_data.get("bl_idname","")
panel_label = panel_data.get("bl_label","")
if not panel_name or not panel_label:
continue
item = context.scene.tab_panels.add() item = context.scene.tab_panels.add()
item.name = panel_name item.name = panel_name
item["bl_label"] = panel_label
# Use the registered properties to set visibility and bookmark states # Use the registered properties to set visibility and bookmark states
show_prop_name = f"show_{panel_name.lower()}" show_prop_name = f"show_{panel_name.lower()}"
+84 -73
View File
@@ -65,60 +65,70 @@ if TYPE_CHECKING:
TAB_PANELS = { TAB_PANELS = {
"PROJECT": [ "PROJECT": [
# "BIM_PT_tab_new_project_wizard", # "BIM_PT_tab_new_project_wizard",
"BIM_PT_tab_project_info", {"bl_idname":"BIM_PT_tab_project_info", "bl_label":"Project Info"},
"BIM_PT_tab_spatial", {"bl_idname":"BIM_PT_tab_spatial", "bl_label":"Spatial"},
"BIM_PT_tab_project_setup", {"bl_idname":"BIM_PT_tab_project_setup", "bl_label":"Project Setup"},
"BIM_PT_tab_geometry", {"bl_idname":"BIM_PT_tab_geometry", "bl_label":"Geometry"},
"BIM_PT_tab_stakeholders", {"bl_idname":"BIM_PT_tab_stakeholders", "bl_label":"Stakeholders"},
"BIM_PT_tab_grouping_and_filtering", {"bl_idname":"BIM_PT_tab_grouping_and_filtering", "bl_label":"Grouping and Filtering"},
], ],
"OBJECT": [ "OBJECT": [
"BIM_PT_tab_object_metadata", {"bl_idname":"BIM_PT_tab_object_metadata", "bl_label":"Object Metadata"},
"BIM_PT_tab_misc", {"bl_idname":"BIM_PT_tab_misc", "bl_label":"Misc"},
], ],
"GEOMETRY": [ "GEOMETRY": [
"BIM_PT_tab_placement", {"bl_idname":"BIM_PT_tab_placement", "bl_label":"Placement"},
"BIM_PT_tab_representations", {"bl_idname":"BIM_PT_tab_representations", "bl_label":"Representations"},
"BIM_PT_tab_geometric_relationships", {"bl_idname":"BIM_PT_tab_geometric_relationships", "bl_label":"Geometric Relationships"},
"BIM_PT_tab_parametric_geometry", {"bl_idname":"BIM_PT_tab_parametric_geometry", "bl_label":"Parametric Geometry"},
"BIM_PT_tab_object_materials", {"bl_idname":"BIM_PT_tab_object_materials", "bl_label":"Object Materials"},
"BIM_PT_tab_materials", {"bl_idname":"BIM_PT_tab_materials", "bl_label":"Materials"},
"BIM_PT_tab_styles", {"bl_idname":"BIM_PT_tab_styles", "bl_label":"Styles"},
"BIM_PT_tab_profiles", {"bl_idname":"BIM_PT_tab_profiles", "bl_label":"Profiles"},
], ],
"DRAWINGS": [ "DRAWINGS": [
"BIM_PT_tab_sheets", {"bl_idname":"BIM_PT_tab_sheets", "bl_label":"Sheets"},
"BIM_PT_tab_drawings", {"bl_idname":"BIM_PT_tab_drawings", "bl_label":"Drawings"},
"BIM_PT_tab_schedules", {"bl_idname":"BIM_PT_tab_schedules", "bl_label":"Schedules"},
"BIM_PT_tab_references", {"bl_idname":"BIM_PT_tab_references", "bl_label":"References"},
], ],
"SERVICES": [ "SERVICES": [
"BIM_PT_tab_services", {"bl_idname":"BIM_PT_tab_services", "bl_label":"Services"},
"BIM_PT_tab_zones", {"bl_idname":"BIM_PT_tab_zones", "bl_label":"Zones"},
"BIM_PT_tab_solar_analysis", {"bl_idname":"BIM_PT_tab_solar_analysis", "bl_label":"Solar Analysis"},
"BIM_PT_tab_lighting", {"bl_idname":"BIM_PT_tab_lighting", "bl_label":"Lighting"},
], ],
"STRUCTURE": [ "STRUCTURE": [
"BIM_PT_tab_structural", {"bl_idname":"BIM_PT_tab_structural", "bl_label":"Structural"},
], ],
"SCHEDULING": [ "SCHEDULING": [
"BIM_PT_tab_status", {"bl_idname":"BIM_PT_tab_status", "bl_label":"Status"},
"BIM_PT_tab_qto", {"bl_idname":"BIM_PT_tab_qto", "bl_label":"Quantity Take-off"},
"BIM_PT_tab_resources", {"bl_idname":"BIM_PT_tab_resources", "bl_label":"Resources"},
"BIM_PT_tab_cost", {"bl_idname":"BIM_PT_tab_cost", "bl_label":"Cost"},
"BIM_PT_tab_sequence", {"bl_idname":"BIM_PT_tab_sequence", "bl_label":"Construction Scheduling"},
], ],
"FM": [ "FM": [
"BIM_PT_tab_handover", {"bl_idname":"BIM_PT_tab_handover", "bl_label":"Handover"},
"BIM_PT_tab_operations", {"bl_idname":"BIM_PT_tab_operations", "bl_label":"Operations"},
], ],
"QUALITY": [ "QUALITY": [
"BIM_PT_tab_quality_control", {"bl_idname":"BIM_PT_tab_quality_control", "bl_label":"Quality Control"},
"BIM_PT_tab_clash_detection", {"bl_idname":"BIM_PT_tab_clash_detection", "bl_label":"Clash Detection"},
"BIM_PT_tab_collaboration", {"bl_idname":"BIM_PT_tab_collaboration", "bl_label":"Collaboration"},
"BIM_PT_tab_sandbox", {"bl_idname":"BIM_PT_tab_sandbox", "bl_label":"Sandbox"},
],
"BOOKMARK": [
{},
], ],
"BOOKMARK": [],
} }
@@ -1181,7 +1191,8 @@ class BIM_PT_tab_project_info(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
if not tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")): if not tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")):
return False return False
bim_props = tool.Blender.get_bim_props() bim_props = tool.Blender.get_bim_props()
pprops = tool.Project.get_project_props() pprops = tool.Project.get_project_props()
@@ -1211,7 +1222,7 @@ class BIM_PT_tab_spatial(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1232,7 +1243,7 @@ class BIM_PT_tab_project_setup(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
def draw(self, context): def draw(self, context):
pass pass
@@ -1254,7 +1265,7 @@ class BIM_PT_tab_stakeholders(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1275,7 +1286,7 @@ class BIM_PT_tab_collaboration(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
def draw(self, context): def draw(self, context):
pass pass
@@ -1297,7 +1308,7 @@ class BIM_PT_tab_grouping_and_filtering(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1326,7 +1337,7 @@ class BIM_PT_tab_geometry(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1347,7 +1358,7 @@ class BIM_PT_tab_status(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1368,7 +1379,7 @@ class BIM_PT_tab_qto(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1389,7 +1400,7 @@ class BIM_PT_tab_resources(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1410,7 +1421,7 @@ class BIM_PT_tab_cost(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1431,7 +1442,7 @@ class BIM_PT_tab_sequence(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1452,7 +1463,7 @@ class BIM_PT_tab_structural(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1473,7 +1484,7 @@ class BIM_PT_tab_services(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1494,7 +1505,7 @@ class BIM_PT_tab_lighting(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1515,7 +1526,7 @@ class BIM_PT_tab_zones(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1536,7 +1547,7 @@ class BIM_PT_tab_solar_analysis(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1557,7 +1568,7 @@ class BIM_PT_tab_quality_control(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
def draw(self, context): def draw(self, context):
pass pass
@@ -1578,7 +1589,7 @@ class BIM_PT_tab_clash_detection(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
def draw(self, context): def draw(self, context):
pass pass
@@ -1600,7 +1611,7 @@ class BIM_PT_tab_sandbox(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
def draw(self, context): def draw(self, context):
row = self.layout.row() row = self.layout.row()
@@ -1627,7 +1638,7 @@ class BIM_PT_tab_object_metadata(Panel):
props = tool.Project.get_project_props() props = tool.Project.get_project_props()
return ( return (
tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
and tool.Ifc.get() and tool.Ifc.get()
and (obj := context.active_object) and (obj := context.active_object)
# Hide links empty handles. # Hide links empty handles.
@@ -1660,7 +1671,7 @@ class BIM_PT_tab_placement(Panel):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return ( return (
tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
and tool.Ifc.get() and tool.Ifc.get()
and (obj := context.active_object) and (obj := context.active_object)
and tool.Ifc.get_entity(obj) and tool.Ifc.get_entity(obj)
@@ -1687,7 +1698,7 @@ class BIM_PT_tab_representations(Panel):
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return ( return (
tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
and tool.Ifc.get() and tool.Ifc.get()
and tool.Geometry.get_active_or_representation_obj() and tool.Geometry.get_active_or_representation_obj()
) )
@@ -1713,7 +1724,7 @@ class BIM_PT_tab_geometric_relationships(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1737,7 +1748,7 @@ class BIM_PT_tab_parametric_geometry(Panel):
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return ( return (
tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
and tool.Ifc.get() and tool.Ifc.get()
and (obj := context.active_object) and (obj := context.active_object)
and tool.Ifc.get_entity(obj) and tool.Ifc.get_entity(obj)
@@ -1764,7 +1775,7 @@ class BIM_PT_tab_object_materials(Panel):
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return ( return (
tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
and tool.Ifc.get() and tool.Ifc.get()
and (obj := context.active_object) and (obj := context.active_object)
and tool.Ifc.get_entity(obj) and tool.Ifc.get_entity(obj)
@@ -1790,7 +1801,7 @@ class BIM_PT_tab_materials(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1812,7 +1823,7 @@ class BIM_PT_tab_styles(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1834,7 +1845,7 @@ class BIM_PT_tab_profiles(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1856,7 +1867,7 @@ class BIM_PT_tab_sheets(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1878,7 +1889,7 @@ class BIM_PT_tab_drawings(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1900,7 +1911,7 @@ class BIM_PT_tab_schedules(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1922,7 +1933,7 @@ class BIM_PT_tab_references(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1945,7 +1956,7 @@ class BIM_PT_tab_misc(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) and tool.Ifc.get() return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK")) and tool.Ifc.get()
def draw(self, context): def draw(self, context):
pass pass
@@ -1967,7 +1978,7 @@ class BIM_PT_tab_handover(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
def draw(self, context): def draw(self, context):
pass pass
@@ -1989,7 +2000,7 @@ class BIM_PT_tab_operations(Panel):
return False return False
if getattr(context.scene, prop_bookmark, False): if getattr(context.scene, prop_bookmark, False):
return tool.Blender.is_tab(context, "BOOKMARK") return tool.Blender.is_tab(context, "BOOKMARK")
return tool.Blender.is_tab(context, next((tab for tab, panels in TAB_PANELS.items() if cls.bl_idname in panels), "BOOKMARK")) return tool.Blender.is_tab(context, next((k for k, v in TAB_PANELS.items() if any(p.get("bl_idname") == cls.bl_idname for p in v)), "BOOKMARK"))
def draw(self, context): def draw(self, context):
pass pass