[Bf-extensions-cvs] [33e87824] master: glTF exporter: fix face domain attribute export
Julien Duroure
noreply at git.blender.org
Sun Sep 25 18:29:41 CEST 2022
Commit: 33e87824dc33ea92d2b19647b21e8a0d73e505f6
Author: Julien Duroure
Date: Sun Sep 25 18:29:25 2022 +0200
Branches: master
https://developer.blender.org/rBA33e87824dc33ea92d2b19647b21e8a0d73e505f6
glTF exporter: fix face domain attribute export
===================================================================
M io_scene_gltf2/__init__.py
M io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py
===================================================================
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 610c061a..5f40a81a 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -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',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py
index 74682ce7..3e69c2c8 100644
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py
@@ -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")
More information about the Bf-extensions-cvs
mailing list