mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 14:31:39 +00:00
Move code using ui index from data to ui #4028
As UI indices changes doesn't trigger data.py updates and information on screen is not synced with the active item anymore.
This commit is contained in:
@@ -101,8 +101,6 @@ class RepresentationItemsData:
|
|||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {
|
cls.data = {
|
||||||
"total_items": cls.total_items(),
|
"total_items": cls.total_items(),
|
||||||
"active_surface_style": cls.active_surface_style(),
|
|
||||||
"active_layer": cls.active_layer(),
|
|
||||||
}
|
}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
@@ -124,18 +122,6 @@ class RepresentationItemsData:
|
|||||||
result += 1
|
result += 1
|
||||||
return result
|
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:
|
class ConnectionsData:
|
||||||
data = {}
|
data = {}
|
||||||
|
|||||||
@@ -181,17 +181,21 @@ class BIM_PT_representation_items(Panel):
|
|||||||
|
|
||||||
self.layout.template_list("BIM_UL_representation_items", "", props, "items", props, "active_item_index")
|
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()
|
row = self.layout.row()
|
||||||
if RepresentationItemsData.data["active_surface_style"]:
|
if surface_style:
|
||||||
row.label(text=RepresentationItemsData.data["active_surface_style"], icon="MATERIAL")
|
row.label(text=surface_style, icon="MATERIAL")
|
||||||
else:
|
else:
|
||||||
row.label(text="No Surface Style", icon="MESH_UVSPHERE")
|
row.label(text="No Surface Style", icon="MESH_UVSPHERE")
|
||||||
|
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
if RepresentationItemsData.data["active_layer"]:
|
row.label(text=presentation_layer or "No Presentation Layer", icon="STICKY_UVS_LOC")
|
||||||
row.label(text=RepresentationItemsData.data["active_layer"], icon="STICKY_UVS_LOC")
|
|
||||||
else:
|
|
||||||
row.label(text="No Presentation Layer", icon="STICKY_UVS_LOC")
|
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_connections(Panel):
|
class BIM_PT_connections(Panel):
|
||||||
|
|||||||
Reference in New Issue
Block a user