diff options
author | Chris Want <cwant@ualberta.ca> | 2006-07-19 17:05:11 +0400 |
---|---|---|
committer | Chris Want <cwant@ualberta.ca> | 2006-07-19 17:05:11 +0400 |
commit | 6122d501e745a359027a5c2c2bb533455011bd7a (patch) | |
tree | acc1b839174a6d474b1b167cd645a7ff48f002eb /release/scripts/vrml97_export.py | |
parent | f4737af50435b4f1dc0532a21b1f440994ca47b0 (diff) |
Converting a mesh object with modifiers to a temporary mesh during
export would cause a problem since the temporary meshes created
would often reuse the same name for many objects. This fix mangles
the object name and uses this for the temporary mesh name to avoid
this problem. (The naming is important, since vrml has 'DEF' and 'USE'
statements that are used like C macros, so if two meshes have the
same name the exporter will try to 'recycle' data to keep file sizes
low).
Diffstat (limited to 'release/scripts/vrml97_export.py')
-rw-r--r-- | release/scripts/vrml97_export.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/release/scripts/vrml97_export.py b/release/scripts/vrml97_export.py index 7ede86f6686..703460805da 100644 --- a/release/scripts/vrml97_export.py +++ b/release/scripts/vrml97_export.py @@ -476,6 +476,10 @@ class VRML2Export: if (len(ob.modifiers) > 0): me = Mesh.New() me.getFromObject(ob.name) + # Careful with the name, the temporary mesh may + # reuse the default name for other meshes. So we + # pick our own name. + me.name = "MOD_%s" % (ob.name) else: me = ob.getData(mesh = 1) @@ -535,9 +539,17 @@ class VRML2Export: if self.meshNames.has_key(meshName): self.writeIndented("USE ME_%s\n" % meshName, 0) self.meshNames[meshName]+=1 - return + if (self.verbose == 1): + print " Using Mesh %s (Blender mesh: %s)\n" % \ + (meshName, me.name) + return self.meshNames[meshName]=1 + if (self.verbose == 1): + print " Writing Mesh %s (Blender mesh: %s)\n" % \ + (meshName, me.name) + return + self.writeIndented("DEF ME_%s Group {\n" % meshName,1) self.writeIndented("children [\n", 1) |