Error 31 while importing GLTF with no faces, just edges and vertices

Godot Version

4.6

Question

I have gltf model exported from Blender. Its very simple. Just plane without face. Only edges and vertices. I am coding tool in Godot to open gltf which contains only edges and verteces, but when I try to open it, it gives me error 31.

var mesh = node.mesh
  if mesh:
    for surface_idx in range(mesh.get_surface_count()):
      var mdt = MeshDataTool.new()
      var err = mdt.create_from_surface(mesh, surface_idx)
      if err != OK:
        print("Failed to create MeshDataTool from surface %d: %s" % [surface_idx, err])
        continue

Console output

Failed to create MeshDataTool from surface 0: 31

A mesh with no faces has no surface. The MeshDataTool needs more data. You need beside the vertices an array with the indices of the faces. They define how the faces should be drawn.
In your case the get_surface_count()has a result of 0.

Nope. get_surface_count has result of 1.

get_surface_count does not count faces; it counts how many materials are used. So in my case, 1 default for the whole geometry.

Doesn’t make sense to me, but ok.
AFAIK the Meshtool need arrays for vertices and indices for the faces. It can’t build surfaces just out of a point cloud. The edges have no meaning in this case.

There you want to create the surface, for that you’ll need vertices and indices for the triangles. I don’t see where the SurfaceTool could get the index array for the faces from, in your case.

I understand. There is a simple solution to get arrays, which doesn’t give an error. But I need to get edges list from my mesh, and that solution doesn’t allow do that.