File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -149,12 +149,18 @@ def execute(self, context):
149
149
if area .type == 'VIEW_3D' :
150
150
for region in area .regions :
151
151
if region .type == 'WINDOW' :
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 ()
152
+ try :
153
+ # Since Blender 3.2:
154
+ context = bpy .context .copy ()
155
+ context ['area' ] = area
156
+ context ['region' ] = region
157
+ context ['edit_object' ] = bpy .context .edit_object
158
+ with bpy .context .temp_override (** context ):
159
+ bpy .ops .view3d .view_selected ()
160
+ except AttributeError : # temp_override doesn't exist before Blender 3.2.
161
+ # Before Blender 3.2:
162
+ override = {'area' : area , 'region' : region , 'edit_object' : bpy .context .edit_object }
163
+ bpy .ops .view3d .view_selected (override )
158
164
159
165
log .info (f"Imported { self .num_loaded } objects from 3MF files." )
160
166
You can’t perform that action at this time.
0 commit comments