glTF exporter: fix face domain attribute export

This commit is contained in:
Julien Duroure 2022-09-25 18:29:25 +02:00
parent 51e15a9db4
commit 33e87824dc
2 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 4, 23),
"version": (3, 4, 24),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -630,9 +630,15 @@ class PrimitiveCreator:
elif attr['blender_domain'] in ['FACE']:
if attr['len'] > 1:
data = data.reshape(-1, attr['len'])
data = data.repeat(4, axis=0)
# data contains face attribute, and is len(faces) long
# We need to dispatch these len(faces) attribute in each dots lines
data_attr = np.empty(self.dots.shape[0] * attr['len'], dtype=attr['type'])
data_attr = data_attr.reshape(-1, attr['len'])
for idx, poly in enumerate(self.blender_mesh.polygons):
data_attr[list(poly.loop_indices)] = data[idx]
data_attr = data_attr.reshape(-1, attr['len'])
for i in range(attr['len']):
self.dots[attr['gltf_attribute_name'] + str(i)] = data[:, i]
self.dots[attr['gltf_attribute_name'] + str(i)] = data_attr[:, i]
else:
print_console("ERROR", "domain not known")