Godot: MeshDataTool returns sometimes a single edge that belongs to a vertex.

Created on 29 Mar 2019  路  3Comments  路  Source: godotengine/godot

Godot version:

3.1 stable

OS/device including version:

Ubuntu 18.4

Issue description:

I imported a cube from blender and when I try to get the edges that belongs to a vertex with the MeshDataTool, some times I get a vertex with just one edge.
I believe that this is a bug. A vertex with one edge is nothing.

Steps to reproduce:

extends Spatial


func _ready():
    test($"Scene Root/Cube".mesh)
    pass # Replace with function body.

func test(mesh : Mesh):
    var mdt : MeshDataTool = MeshDataTool.new()
    mdt.create_from_surface(mesh, 0)

    for i in range(mdt.get_face_count()):
        for j in range(3): #Triangles
            var v = mdt.get_face_vertex(i, j)
            var e = mdt.get_vertex_edges(v)
            print(e)
    pass

Minimal reproduction project:

mesh_data_tool.zip

bug hero wanted! junior job core

Most helpful comment

Can I take this issue

All 3 comments

MeshDataTool is here:
https://github.com/godotengine/godot/blob/master/scene/resources/mesh_data_tool.h
probably a bug in geometry generation

Can I take this issue

Problem description:
The original code only adds an edge in one direction for each vertex. For example, the pic below shows two triangles, and the edge of each vertex(a, b, c, d) will be:

a->edges = {1, 3}
b->edges = {2}
c->edges = {3, 4}
d->edges = {5}

demo
The correct output should be:

a->edges = {1, 3, 5}
b->edges = {1, 2}
c->edges = {2, 3, 4}
d->edges = {4, 5}

Check my pull request for modification.

Was this page helpful?
0 / 5 - 0 ratings