Why gives an error on bpy.ops.uv.snap_cursor(target='SELECTED') ?
Asked
Active
Viewed 56 times
1 Answers
2
First you have to find the UV editor area that interests you. This will apply the operator in the first visible UV editor it finds:
>>> imgeds = [a for a in C.window_manager.windows[0].screen.areas if a.type == 'IMAGE_EDITOR']
>>> uved = next(i for i in imgeds if [s for s in i.spaces if s.mode=='UV'])
>>> bpy.ops.uv.snap_cursor({'area': uved}, target='SELECTED')
Markus von Broady
- 36,563
- 3
- 30
- 99


Cis an alias forbpy.context. You can create such an alias in a script byC = bpy.contextorfrom bpy import context as C– Markus von Broady Nov 29 '21 at 18:14