0

Why gives an error on bpy.ops.uv.snap_cursor(target='SELECTED') ?

enter image description here

enter image description here

tormozzzz
  • 27
  • 5

1 Answers1

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