I had the same issue when using the MeshDataTool to modify a mesh.
The problem is that the MeshDataTool does not generate the corresponding ArrayMesh.ARRAY_NORMAL
when creating the ArrayMesh.
The workaround I found is to recreate the mesh using the MeshDataTool faces and setting the normal for each vertex accordingly.
For example:
var vertices = PoolVector3Array()
var normals = PoolVector3Array()
var uvs = PoolVector2Array()
for face in meshData.get_face_count():
var normal = meshData.get_face_normal(face)
for vertex in range(0, 3):
var faceVertex = meshData.get_face_vertex(face, vertex)
vertices.push_back(meshData.get_vertex(faceVertex))
uvs.push_back(meshData.get_vertex_uv(faceVertex))
normals.push_back(normal)
var arrays = []
arrays.resize(ArrayMesh.ARRAY_MAX)
arrays[ArrayMesh.ARRAY_VERTEX] = vertices
arrays[ArrayMesh.ARRAY_NORMAL] = normals
arrays[ArrayMesh.ARRAY_TEX_UV] = uvs
var arr_mesh := ArrayMesh.new()
arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
self.mesh = arr_mesh
As you can see, the problem with this solution is that you need to re-create everything else the MeshDataTool preserves, such as the UVs.
Before:

After:

Be aware that Mesh.PRIMITIVE_TRIANGLES
and Mesh.PRIMITIVE_TRIANGLE_STRIP
behave different, since vertices (and their normals) are shared between faces for the latter. So make sure you're using the correct approach for your base mesh.
Another option would be to call set_vertex_normal
for each vertex in your MeshDataTool, but you'd have to figure out which normal to use if your base mesh uses PRIMITIVE_TRIANGLE_STRIP
as the primitive type, or you could get some weird results, like this:
for face in meshData.get_face_count():
# Set the face's normal as the normal for one of its points
var vertex = meshData.get_face_vertex(face, 0)
var normal = meshData.get_face_normal(face)
meshData.set_vertex_normal(vertex, normal)
Which results in:
