mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
display active representation presentation layer in UI
example - https://i.imgur.com/mpnoqPH.png
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user