Explorer UI - add is_loaded toggle

This commit is contained in:
Andrej730
2025-07-07 18:00:42 +05:00
parent fca2bf7aa8
commit 525ef2b77b
2 changed files with 30 additions and 1 deletions
@@ -50,6 +50,23 @@ class ExplorerEntity(PropertyGroup):
class BIMExplorerProperties(PropertyGroup):
def update_is_loaded(self, context: object) -> None:
if self.is_loaded:
# Trigger refresh.
self.ifc_class = self.ifc_class
else:
self.property_unset("is_loaded")
self.property_unset("ifc_class")
self.entities.clear()
self.property_unset("active_entity_index")
self.property_unset("editing_entity_id")
self.entity_attributes.clear()
is_loaded: BoolProperty( # pyright: ignore[reportRedeclaration]
name="Toggle Explorer UI",
update=update_is_loaded,
)
def get_ifc_class(self, context: object) -> tool.Blender.BLENDER_ENUM_ITEMS:
# TODO: Add more entities.
classes = [
@@ -72,6 +89,7 @@ class BIMExplorerProperties(PropertyGroup):
entity_attributes: CollectionProperty(type=Attribute) # pyright: ignore[reportRedeclaration]
if TYPE_CHECKING:
is_loaded: bool
ifc_class: str
entities: bpy.types.bpy_prop_collection_idprop[ExplorerEntity]
active_entity_index: int
+12 -1
View File
@@ -85,11 +85,22 @@ class BIM_PT_explorer(Panel):
def draw(self, context):
assert (layout := self.layout)
props = tool.Attribute.get_explorer_props()
if not props.is_loaded:
row = layout.row(align=True)
row.label(text="Explorer UI is not Loaded.")
row.prop(props, "is_loaded", text="", icon="IMPORT")
return
active_entity = props.active_entity
layout.prop(props, "ifc_class", text="")
row = layout.row(align=True)
row.prop(props, "ifc_class", text="")
row.prop(props, "is_loaded", text="", icon="CANCEL")
row = layout.row(align=True)
row.label(text=f"{len(props.entities)} entities found")
row.operator("bim.explorer_add_entity", text="", icon="ADD")
if active_entity:
if active_entity.ifc_definition_id == props.editing_entity_id: