[Bf-extensions-cvs] [6c3fbd66] master: Fix T74934: exporting object with modifiers to X3D fails

Michalis Kamburelis noreply at git.blender.org
Fri Mar 27 00:42:52 CET 2020


Commit: 6c3fbd669d233452d9970cb95b2695c45d78e626
Author: Michalis Kamburelis
Date:   Fri Mar 27 00:40:33 2020 +0100
Branches: master
https://developer.blender.org/rBA6c3fbd669d233452d9970cb95b2695c45d78e626

Fix T74934: exporting object with modifiers to X3D fails

The mesh name should be read-only.

Differential Revision: https://developer.blender.org/D7183

===================================================================

M	io_scene_x3d/export_x3d.py

===================================================================

diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index a9d694d6..517146cb 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -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()



More information about the Bf-extensions-cvs mailing list