Show warning if a blend file is used alongside an ifc

This commit is contained in:
Dion Moult
2024-08-02 15:54:15 +10:00
parent a31051a937
commit ff44f4f395
5 changed files with 29 additions and 0 deletions
@@ -103,6 +103,7 @@ classes = [
operator.BIM_OT_show_description,
operator.BIM_OT_multiple_file_selector,
operator.ClippingPlaneCutWithCappings,
operator.CloseBlendWarning,
operator.CloseError,
operator.EditBlenderCollection,
operator.FileAssociate,
+3
View File
@@ -304,3 +304,6 @@ def load_post(scene):
continue
tool.Blender.override_scene_panel(panel)
tool.Blender.setup_tabs()
if tool.Ifc.get() and bpy.data.is_saved:
bpy.context.scene.BIMProperties.has_blend_warning = True
@@ -128,6 +128,15 @@ class BIM_PT_project(Panel):
if pprops.is_loading:
self.draw_advanced_loading_ui(context)
elif self.file or props.ifc_file:
if props.has_blend_warning:
box = self.layout.box()
box.alert = True
row = box.row(align=True)
row.label(text="Your Model May Be Outdated", icon="ERROR")
op = row.operator("bim.open_uri", text="", icon="QUESTION")
op.uri = "https://docs.blenderbim.org/users/troubleshooting.html#saving-and-loading-blend-files"
row.operator("bim.close_blend_warning", text="", icon="CANCEL")
if props.ifc_file:
self.draw_loaded_project_ui(context)
else:
+15
View File
@@ -106,6 +106,21 @@ class CloseError(bpy.types.Operator):
return context.window_manager.invoke_props_dialog(self)
class CloseBlendWarning(bpy.types.Operator):
bl_idname = "bim.close_blend_warning"
bl_label = "Close Blend Warning"
def execute(self, context):
bpy.context.scene.BIMProperties.has_blend_warning = False
return {"FINISHED"}
def draw(self, context):
self.layout.label(text="Warning: you may experience errors. Really continue?")
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)
class SelectURIAttribute(bpy.types.Operator):
bl_idname = "bim.select_uri_attribute"
bl_label = "Select URI Attribute"
+1
View File
@@ -385,6 +385,7 @@ class BIMProperties(PropertyGroup):
data_dir: StringProperty(
default=os.path.join(cwd, "data") + os.path.sep, name="Data Directory", update=update_data_dir
)
has_blend_warning: BoolProperty(name="Has Blend Warning", default=False)
pset_dir: StringProperty(default=os.path.join("psets") + os.path.sep, name="Default Psets Directory")
ifc_file: StringProperty(name="IFC File", update=update_ifc_file)
last_transaction: StringProperty(name="Last Transaction")