should_load_from_memory related poll messages

This commit is contained in:
Andrej730
2024-09-05 15:18:59 +05:00
parent 7e5bd0ca83
commit 7782ab5479
5 changed files with 39 additions and 5 deletions
@@ -183,6 +183,14 @@ class ExportIfcCsv(bpy.types.Operator):
filename_ext = ".csv"
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
@classmethod
def poll(cls, context):
props = context.scene.CsvProperties
if not props.should_load_from_memory and not props.csv_ifc_file:
cls.poll_message_set("Select an IFC file or use 'load from memory' if it's loaded in Bonsai.")
return False
return True
def invoke(self, context, event):
props = context.scene.CsvProperties
if props.format == "web":
@@ -268,6 +276,14 @@ class ImportIfcCsv(bpy.types.Operator):
filter_glob: bpy.props.StringProperty(default="*.csv;*.ods;*.xlsx", options={"HIDDEN"})
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
@classmethod
def poll(cls, context):
props = context.scene.CsvProperties
if not props.should_load_from_memory and not props.csv_ifc_file:
cls.poll_message_set("Select an IFC file or use 'load from memory' if it's loaded in Bonsai.")
return False
return True
def invoke(self, context, event):
self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".csv")
WindowManager = context.window_manager
+4 -1
View File
@@ -36,7 +36,10 @@ class ExecuteIfcFM(bpy.types.Operator):
@classmethod
def poll(cls, context):
props = context.scene.BIMFMProperties
return props.should_load_from_memory or props.ifc_files.single_file
if not props.should_load_from_memory and not props.ifc_files.single_file:
cls.poll_message_set("Select an IFC file or use 'load from memory' if it's loaded in Bonsai.")
return False
return True
def invoke(self, context, event):
props = context.scene.BIMFMProperties
@@ -54,8 +54,15 @@ class ExportOBJ(bpy.types.Operator):
bl_label = "Export"
bl_description = "Export the IFC to OBJ"
def execute(self, context):
@classmethod
def poll(cls, context):
props = context.scene.radiance_exporter_properties
if not props.should_load_from_memory and not props.ifc_file:
cls.poll_message_set("Select an IFC file or use 'load from memory' if it's loaded in Bonsai.")
return False
return True
def execute(self, context):
# Get the output directory
should_load_from_memory = context.scene.radiance_exporter_properties.should_load_from_memory
output_dir = context.scene.radiance_exporter_properties.output_dir
@@ -70,8 +70,11 @@ class ExecuteIfcPatch(bpy.types.Operator):
@classmethod
def poll(cls, context):
input_file = context.scene.BIMPatchProperties.ifc_patch_input
return input_file or context.scene.BIMPatchProperties.should_load_from_memory
props = context.scene.BIMPatchProperties
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
return True
def execute(self, context):
props = context.scene.BIMPatchProperties
@@ -37,7 +37,12 @@ class ExecuteIfcTester(bpy.types.Operator, tool.Ifc.Operator):
@classmethod
def poll(cls, context):
props = context.scene.IfcTesterProperties
return (props.ifc_files.single_file or props.should_load_from_memory) and props.specs
if not props.should_load_from_memory and not props.ifc_files.single_file:
cls.poll_message_set("Select an IFC file or use 'load from memory' if it's loaded in Bonsai.")
return False
if not props.specs:
return False
return True
def execute(self, context):
props = context.scene.IfcTesterProperties