[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14630] trunk/blender/release/scripts/ x3d_export.py: fix for bugs

Campbell Barton ideasman42 at gmail.com
Thu May 1 00:30:59 CEST 2008


Revision: 14630
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14630
Author:   campbellbarton
Date:     2008-05-01 00:30:52 +0200 (Thu, 01 May 2008)

Log Message:
-----------
fix for bugs
[bf-blender-Bug Tracker][6693] x3d export bug in V2.44 release
[bf-blender-Bug Tracker][7773] .x3d exporter problems (moving meshes away)
Updated how objects are transformed, and use Mesh rather then NMesh.
also removed vertex color saving since it was really slow and vcolors are stored per face in blender.

Modified Paths:
--------------
    trunk/blender/release/scripts/x3d_export.py

Modified: trunk/blender/release/scripts/x3d_export.py
===================================================================
--- trunk/blender/release/scripts/x3d_export.py	2008-04-30 19:58:44 UTC (rev 14629)
+++ trunk/blender/release/scripts/x3d_export.py	2008-04-30 22:30:52 UTC (rev 14630)
@@ -1,15 +1,12 @@
 #!BPY
 """ Registration info for Blender menus:
 Name: 'X3D Extensible 3D (.x3d)...'
-Blender: 235
+Blender: 245
 Group: 'Export'
-Submenu: 'All Objects...' all
-Submenu: 'All Objects compressed...' comp
-Submenu: 'Selected Objects...' selected
-Tooltip: 'Export to Extensible 3D file (.x3d)'
+Tooltip: 'Export selection to Extensible 3D file (.x3d)'
 """
 
-__author__ = ("Bart")
+__author__ = ("Bart", "Campbell Barton")
 __email__ = ["Bart, bart:neeneenee*de"]
 __url__ = ["Author's (Bart) homepage, http://www.neeneenee.de/vrml"]
 __version__ = "2006/01/17"
@@ -22,10 +19,9 @@
 want to export only selected or all relevant objects.
 
 Known issues:<br>
-    Doesn't handle multiple materials (don't use material indices);<br>
-    Doesn't handle multiple UV textures on a single mesh (create a mesh
-for each texture);<br>
-    Can't get the texture array associated with material * not the UV ones;
+	Doesn't handle multiple materials (don't use material indices);<br>
+	Doesn't handle multiple UV textures on a single mesh (create a mesh for each texture);<br>
+	Can't get the texture array associated with material * not the UV ones;
 """
 
 
@@ -58,953 +54,903 @@
 ####################################
 
 import Blender
-from Blender import Object, NMesh, Lamp, Draw, Image, Text, sys
+from Blender import Object, Lamp, Draw, Image, Text, sys, Mesh
 from Blender.Scene import Render
 import math
 
+# 
+DEG2RAD=0.017453292519943295
+MATWORLD= Blender.Mathutils.RotationMatrix(-90, 4, 'x')
+
 ####################################
 # Global Variables
 ####################################
 
-scene = Blender.Scene.GetCurrent()
-world = Blender.World.GetCurrent() 
-worldmat = Blender.Texture.Get()
 filename = Blender.Get('filename')
 _safeOverwrite = True
 ARG=''
 extension = ''
 
-class DrawTypes:
-    """Object DrawTypes enum values
-    BOUNDS - draw only the bounding box of the object
-    WIRE - draw object as a wire frame
-    SOLID - draw object with flat shading
-    SHADED - draw object with OpenGL shading
-"""
-    BOUNDBOX  = 1
-    WIRE      = 2
-    SOLID     = 3
-    SHADED    = 4
-    TEXTURE   = 5
-
-if not hasattr(Blender.Object,'DrawTypes'):
-    Blender.Object.DrawTypes = DrawTypes()
-
 ##########################################################
 # Functions for writing output file
 ##########################################################
 
 class VRML2Export:
 
-    def __init__(self, filename):
-        #--- public you can change these ---
-        self.writingcolor = 0
-        self.writingtexture = 0
-        self.writingcoords = 0
-        self.wire = 0
-        self.proto = 1
-        self.matonly = 0
-        self.share = 0
-        self.billnode = 0
-        self.halonode = 0
-        self.collnode = 0
-        self.tilenode = 0
-        self.verbose=2     # level of verbosity in console 0-none, 1-some, 2-most
-        self.cp=3          # decimals for material color values     0.000 - 1.000
-        self.vp=3          # decimals for vertex coordinate values  0.000 - n.000
-        self.tp=3          # decimals for texture coordinate values 0.000 - 1.000
-        self.it=3
-        
-        #--- class private don't touch ---
-        self.texNames={}   # dictionary of textureNames
-        self.matNames={}   # dictionary of materiaNames
-        self.meshNames={}   # dictionary of meshNames
-        self.indentLevel=0 # keeps track of current indenting
-        self.filename=filename
-        self.file = open(filename, "w")
-        self.bNav=0
-        self.nodeID=0
-        self.namesReserved=[ "Anchor","Appearance","Arc2D","ArcClose2D","AudioClip","Background","Billboard",
-                             "BooleanFilter","BooleanSequencer","BooleanToggle","BooleanTrigger","Box","Circle2D",
-                             "Collision","Color","ColorInterpolator","ColorRGBA","component","Cone","connect",
-                             "Contour2D","ContourPolyline2D","Coordinate","CoordinateDouble","CoordinateInterpolator",
-                             "CoordinateInterpolator2D","Cylinder","CylinderSensor","DirectionalLight","Disk2D",
-                             "ElevationGrid","EspduTransform","EXPORT","ExternProtoDeclare","Extrusion","field",
-                             "fieldValue","FillProperties","Fog","FontStyle","GeoCoordinate","GeoElevationGrid",
-                             "GeoLocationLocation","GeoLOD","GeoMetadata","GeoOrigin","GeoPositionInterpolator",
-                             "GeoTouchSensor","GeoViewpoint","Group","HAnimDisplacer","HAnimHumanoid","HAnimJoint",
-                             "HAnimSegment","HAnimSite","head","ImageTexture","IMPORT","IndexedFaceSet",
-                             "IndexedLineSet","IndexedTriangleFanSet","IndexedTriangleSet","IndexedTriangleStripSet",
-                             "Inline","IntegerSequencer","IntegerTrigger","IS","KeySensor","LineProperties","LineSet",
-                             "LoadSensor","LOD","Material","meta","MetadataDouble","MetadataFloat","MetadataInteger",
-                             "MetadataSet","MetadataString","MovieTexture","MultiTexture","MultiTextureCoordinate",
-                             "MultiTextureTransform","NavigationInfo","Normal","NormalInterpolator","NurbsCurve",
-                             "NurbsCurve2D","NurbsOrientationInterpolator","NurbsPatchSurface",
-                             "NurbsPositionInterpolator","NurbsSet","NurbsSurfaceInterpolator","NurbsSweptSurface",
-                             "NurbsSwungSurface","NurbsTextureCoordinate","NurbsTrimmedSurface","OrientationInterpolator",
-                             "PixelTexture","PlaneSensor","PointLight","PointSet","Polyline2D","Polypoint2D",
-                             "PositionInterpolator","PositionInterpolator2D","ProtoBody","ProtoDeclare","ProtoInstance",
-                             "ProtoInterface","ProximitySensor","ReceiverPdu","Rectangle2D","ROUTE","ScalarInterpolator",
-                             "Scene","Script","Shape","SignalPdu","Sound","Sphere","SphereSensor","SpotLight","StaticGroup",
-                             "StringSensor","Switch","Text","TextureBackground","TextureCoordinate","TextureCoordinateGenerator",
-                             "TextureTransform","TimeSensor","TimeTrigger","TouchSensor","Transform","TransmitterPdu",
-                             "TriangleFanSet","TriangleSet","TriangleSet2D","TriangleStripSet","Viewpoint","VisibilitySensor",
-                             "WorldInfo","X3D","XvlShell","VertexShader","FragmentShader","MultiShaderAppearance","ShaderAppearance" ]
-        self.namesStandard=[ "Empty","Empty.000","Empty.001","Empty.002","Empty.003","Empty.004","Empty.005",
-                             "Empty.006","Empty.007","Empty.008","Empty.009","Empty.010","Empty.011","Empty.012",
-                             "Scene.001","Scene.002","Scene.003","Scene.004","Scene.005","Scene.06","Scene.013",
-                             "Scene.006","Scene.007","Scene.008","Scene.009","Scene.010","Scene.011","Scene.012",
-                             "World","World.000","World.001","World.002","World.003","World.004","World.005" ]
-        self.namesFog=[ "","LINEAR","EXPONENTIAL","" ]
+	def __init__(self, filename):
+		#--- public you can change these ---
+		self.writingcolor = 0
+		self.writingtexture = 0
+		self.writingcoords = 0
+		self.proto = 1
+		self.matonly = 0
+		self.share = 0
+		self.billnode = 0
+		self.halonode = 0
+		self.collnode = 0
+		self.tilenode = 0
+		self.verbose=2	 # level of verbosity in console 0-none, 1-some, 2-most
+		self.cp=3		  # decimals for material color values	 0.000 - 1.000
+		self.vp=3		  # decimals for vertex coordinate values  0.000 - n.000
+		self.tp=3		  # decimals for texture coordinate values 0.000 - 1.000
+		self.it=3
+		
+		#--- class private don't touch ---
+		self.texNames={}   # dictionary of textureNames
+		self.matNames={}   # dictionary of materiaNames
+		self.meshNames={}   # dictionary of meshNames
+		self.indentLevel=0 # keeps track of current indenting
+		self.filename=filename
+		self.file = open(filename, "w")
+		self.bNav=0
+		self.nodeID=0
+		self.namesReserved=[ "Anchor","Appearance","Arc2D","ArcClose2D","AudioClip","Background","Billboard",
+							 "BooleanFilter","BooleanSequencer","BooleanToggle","BooleanTrigger","Box","Circle2D",
+							 "Collision","Color","ColorInterpolator","ColorRGBA","component","Cone","connect",
+							 "Contour2D","ContourPolyline2D","Coordinate","CoordinateDouble","CoordinateInterpolator",
+							 "CoordinateInterpolator2D","Cylinder","CylinderSensor","DirectionalLight","Disk2D",
+							 "ElevationGrid","EspduTransform","EXPORT","ExternProtoDeclare","Extrusion","field",
+							 "fieldValue","FillProperties","Fog","FontStyle","GeoCoordinate","GeoElevationGrid",
+							 "GeoLocationLocation","GeoLOD","GeoMetadata","GeoOrigin","GeoPositionInterpolator",
+							 "GeoTouchSensor","GeoViewpoint","Group","HAnimDisplacer","HAnimHumanoid","HAnimJoint",
+							 "HAnimSegment","HAnimSite","head","ImageTexture","IMPORT","IndexedFaceSet",
+							 "IndexedLineSet","IndexedTriangleFanSet","IndexedTriangleSet","IndexedTriangleStripSet",
+							 "Inline","IntegerSequencer","IntegerTrigger","IS","KeySensor","LineProperties","LineSet",
+							 "LoadSensor","LOD","Material","meta","MetadataDouble","MetadataFloat","MetadataInteger",
+							 "MetadataSet","MetadataString","MovieTexture","MultiTexture","MultiTextureCoordinate",
+							 "MultiTextureTransform","NavigationInfo","Normal","NormalInterpolator","NurbsCurve",
+							 "NurbsCurve2D","NurbsOrientationInterpolator","NurbsPatchSurface",
+							 "NurbsPositionInterpolator","NurbsSet","NurbsSurfaceInterpolator","NurbsSweptSurface",
+							 "NurbsSwungSurface","NurbsTextureCoordinate","NurbsTrimmedSurface","OrientationInterpolator",
+							 "PixelTexture","PlaneSensor","PointLight","PointSet","Polyline2D","Polypoint2D",
+							 "PositionInterpolator","PositionInterpolator2D","ProtoBody","ProtoDeclare","ProtoInstance",

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list