mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Fix drawing activation if drawing properties are using temp window #5791
This commit is contained in:
@@ -285,9 +285,19 @@ class Blender(bonsai.core.tool.Blender):
|
||||
when in real life you can have a couple of those but should work for the most cases.
|
||||
"""
|
||||
area = cls.get_view3d_area()
|
||||
assert area
|
||||
region = next(region for region in area.regions if region.type == "WINDOW")
|
||||
space = next(space for space in area.spaces if space.type == "VIEW_3D")
|
||||
context_override = {"area": area, "region": region, "space_data": space}
|
||||
|
||||
# Need to override screen and window if area is from a different window.
|
||||
screen: bpy.types.Scene = area.id_data
|
||||
context = bpy.context
|
||||
assert context
|
||||
if context.screen != screen:
|
||||
context_override["screen"] = screen
|
||||
window = next(window for window in context.window_manager.windows if window.screen == screen)
|
||||
context_override["window"] = window
|
||||
return context_override
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -1889,7 +1889,7 @@ class Drawing(bonsai.core.tool.Drawing):
|
||||
subcontexts.append(context_filter)
|
||||
|
||||
# Hide everything first, then selectively show. This is significantly faster.
|
||||
with bpy.context.temp_override(area=next(a for a in bpy.context.screen.areas if a.type == "VIEW_3D")):
|
||||
with bpy.context.temp_override(**tool.Blender.get_viewport_context()):
|
||||
bpy.ops.object.hide_view_set(unselected=False)
|
||||
bpy.ops.object.hide_view_set(unselected=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user