[Bf-committers] First Beta of X3D exporter

Campbell Barton cbarton at metavr.com
Thu May 5 14:01:41 CEST 2005


Hi Bart, sorry to give only neg- feedback (BTW What can I use to view 
the files?) But some python advice.

Tabs are re-generated for each line; this is not effisient.
There are 2 good options.
Have a generated list of tabs thats the length of the maximum tab length 
of a scene. then just index it.
Or do the same, but check the length each time and append a new 
tabstring (The previous tab item + '\t') if its not long enough.

The latter is failsafe, where as with the first you need to be sure of 
the number of indexts. Mabe throw in an extra 10 juts to be safe. :)

Also, if the format is for display/rendering (Rather then editing) Id go 
for GetRawFromObject() over .getData() as bones and subsurf wont be 
exported.

Also your teansforming each vertex by the matrix. Its much faster (over 
100 times) to do
mesh.transfrom(martix) - Tho If you want to keep 2.36 compatibility its 
not an option (having a try statement for this would be fine.)

Rather then using round() to limit the floating point string, There are 
string formatting options
 >> print '%.3f' % 0.12423432543 # Will round to 3 decimal places
 >> 0.124
...though I'd recomment keeping to 6 decimal places unless otherwise 
spesified in the file spec.


Then again, theres a lot more to an exporter then efficiency, so good 
work and hope this can be a good defacto 3d format we can all use :)


- Cam

Bart wrote:
> 
> The first beta of the x3d exporter is available:
> http://www.neeneenee.de/blender/x3d/x3d_export150.py.txt
> 
> It has the same features like the new VRML97 exporter version 
> 2005/04/20: http://www.neeneenee.de/blender/x3d/vrml97_export150.py.txt).
> 
> Known bugs this time:
> - DEF/USE work not correct
> - Grouping nodes like Billboard and Collision will be inserted as
>     in VRML syntax
> 
> Documentation:
> http://www.neeneenee.de/blender/x3d/exporting_web3d.html
> 
> Will finish it soon so it can be bundeled with Blender 2.37.
> 

-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241


More information about the Bf-committers mailing list