Reuse ImportHelper/ExportHelper everywhere possible for consistency

This commit is contained in:
Andrej730
2025-03-24 16:30:53 +05:00
parent 4f091af935
commit 4594f596c2
19 changed files with 118 additions and 315 deletions
+3 -6
View File
@@ -32,6 +32,7 @@ import importlib
import logging
import types
import bpy
from bpy_extras.io_utils import ExportHelper
logger = logging.getLogger("sverchok.ifc")
@@ -180,15 +181,15 @@ class IFC_Sv_UpdateCurrent(bpy.types.Operator):
return {"FINISHED"}
class IFC_Sv_write_file(bpy.types.Operator):
class IFC_Sv_write_file(bpy.types.Operator, ExportHelper):
bl_idname = "ifc.write_file_panel"
bl_label = "Write File"
bl_options = {"REGISTER", "UNDO"}
bl_description = "Save transient IFC file to the provided path."
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
filter_glob: bpy.props.StringProperty(default="*.ifc", options={"HIDDEN"})
node_group: bpy.props.StringProperty(default="")
force_mode: bpy.props.BoolProperty(default=False)
filename_ext = ".ifc"
@classmethod
def poll(cls, context):
@@ -264,10 +265,6 @@ class IFC_Sv_write_file(bpy.types.Operator):
self.report({"INFO"}, f"File written to: {self.filepath}")
return {"FINISHED"}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {"RUNNING_MODAL"}
class IFC_PT_write_file_panel(bpy.types.Panel):
bl_idname = "IFC_PT_write_file_panel"