NMesh.update() removes all materials from a mesh. Setting the materials with Object.setMaterials(…) after an .update() has no effect.
The question remains: how does one preserve an object’s materials when its mesh is being updated by python ?
To answer my question:
Object.setMaterials() doesn’t do anything. You have to use the NMesh.materials member variable:
myMesh.materials = myListOfMaterials
If you set this variable after a mesh.update() your materials are preserved.
But, Blender crashes sometimes on my setup (2.32 WinXP) when I do this.