diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2022-09-25 19:29:25 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2022-09-25 19:29:25 +0300 |
commit | 33e87824dc33ea92d2b19647b21e8a0d73e505f6 (patch) | |
tree | ec8f0c3676d07ac0b6a3bc162384a16536fbce74 | |
parent | 51e15a9db4ce463e01c291f6ec9152efe629bab5 (diff) |
glTF exporter: fix face domain attribute export
-rwxr-xr-x | io_scene_gltf2/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_gltf2/blender/exp/gltf2_blender_gather_primitives_extract.py | 10 |
2 files changed, 9 insertions, 3 deletions
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") |