Fix T74934: exporting object with modifiers to X3D fails

The mesh name should be read-only.

Differential Revision: https://developer.blender.org/D7183
This commit is contained in:
Michalis Kamburelis 2020-03-27 00:40:33 +01:00 committed by Brecht Van Lommel
parent 91733dfff1
commit 6c3fbd669d
Notes: blender-bot 2023-02-14 18:58:55 +01:00
Referenced by issue #74934, Exporting an object with modifiers to X3D fails
1 changed files with 10 additions and 9 deletions

View File

@ -499,9 +499,9 @@ def export(file,
fw(ident_step + 'location="%.4f %.4f %.4f"\n' % location)
fw(ident_step + '/>\n')
def writeIndexedFaceSet(ident, obj, mesh, matrix, world):
def writeIndexedFaceSet(ident, obj, mesh, mesh_name, matrix, world):
obj_id = quoteattr(unique_name(obj, OB_ + obj.name, uuid_cache_object, clean_func=clean_def, sep="_"))
mesh_id = quoteattr(unique_name(mesh, ME_ + mesh.name, uuid_cache_mesh, clean_func=clean_def, sep="_"))
mesh_id = quoteattr(unique_name(mesh, ME_ + mesh_name, uuid_cache_mesh, clean_func=clean_def, sep="_"))
mesh_id_group = prefix_quoted_str(mesh_id, group_)
mesh_id_coords = prefix_quoted_str(mesh_id, 'coords_')
mesh_id_normals = prefix_quoted_str(mesh_id, 'normals_')
@ -1436,20 +1436,21 @@ def export(file,
# ensure unique name, we could also do this by
# postponing mesh removal, but clearing data - TODO
if do_remove:
me.name = obj.name.rstrip("1234567890").rstrip(".")
me_name_new = me_name_org = me.name
me_name_new = me_name_original = obj.name.rstrip("1234567890").rstrip(".")
count = 0
while me_name_new in mesh_name_set:
me.name = "%.17s.%03d" % (me_name_org, count)
me_name_new = me.name
me_name_new = "%.17s.%03d" % (me_name_original, count)
count += 1
mesh_name_set.add(me_name_new)
del me_name_new, me_name_org, count
mesh_name = me_name_new
del me_name_new, me_name_original, count
else:
mesh_name = me.name
# done
writeIndexedFaceSet(ident, obj, me, obj_matrix, world)
writeIndexedFaceSet(ident, obj, me, mesh_name, obj_matrix, world)
# free mesh created with create_mesh()
# free mesh created with to_mesh()
if do_remove:
obj_for_mesh.to_mesh_clear()