vertex weigths onto a generated mesh
Animation Nodes doesn't have a node that can write vertex weights yet. So we will have to use some python to implement that ourselves. Given an object obj with a vertex group vertGroup and a float list weights containing the weights for each vertex, one can use this expression to set the vertex weights:

[obj.vertex_groups["vertGroup"].add([i], w, 'REPLACE') for i, w, in enumerate(weights)]




It is essential that the input object of the expression node be the output of the node used to set the mesh, this ensures the vertex weights to be set after the mesh is set.

Now, if you want to paint the weights by hand and have it preserved even when you are resetting the mesh each execution, you can do the following:


Disable the Mesh Object Output node temporarily.
Paint the weights.
Cache the output of the Vertex Group Input node (caching is described in the documentation here)
Enabled the Mesh Object Output node and use the cache in the node tree we described above.