From 538365885be8f14a11eb732d233ab2eeb8a4003d Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 5 Dec 2024 17:22:24 +0500 Subject: [PATCH] Hide output path for ifcpatch without output #4721 --- src/bonsai/bonsai/bim/module/patch/operator.py | 3 ++- src/bonsai/bonsai/bim/module/patch/ui.py | 7 ++++--- src/bonsai/bonsai/tool/patch.py | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/patch/operator.py b/src/bonsai/bonsai/bim/module/patch/operator.py index 22db743e9e..30014df816 100644 --- a/src/bonsai/bonsai/bim/module/patch/operator.py +++ b/src/bonsai/bonsai/bim/module/patch/operator.py @@ -105,7 +105,8 @@ class ExecuteIfcPatch(bpy.types.Operator): "log": os.path.join(context.scene.BIMProperties.data_dir, "process.log"), } ) - ifcpatch.write(output, ifc_patch_output) + if tool.Patch.does_patch_has_output(props.ifc_patch_recipes): + ifcpatch.write(output, ifc_patch_output) self.report({"INFO"}, f"{props.ifc_patch_recipes} patch executed successfully") return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/patch/ui.py b/src/bonsai/bonsai/bim/module/patch/ui.py index e50b35e8fa..7f0435a17b 100644 --- a/src/bonsai/bonsai/bim/module/patch/ui.py +++ b/src/bonsai/bonsai/bim/module/patch/ui.py @@ -50,9 +50,10 @@ class BIM_PT_patch(bpy.types.Panel): row.prop(props, "ifc_patch_input") row.operator("bim.select_ifc_patch_input", icon="FILE_FOLDER", text="") - row = layout.row(align=True) - row.prop(props, "ifc_patch_output") - row.operator("bim.select_ifc_patch_output", icon="FILE_FOLDER", text="") + if tool.Patch.does_patch_has_output(props.ifc_patch_recipes): + row = layout.row(align=True) + row.prop(props, "ifc_patch_output") + row.operator("bim.select_ifc_patch_output", icon="FILE_FOLDER", text="") if props.ifc_patch_args_attr: draw_attributes(props.ifc_patch_args_attr, layout) diff --git a/src/bonsai/bonsai/tool/patch.py b/src/bonsai/bonsai/tool/patch.py index 3c6502d08f..33c8142210 100644 --- a/src/bonsai/bonsai/tool/patch.py +++ b/src/bonsai/bonsai/tool/patch.py @@ -36,3 +36,7 @@ class Patch(bonsai.core.tool.Patch): # Should mark them as such in the patches documentation # and process it later. return recipe == "SplitByBuildingStorey" and arg_name == "output_dir" + + @classmethod + def does_patch_has_output(cls, recipe: str) -> bool: + return recipe != "SplitByBuildingStorey"