clash ui - display "clashes are not loaded" to avoid confusion with "no clashes found"

Example - https://imgur.com/a/5a6cuEG
This commit is contained in:
Andrej730
2025-05-21 18:39:21 +05:00
parent 5bb769448d
commit 60c18628c5
3 changed files with 34 additions and 4 deletions
@@ -74,6 +74,12 @@ class Clash(PropertyGroup):
status: bool
def clashes_loaded_update(self: "ClashSet", context: bpy.types.Context) -> None:
if self.clashes_loaded:
return
tool.Clash.clear_active_clash_set_results()
class ClashSet(PropertyGroup):
mode: EnumProperty(
items=[
@@ -96,6 +102,11 @@ class ClashSet(PropertyGroup):
a: CollectionProperty(name="Group A", type=ClashSource)
b: CollectionProperty(name="Group B", type=ClashSource)
clashes: CollectionProperty(name="Clashes", type=Clash)
clashes_loaded: BoolProperty(
name="Clash Results Are Loaded",
description="Click to unload clash results for the clash set.",
update=clashes_loaded_update,
)
if TYPE_CHECKING:
mode: Literal["intersection", "collision", "clearance"]
@@ -106,6 +117,7 @@ class ClashSet(PropertyGroup):
a: bpy.types.bpy_prop_collection_idprop[ClashSource]
b: bpy.types.bpy_prop_collection_idprop[ClashSource]
clashes: bpy.types.bpy_prop_collection_idprop[Clash]
clashes_loaded: bool
def get_clash_sources_group(
self, group: tool.Clash.ClashSourceGroup
+11 -4
View File
@@ -145,11 +145,18 @@ class BIM_PT_ifcclash(Panel):
op.filepath = props.export_path
row = layout.row()
row.label(text=f"{len(clash_set.clashes)} Clashes Found", icon="PIVOT_CURSOR")
if clash_set.clashes_loaded:
row.column().label(text=f"{len(clash_set.clashes)} Clashes Found", icon="PIVOT_CURSOR")
layout.template_list("BIM_UL_clashes", "", props.active_clash_set, "clashes", props, "active_clash_index")
row = layout.row()
row.operator("bim.select_clash")
col = row.column()
col.alignment = "RIGHT"
col.prop(clash_set, "clashes_loaded", text="", icon="TRASH", invert_checkbox=True)
layout.template_list("BIM_UL_clashes", "", props.active_clash_set, "clashes", props, "active_clash_index")
row = layout.row()
row.operator("bim.select_clash")
else:
row.label(text="Clashes Are Not Loaded", icon="PIVOT_CURSOR")
class BIM_PT_clash_manager(Panel):
+11
View File
@@ -109,6 +109,17 @@ class Clash(bonsai.core.tool.Clash):
blender_clash.a_name = "{}/{}".format(clash["a_ifc_class"], clash["a_name"])
blender_clash.b_name = "{}/{}".format(clash["b_ifc_class"], clash["b_name"])
blender_clash.status = False if not "status" in clash else clash["status"]
clash_set.clashes_loaded = True
@classmethod
def clear_active_clash_set_results(cls) -> None:
props = cls.get_clash_props()
clash_set = props.active_clash_set
if not clash_set:
return
clash_set.clashes.clear()
if "clashes_loaded" in clash_set:
del clash_set["clashes_loaded"]
@classmethod
def load_clash_sets(cls, fn: str) -> None: