diff --git a/src/blenderbim/blenderbim/bim/module/geometry/data.py b/src/blenderbim/blenderbim/bim/module/geometry/data.py index d1e3b7fa1e..0b9fadd28e 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/data.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/data.py @@ -101,8 +101,6 @@ class RepresentationItemsData: def load(cls): cls.data = { "total_items": cls.total_items(), - "active_surface_style": cls.active_surface_style(), - "active_layer": cls.active_layer(), } cls.is_loaded = True @@ -124,18 +122,6 @@ class RepresentationItemsData: result += 1 return result - @classmethod - def active_surface_style(cls): - props = bpy.context.active_object.BIMGeometryProperties - if props.active_item_index < len(props.items): - return props.items[props.active_item_index].surface_style - - @classmethod - def active_layer(cls): - props = bpy.context.active_object.BIMGeometryProperties - if props.active_item_index < len(props.items): - return props.items[props.active_item_index].layer - class ConnectionsData: data = {} diff --git a/src/blenderbim/blenderbim/bim/module/geometry/ui.py b/src/blenderbim/blenderbim/bim/module/geometry/ui.py index 53c65b3b28..6650bb0360 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/ui.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/ui.py @@ -181,17 +181,21 @@ class BIM_PT_representation_items(Panel): self.layout.template_list("BIM_UL_representation_items", "", props, "items", props, "active_item_index") + item_is_active = props.active_item_index < len(props.items) + if item_is_active: + surface_style = props.items[props.active_item_index].surface_style + presentation_layer = props.items[props.active_item_index].layer + else: + surface_style, presentation_layer = None, None + row = self.layout.row() - if RepresentationItemsData.data["active_surface_style"]: - row.label(text=RepresentationItemsData.data["active_surface_style"], icon="MATERIAL") + if surface_style: + row.label(text=surface_style, icon="MATERIAL") else: row.label(text="No Surface Style", icon="MESH_UVSPHERE") row = self.layout.row() - if RepresentationItemsData.data["active_layer"]: - row.label(text=RepresentationItemsData.data["active_layer"], icon="STICKY_UVS_LOC") - else: - row.label(text="No Presentation Layer", icon="STICKY_UVS_LOC") + row.label(text=presentation_layer or "No Presentation Layer", icon="STICKY_UVS_LOC") class BIM_PT_connections(Panel):