Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-17 19:30:16 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-17 19:44:23 +0300
commit4ecd2f7a5f13f170ff578e8e0e59f271dd8e5ccd (patch)
tree8c905ac9351688ff0067d6e42a1687d2e43219e4 /io_scene_x3d
parent850dfa2aa0549eb6c556b302b897aaa225dd55ca (diff)
Fix T49420: X3D Exporter generates duplicate edges and splits the mesh when exporting with Triangulate.
No point in splitting vertices over small differences in UVs or Color values. Note that there will still be splits when those UVs or colors actually do not match, but this seems to be part of 'triangulated' export design (otherwise we could use indexed values as with regular polygons export). Based on investigation by Sebastian Ullrich (@souljedi), thanks.
Diffstat (limited to 'io_scene_x3d')
-rw-r--r--io_scene_x3d/__init__.py2
-rw-r--r--io_scene_x3d/export_x3d.py13
2 files changed, 9 insertions, 6 deletions
diff --git a/io_scene_x3d/__init__.py b/io_scene_x3d/__init__.py
index 54377704..94ed224a 100644
--- a/io_scene_x3d/__init__.py
+++ b/io_scene_x3d/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "Web3D X3D/VRML2 format",
"author": "Campbell Barton, Bart, Bastien Montagne, Seva Alekseyev",
- "version": (2, 2, 0),
+ "version": (2, 2, 1),
"blender": (2, 80, 0),
"location": "File > Import-Export",
"description": "Import-Export X3D, Import VRML2",
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 7ab832d6..ff5ec0a3 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -708,6 +708,8 @@ def export(file,
slot_uv = None
slot_col = None
+ def _tuple_from_rounded_iter(it):
+ return tuple(round(v, 5) for v in it)
if is_uv and is_col:
slot_uv = 0
@@ -715,22 +717,22 @@ def export(file,
def vertex_key(lidx):
return (
- mesh_loops_uv[lidx].uv[:],
- mesh_loops_col[lidx].color[:],
+ _tuple_from_rounded_iter(mesh_loops_uv[lidx].uv),
+ _tuple_from_rounded_iter(mesh_loops_col[lidx].color),
)
elif is_uv:
slot_uv = 0
def vertex_key(lidx):
return (
- mesh_loops_uv[lidx].uv[:],
+ _tuple_from_rounded_iter(mesh_loops_uv[lidx].uv),
)
elif is_col:
slot_col = 0
def vertex_key(lidx):
return (
- mesh_loops_col[lidx].color[:],
+ _tuple_from_rounded_iter(mesh_loops_col[lidx].color),
)
else:
# ack, not especially efficient in this case
@@ -739,7 +741,6 @@ def export(file,
# build a mesh mapping dict
vertex_hash = [{} for i in range(len(mesh.vertices))]
- # worst case every face is a quad
face_tri_list = [[None, None, None] for i in range(len(mesh.loop_triangles))]
vert_tri_list = []
totvert = 0
@@ -762,6 +763,8 @@ def export(file,
face_tri_list[totface][:] = temp_tri[:]
totface += 1
+ del vertex_key
+ del _tuple_from_rounded_iter
assert(len(face_tri_list) == len(mesh.loop_triangles))
fw(ident_step + 'index="')