Blenderbim startup error handler - switch to scene properties

Noticed that by default Blender is using object properties (and users may have something else their startup file), so no we switch to the scene properties so they could see our error handler immediately.
This commit is contained in:
Andrej730
2024-07-19 14:23:02 +05:00
parent 4fdf8145f0
commit c25bb03a9c
+15
View File
@@ -164,6 +164,21 @@ if IN_BLENDER:
blenderbim.bim.unregister()
except:
def show_scene_properties() -> None:
# By default in Blender object properties are selected.
# Or user may have some other properties selected in their startup file.
# Select scene properties to ensure user will see our error handler.
for area in bpy.context.screen.areas:
if area.type != "PROPERTIES":
continue
space = area.spaces.active
assert isinstance(space, bpy.types.SpaceProperties)
space.context = "SCENE"
# Use a timer as we're not allowed to make changes to data during register().
bpy.app.timers.register(show_scene_properties, first_interval=0.1)
last_error = traceback.format_exc()
print(last_error)