minor changes to address bugs

[#8109] Incorrect header information in exported X3D Files
[#8110] Illegal characters in exported X3D files
This commit is contained in:
Campbell Barton 2008-01-19 21:52:09 +00:00
parent 231840a99f
commit e3b202d0b9

@ -162,8 +162,10 @@ class VRML2Export:
##########################################################
def writeHeader(self):
bfile = sys.expandpath(Blender.Get('filename'))
#bfile = sys.expandpath( Blender.Get('filename') ).replace('<', '&lt').replace('>', '&gt')
bfile = self.filename.replace('<', '&lt').replace('>', '&gt') # use outfile name
self.file.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
print "fooe"
self.file.write("<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.0//EN\" \"http://www.web3d.org/specifications/x3d-3.0.dtd\">\n")
self.file.write("<X3D version=\"3.0\" profile=\"Immersive\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema-instance\" xsd:noNamespaceSchemaLocation=\"http://www.web3d.org/specifications/x3d-3.0.xsd\">\n")
self.file.write("<head>\n")
@ -256,7 +258,7 @@ class VRML2Export:
headlight = "FALSE"
self.file.write("<NavigationInfo headlight=\"%s\" " % headlight)
self.file.write("visibilityLimit=\"%s\" " % (round(vislimit,self.cp)))
self.file.write("type=\"EXAMINE, ANY\" avatarSize=\"0.25, 1.75, 0.75\" />\n\n")
self.file.write("type=\"EXAMINE\", \"ANY\" avatarSize=\"0.25, 1.75, 0.75\" />\n\n")
def writeSpotLight(self, ob, lamp):
safeName = self.cleanStr(ob.name)
@ -404,7 +406,7 @@ class VRML2Export:
self.writeIndented("<Appearance>\n", 1)
# right now this script can only handle a single material per mesh.
if len(maters) >= 1:
mat=Blender.Material.Get(maters[0].name)
mat=maters[0]
matFlags = mat.getMode()
if not matFlags & Blender.Material.Modes['TEXFACE']:
self.writeMaterial(mat, self.cleanStr(maters[0].name,''))
@ -452,6 +454,7 @@ class VRML2Export:
for face in mesh.faces:
if face.smooth:
issmooth=1
break
if issmooth==1 and self.wire == 0:
creaseAngle=(mesh.getMaxSmoothAngle())*(math.pi/180.0)
self.file.write("creaseAngle=\"%s\" " % (round(creaseAngle,self.cp)))