mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
SaveBlendMetadataFile to use IFC directory for temporary file path and fix panel visibility logic in UI
This commit is contained in:
@@ -260,10 +260,11 @@ class SaveBlendMetadataFile(bpy.types.Operator):
|
|||||||
self.report({"WARNING"}, "No IFC file path set.")
|
self.report({"WARNING"}, "No IFC file path set.")
|
||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
|
|
||||||
blendmetadata_path = ifc_file + ".metadata.blend"
|
blendmetadata_path = ifc_file + ".metadata.blend"
|
||||||
|
|
||||||
# Save a temporary copy of the current blend file
|
ifc_dir = os.path.dirname(ifc_file)
|
||||||
temp_path = bpy.path.abspath("//__temp_blendmetadata.blend")
|
temp_path = os.path.join(ifc_dir, "__temp_blendmetadata.blend")
|
||||||
bpy.ops.wm.save_as_mainfile(filepath=temp_path, copy=True)
|
bpy.ops.wm.save_as_mainfile(filepath=temp_path, copy=True)
|
||||||
|
|
||||||
cleanup_script = f"""
|
cleanup_script = f"""
|
||||||
|
|||||||
@@ -1633,6 +1633,8 @@ class BIM_PT_tab_representations(Panel):
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
||||||
return False
|
return False
|
||||||
|
if tool.Blender.is_tab(context, cls.bim_tab_name) and tool.Ifc.get():
|
||||||
|
return True
|
||||||
return tool.Blender.is_tab(context, "BOOKMARK")
|
return tool.Blender.is_tab(context, "BOOKMARK")
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -1675,6 +1677,8 @@ class BIM_PT_tab_parametric_geometry(Panel):
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
||||||
return False
|
return False
|
||||||
|
if tool.Blender.is_tab(context, cls.bim_tab_name) and tool.Ifc.get():
|
||||||
|
return True
|
||||||
return tool.Blender.is_tab(context, "BOOKMARK")
|
return tool.Blender.is_tab(context, "BOOKMARK")
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
@@ -1694,6 +1698,8 @@ class BIM_PT_tab_object_materials(Panel):
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
if not should_show_panel(cls.bl_idname, cls.bim_tab_name, context):
|
||||||
return False
|
return False
|
||||||
|
if tool.Blender.is_tab(context, cls.bim_tab_name) and tool.Ifc.get():
|
||||||
|
return True
|
||||||
return tool.Blender.is_tab(context, "BOOKMARK")
|
return tool.Blender.is_tab(context, "BOOKMARK")
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user