Bonsai - fix issues with default ifcpatch recipe is not loading properly #5540

This commit is contained in:
Andrej730
2024-10-04 17:30:23 +05:00
parent dc63e989d6
commit 8aa1b68d3e
2 changed files with 7 additions and 0 deletions
@@ -67,6 +67,9 @@ class ExecuteIfcPatch(bpy.types.Operator):
@classmethod
def poll(cls, context):
props = context.scene.BIMPatchProperties
if props.ifc_patch_recipes == "-":
cls.poll_message_set("No recipe selected.")
return False
if not props.should_load_from_memory and not props.ifc_patch_input:
cls.poll_message_set("Select an IFC file or use 'load from memory' if it's loaded in Bonsai.")
return False
@@ -47,6 +47,10 @@ def get_ifcpatch_recipes(self, context):
global ifcpatchrecipes_enum
if len(ifcpatchrecipes_enum) < 1:
ifcpatchrecipes_enum.clear()
# Have to add a blank entry because otherwise default recipe might be not loaded
# properly (need to ensure bim.update_ifc_patch_arguments will be called). See #5540.
ifcpatchrecipes_enum.append(("-", "-", ""))
ifcpatch_path = Path(importlib.util.find_spec("ifcpatch").submodule_search_locations[0])
for filename in ifcpatch_path.joinpath("recipes").glob("*.py"):
f = str(filename.stem)