CoDEmanX/blender-cod

Followup-error issue #4: Vertex index out of range (bad vert reference in face section)

GoogleCodeExporter opened this issue · 3 comments

Vertex index out of range error might occur under certain circumstances. 
Appears to be a possible followup-error of out-of-sync error.

Conditions unknown, perhaps connected verts, which make up edges, but not 
faces? Or simply vertices in same spot --> Remove doubles seems to fix the 
error.

Fix for issue #4 doesn't validate face references to vertex indices, remapping 
could fix it. But is it needed?

Original issue reported on code.google.com by codem...@gmx.de on 25 Jan 2012 at 10:41

Serthy:

found the way to fix that issue (Blender 2.59):
- in edit mode highlight the vertex-select mode
- select all (A)
- change from the vertex-select mode to the mesh-select mode
- change back to the vertex-select mode
- press Ctrl + i to invert your selection (now all unbound vertices should be 
highlighted)
- delete them
- deselect all (A)
- still in edit mode go with your mouse over your model-mesh
- press L to select the face
- press Ctrl + i to invert your selection (now all unbound vertices should be 
highlighted)
- delete them
- select all (A)
- hit W ~> remove doubles
- save

this way all unbound vertices should be removed

Source: http://modsonline.com/Forums-top-153410-10.html#755453

Original comment by codem...@gmx.de on 16 Feb 2012 at 5:44

Temporary (?) fix:

comment out the vertex uniquify code and use the verts as supplied by Blender, 
around line 222 in xmodel_export.py:

`
        # Retrieve verts which belong to a face only
        # As len(mesh.vertices) doesn't take unused verts into account, already count here
        """
        verts = []
        for f in mesh.faces:
            for v in f.vertices:
                verts.append(v)

        # Uniquify & sort
        keys = {}
        for e in verts:
            keys[e] = 1
        verts = list(keys.keys())
        """

        verts = [v.index for v in mesh.vertices]
`

Original comment by yout...@mx47.de on 6 Feb 2012 at 10:43

This issue was closed by revision 1ff2e1701f2f.

Successfully tested on a sample model. Vertex out of range errors might still 
occur with clean-up enabled, but should be fixable with Vertices -> Remove 
doubles in Blender before export.

Original comment by codem...@gmx.de on 12 Feb 2012 at 10:00

  • Changed state: Fixed