From ac0b5abfc5818c3b08d6bfc6df296d873369a668 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 18 Jun 2024 12:51:14 +1000 Subject: [PATCH] You can now choose whether to use a cache / force reload a linked model --- src/blenderbim/blenderbim/bim/module/project/operator.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/project/operator.py b/src/blenderbim/blenderbim/bim/module/project/operator.py index 02f241ccd2..3b5da02691 100644 --- a/src/blenderbim/blenderbim/bim/module/project/operator.py +++ b/src/blenderbim/blenderbim/bim/module/project/operator.py @@ -856,12 +856,15 @@ class LinkIfc(bpy.types.Operator): directory: bpy.props.StringProperty(subtype="DIR_PATH") filter_glob: bpy.props.StringProperty(default="*.ifc", options={"HIDDEN"}) use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False) + use_cache: bpy.props.BoolProperty(name="Use Cache", default=True) def draw(self, context): pprops = context.scene.BIMProjectProperties row = self.layout.row() row.prop(self, "use_relative_path") row = self.layout.row() + row.prop(self, "use_cache") + row = self.layout.row() row.prop(pprops, "false_origin_mode") if pprops.false_origin_mode == "MANUAL": row = self.layout.row() @@ -882,7 +885,7 @@ class LinkIfc(bpy.types.Operator): except: pass # Perhaps on another drive or something new.name = filepath - status = bpy.ops.bim.load_link(filepath=filepath) + status = bpy.ops.bim.load_link(filepath=filepath, use_cache=self.use_cache) if status == {"CANCELLED"}: error_msg = ( f'Error processing IFC file "{self.filepath}" ' @@ -960,6 +963,7 @@ class LoadLink(bpy.types.Operator): bl_options = {"REGISTER", "UNDO"} bl_description = "Load the selected file" filepath: bpy.props.StringProperty() + use_cache: bpy.props.BoolProperty(name="Use Cache", default=True) def execute(self, context): self.filepath = self.filepath.replace("\\", "/") @@ -991,6 +995,9 @@ class LoadLink(bpy.types.Operator): blend_filepath = self.filepath + ".cache.blend" h5_filepath = self.filepath + ".cache.h5" + if not self.use_cache and os.path.exists(blend_filepath): + os.remove(blend_filepath) + if not os.path.exists(blend_filepath): pprops = bpy.context.scene.BIMProjectProperties gprops = bpy.context.scene.BIMGeoreferenceProperties