mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Indicate that Blender needs a restart if BBIM was reinstalled
Example - https://i.imgur.com/lbP4PqO.png
This commit is contained in:
@@ -51,9 +51,14 @@ def get_last_commit_hash() -> Union[str, None]:
|
||||
return last_commit_hash[:7]
|
||||
|
||||
|
||||
# Accessed from blenderbim extension:
|
||||
bbim_semver: dict[str, Any] = {}
|
||||
|
||||
# Accessed from blenderbim dependency:
|
||||
last_error = None
|
||||
last_actions: deque = deque(maxlen=10)
|
||||
bbim_semver: dict[str, Any] = {}
|
||||
FIRST_INSTALLED_BBIM_VERSION: Union[str, None] = None
|
||||
REINSTALLED_BBIM_VERSION: Union[str, None] = None
|
||||
|
||||
|
||||
def initialize_bbim_semver():
|
||||
@@ -237,6 +242,12 @@ if IN_BLENDER:
|
||||
|
||||
import blenderbim.bim
|
||||
|
||||
current_version = bbim_semver["version"]
|
||||
if blenderbim.FIRST_INSTALLED_BBIM_VERSION is None:
|
||||
blenderbim.FIRST_INSTALLED_BBIM_VERSION = current_version
|
||||
elif not blenderbim.REINSTALLED_BBIM_VERSION and blenderbim.FIRST_INSTALLED_BBIM_VERSION != current_version:
|
||||
blenderbim.REINSTALLED_BBIM_VERSION = current_version
|
||||
|
||||
blenderbim.bim.register()
|
||||
|
||||
def unregister():
|
||||
|
||||
@@ -775,6 +775,7 @@ class ToggleDetailedIOSLogs(bpy.types.Operator):
|
||||
class RestartBlender(bpy.types.Operator):
|
||||
bl_idname = "bim.restart_blender"
|
||||
bl_label = "Restart Blender"
|
||||
bl_description = "Blender will be immediately restarted, save your data first before running this operator"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
@@ -434,11 +434,21 @@ class BIM_PT_tabs(Panel):
|
||||
row = self.layout.row(align=True)
|
||||
row.prop(aprops, "tab", text="")
|
||||
|
||||
if blenderbim.REINSTALLED_BBIM_VERSION:
|
||||
box = self.layout.box()
|
||||
box.alert = True
|
||||
|
||||
box.label(text="BlenderBIM requires Blender to restart.", icon="ERROR")
|
||||
box.label(text="BlenderBIM was reinstalled in the current session:")
|
||||
box.label(text=f"{blenderbim.FIRST_INSTALLED_BBIM_VERSION} -> {blenderbim.REINSTALLED_BBIM_VERSION}")
|
||||
box.label(text="Please restart Blender to avoid potential issues.")
|
||||
box.operator("bim.restart_blender", text="Restart Blender", icon="BLENDER")
|
||||
|
||||
if blenderbim.last_error:
|
||||
box = self.layout.box()
|
||||
box.alert = True
|
||||
row = box.row(align=True)
|
||||
row.label(text="BlenderBIM experienced an error :(", icon="ERROR")
|
||||
box.label(text="BlenderBIM experienced an error :(", icon="ERROR")
|
||||
row.operator("bim.close_error", text="", icon="CANCEL")
|
||||
if platform.system() == "Windows":
|
||||
box.operator("wm.console_toggle", text="View the console for full logs.", icon="CONSOLE")
|
||||
@@ -692,6 +702,7 @@ class BIM_PT_tab_services(Panel):
|
||||
def draw(self, context):
|
||||
pass
|
||||
|
||||
|
||||
class BIM_PT_tab_lighting(Panel):
|
||||
bl_label = "Lighting"
|
||||
bl_space_type = "PROPERTIES"
|
||||
|
||||
Reference in New Issue
Block a user