Skip to content

Commit 4925630

Browse files
committed
Fix overriding context for viewing resulting loaded 3MF
Apparently this has changed with more recent Blender versions.
1 parent 7ee2581 commit 4925630

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

io_mesh_3mf/import_3mf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,12 @@ def execute(self, context):
149149
if area.type == 'VIEW_3D':
150150
for region in area.regions:
151151
if region.type == 'WINDOW':
152-
override = {'area': area, 'region': region, 'edit_object': bpy.context.edit_object}
153-
bpy.ops.view3d.view_selected(override)
152+
context = bpy.context.copy()
153+
context['area'] = area
154+
context['region'] = region
155+
context['edit_object'] = bpy.context.edit_object
156+
with bpy.context.temp_override(**context):
157+
bpy.ops.view3d.view_selected()
154158

155159
log.info(f"Imported {self.num_loaded} objects from 3MF files.")
156160

0 commit comments

Comments
 (0)