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:
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
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue