# Set Animation Nodes to work with animated baking

I am not able to bake texture sequences with AN generated mesh (like Dynamic Paint or Animated Render baker add-on). It looses vital data on frame change, thus confusing baking.

I tried to use expressions to hold proper UV map for the full timeline:

bpy.data.meshes["Mesh"].uv_textures.active_index = 1


and

bpy.data.meshes["Mesh"].uv_textures["UVMap.001"].active_render = True


But this is not enough, blank Image doesn't associate with UV layer after frame has changed (checked it after re-entering Edit mode).

So, is there any way to make it work, or exporting meshcache is the only option for this?

• Do you set UV Maps manually? Can you create a minimal working example and share its node tree? – Omar Emara Feb 27 '19 at 11:12
• Actually I've added a working example. If there is a better way, I'll wait for your answer, otherwise I'll accept this. – Serge L Feb 27 '19 at 11:32
• I am still not sure what the problem is, so I can't really add an answer. Make sure to add an answer if it works. – Omar Emara Feb 27 '19 at 11:45

Using this answer, I can make it work via Script node (UV input is a name of UV layer to bake to):

Script itself: (Assign_img.py)

import bpy

image = bpy.data.images["Untitled"]

Object.data.uv_textures[UV].active = True
Object.data.uv_textures[UV].active_render = True

for uv_face in Object.data.uv_textures[UV].data:
uv_face.image = image