I'm creating a node for Sverchok which will apply custom UV map to an object. Pretty simple thing but after applying new UV coordinates to an object object it doesn't update the viewer somehow. Switching to Edit Mode works but I'm sure there is a better way.

The problem can be reproduced this way:

  • Create a default plane and apply any material with a texture like this: enter image description here

  • then call the code for assigning new UV coordiantes:

import bpy
obj = bpy.context.active_object
new_uv = [(0.5, 0), (1, 0.5), (0.5, 1), (0, 0.5)]
obj.data.uv_layers['UVMap'].data.foreach_set("uv", [n for v in new_uv for n in v])
  • However, the changes are only applied when switching to Edit Mode: enter image description here

1 Answer 1


This is a simple fix - all you need to do is run the update() function on the object's mesh data: obj.data.update()

Depending on your intended use case, you may also need to run bpy.context.view_layer.depsgraph.update() to update the dependency graph.

  • $\begingroup$ Thank you so much. obj.data.update() is exactly what I needed to perfectly pair with bpy.context.view_layer.depsgraph.update(). Any reason you prefer it over bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)? $\endgroup$ Commented Apr 21 at 1:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .