display active representation presentation layer in UI

example - https://i.imgur.com/mpnoqPH.png
This commit is contained in:
Andrej730
2024-01-30 12:06:19 +05:00
parent bd64f42a54
commit 799658ff41
3 changed files with 17 additions and 2 deletions
@@ -29,6 +29,7 @@ from blenderbim.bim.module.geometry.data import (
PlacementData,
DerivedCoordinatesData,
)
from blenderbim.bim.module.layer.data import LayersData
def mode_menu(self, context):
@@ -133,6 +134,7 @@ class BIM_PT_representations(Panel):
if not RepresentationsData.data["representations"]:
layout.label(text="No Representations Found")
return
for representation in RepresentationsData.data["representations"]:
row = self.layout.row(align=True)
@@ -150,6 +152,18 @@ class BIM_PT_representations(Panel):
op.ifc_definition_id = representation["id"]
op.disable_opening_subtractions = False
row.operator("bim.remove_representation", icon="X", text="").representation_id = representation["id"]
if representation["is_active"]:
active_representation = representation
layout.separator()
if not LayersData.is_loaded:
LayersData.load()
if LayersData.data["active_layers"]:
layout.label(text="Active Representation Presentation Layers:")
for layer_name in LayersData.data["active_layers"].values():
layout.label(text=layer_name, icon="STICKY_UVS_LOC")
else:
layout.label(text="Active Representation Has No Presentation Layers", icon="STICKY_UVS_LOC")
class BIM_PT_representation_items(Panel):
@@ -47,8 +47,8 @@ class LayersData:
return []
if not isinstance(data, bpy.types.Mesh) or not data.BIMMeshProperties.ifc_definition_id:
return []
results = []
results = dict()
shape = tool.Ifc.get().by_id(data.BIMMeshProperties.ifc_definition_id)
for inverse in shape.LayerAssignments:
results.append(inverse.id())
results[inverse.id()] = inverse.Name or "Unnamed"
return results
@@ -84,6 +84,7 @@ class BIM_UL_layers(UIList):
op = row.operator("bim.assign_presentation_layer", text="", icon="KEYFRAME", emboss=False)
op.layer = item.ifc_definition_id
# TODO: replace placeholder UI for hiding presentation layers
row.operator("bim.disable_editing_layer", text="", icon="HIDE_OFF", emboss=False)
row.operator("bim.disable_editing_layer", text="", icon="FREEZE", emboss=False)