mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
Show warning if a blend file is used alongside an ifc
This commit is contained in:
@@ -103,6 +103,7 @@ classes = [
|
|||||||
operator.BIM_OT_show_description,
|
operator.BIM_OT_show_description,
|
||||||
operator.BIM_OT_multiple_file_selector,
|
operator.BIM_OT_multiple_file_selector,
|
||||||
operator.ClippingPlaneCutWithCappings,
|
operator.ClippingPlaneCutWithCappings,
|
||||||
|
operator.CloseBlendWarning,
|
||||||
operator.CloseError,
|
operator.CloseError,
|
||||||
operator.EditBlenderCollection,
|
operator.EditBlenderCollection,
|
||||||
operator.FileAssociate,
|
operator.FileAssociate,
|
||||||
|
|||||||
@@ -304,3 +304,6 @@ def load_post(scene):
|
|||||||
continue
|
continue
|
||||||
tool.Blender.override_scene_panel(panel)
|
tool.Blender.override_scene_panel(panel)
|
||||||
tool.Blender.setup_tabs()
|
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:
|
if pprops.is_loading:
|
||||||
self.draw_advanced_loading_ui(context)
|
self.draw_advanced_loading_ui(context)
|
||||||
elif self.file or props.ifc_file:
|
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:
|
if props.ifc_file:
|
||||||
self.draw_loaded_project_ui(context)
|
self.draw_loaded_project_ui(context)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -106,6 +106,21 @@ class CloseError(bpy.types.Operator):
|
|||||||
return context.window_manager.invoke_props_dialog(self)
|
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):
|
class SelectURIAttribute(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_uri_attribute"
|
bl_idname = "bim.select_uri_attribute"
|
||||||
bl_label = "Select URI Attribute"
|
bl_label = "Select URI Attribute"
|
||||||
|
|||||||
@@ -385,6 +385,7 @@ class BIMProperties(PropertyGroup):
|
|||||||
data_dir: StringProperty(
|
data_dir: StringProperty(
|
||||||
default=os.path.join(cwd, "data") + os.path.sep, name="Data Directory", update=update_data_dir
|
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")
|
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)
|
ifc_file: StringProperty(name="IFC File", update=update_ifc_file)
|
||||||
last_transaction: StringProperty(name="Last Transaction")
|
last_transaction: StringProperty(name="Last Transaction")
|
||||||
|
|||||||
Reference in New Issue
Block a user