Now actually fixed the bug with the normals.
pyassimp returned a list instead of a numpy array when the normals were empty. This also applies to texture coordinates and other stuff which is explicitly converted in _finalize_mesh.pull/64/head
parent
853a5f9bbc
commit
945231ba94
|
@ -313,7 +313,7 @@ def _finalize_mesh(mesh, target):
|
||||||
data = numpy.array([make_tuple(getattr(mesh, name)[i]) for i in range(nb_vertices)], dtype=numpy.float32)
|
data = numpy.array([make_tuple(getattr(mesh, name)[i]) for i in range(nb_vertices)], dtype=numpy.float32)
|
||||||
setattr(target, name[1:].lower(), data)
|
setattr(target, name[1:].lower(), data)
|
||||||
else:
|
else:
|
||||||
setattr(target, name[1:].lower(), [])
|
setattr(target, name[1:].lower(), numpy.array([], dtype="float32"))
|
||||||
|
|
||||||
def fillarray(name):
|
def fillarray(name):
|
||||||
mAttr = getattr(mesh, name)
|
mAttr = getattr(mesh, name)
|
||||||
|
|
|
@ -43,7 +43,7 @@ def main(filename=None):
|
||||||
print(" material id:" + str(mesh.materialindex+1))
|
print(" material id:" + str(mesh.materialindex+1))
|
||||||
print(" vertices:" + str(len(mesh.vertices)))
|
print(" vertices:" + str(len(mesh.vertices)))
|
||||||
print(" first 3 verts:\n" + str(mesh.vertices[:3]))
|
print(" first 3 verts:\n" + str(mesh.vertices[:3]))
|
||||||
if mesh.normals:
|
if mesh.normals.any():
|
||||||
print(" first 3 normals:\n" + str(mesh.normals[:3]))
|
print(" first 3 normals:\n" + str(mesh.normals[:3]))
|
||||||
else:
|
else:
|
||||||
print(" no normals")
|
print(" no normals")
|
||||||
|
|
Loading…
Reference in New Issue