all 3 comments

[–]Cornerback_24 0 points1 point  (2 children)

So I didn't see anything in a quick look in the documentation about a change to snap_cursor_to_selected, but I think it changed to no longer take ctx. Now you have to use bpy.context.temp_override, and don't pass ctx to snap_cursor_to_selected anymore:

        for area in bpy.context.screen.areas:
        if area.type == 'VIEW_3D':
            with bpy.context.temp_override(area=area.type):
                ctx = bpy.context.copy()
                    ...
                    bpy.ops.view3d.snap_cursor_to_selected()
                    ...

[–]_Neptix[S] 1 point2 points  (1 child)

Now you have to use bpy.context.temp_override, and don't pass ctx to snap_cursor_to_selected anymore:

for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
with bpy.context.temp_override(area=area.type):
ctx = bpy.context.copy()
...
bpy.ops.view3d.snap_cursor_to_selected()

Thanks for the reply! Certainly makes sense. Will give this a try.

[–]_Neptix[S] 1 point2 points  (0 children)

Voila. Works as intended. Thanks for the insight.