[ui] Viewer3D: add support for vertex-colored meshes

Use PerVertexColorMaterial if any vertex color data is available on a mesh without textures.
This commit is contained in:
Yann Lanthony 2019-07-10 16:35:44 +02:00
parent d30b2364eb
commit cee8d1b612
No known key found for this signature in database
GPG key ID: 519FAE6DF7A70642
2 changed files with 17 additions and 1 deletions

View file

@ -45,6 +45,13 @@ class Scene3DHelper(QObject):
count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexPosition"])
return count / 3
@Slot(Qt3DCore.QEntity, result=int)
def vertexColorCount(self, entity):
count = 0
for geo in entity.findChildren(Qt3DRender.QGeometry):
count += sum([attr.count() for attr in geo.attributes() if attr.name() == "vertexColor"])
return count
class TrackballController(QObject):
"""