you can now reload linked IFCs #3652

This commit is contained in:
Sigma Dimensions (Yass)
2023-08-27 18:21:19 +01:00
parent 1a8f2be4fd
commit 9944c7d2de
3 changed files with 20 additions and 0 deletions
@@ -47,6 +47,7 @@ classes = (
operator.UnlinkIfc,
operator.UnloadLink,
operator.UnloadProject,
operator.ReloadLink,
prop.LibraryElement,
prop.FilterCategory,
prop.Link,
@@ -880,6 +880,23 @@ class LoadLink(bpy.types.Operator):
return {"FINISHED"}
class ReloadLink(bpy.types.Operator):
bl_idname = "bim.reload_link"
bl_label = "Reload Link"
bl_options = {"REGISTER", "UNDO"}
bl_description = "Reload the selected file"
filepath: bpy.props.StringProperty()
def execute(self, context):
def get_linked_ifc():
selected_filename = os.path.basename(self.filepath)
return [c for c in bpy.data.collections if "IfcProject" in c.name and c.library and os.path.basename(c.library.filepath) == selected_filename]
for linked_ifc in get_linked_ifc:
linked_ifc.reload()
return {"FINISHED"}
class ToggleLinkSelectability(bpy.types.Operator):
bl_idname = "bim.toggle_link_selectability"
bl_label = "Toggle Link Selectability"
@@ -375,6 +375,8 @@ class BIM_UL_links(UIList):
op.mode = "VISIBLE"
op = row.operator("bim.unload_link", text="", icon="UNLINKED")
op.filepath = item.name
op = row.operator("bim.reload_link", text="", icon="FILE_REFRESH")
op.filepath = item.name
else:
row.prop(item, "name", text="")
op = row.operator("bim.load_link", text="", icon="LINKED")