66from io_mesh_w3d .w3x .io_xml import *
77from io_mesh_w3d .common .utils .helpers import get_objects
88
9+
910def format_str (value ):
1011 return '{:.3f}' .format (value )
1112
@@ -16,7 +17,7 @@ class ExportGeometryData(bpy.types.Operator, ExportHelper):
1617 bl_options = {'REGISTER' , 'UNDO' }
1718
1819 filename_ext = '.xml'
19-
20+
2021 def execute (self , context ):
2122 export_geometry_data (self , self .filepath )
2223 return {'FINISHED' }
@@ -30,7 +31,7 @@ def export_geometry_data(context, filepath):
3031 file = open (inifilepath , 'w' )
3132
3233 root = create_named_root ('Geometry' )
33- root .set ('isSmall' , str (False ));
34+ root .set ('isSmall' , str (False ))
3435
3536 index = 0
3637
@@ -68,7 +69,17 @@ def export_geometry_data(context, filepath):
6869
6970 create_vector (location , shape_node , 'Offset' )
7071 if (location .length > 0.01 ):
71- file .write ('\t GeometryOffset\t \t \t = X:' + format_str (location .x ) + ' Y:' + format_str (location .y ) + ' Z:' + format_str (location .z ) + '\n ' )
72+ file .write (
73+ '\t GeometryOffset\t \t \t = X:' +
74+ format_str (
75+ location .x ) +
76+ ' Y:' +
77+ format_str (
78+ location .y ) +
79+ ' Z:' +
80+ format_str (
81+ location .z ) +
82+ '\n ' )
7283
7384 file .write ('\n ' )
7485 index += 1
@@ -77,9 +88,19 @@ def export_geometry_data(context, filepath):
7788 contact_point_node = create_node (root , 'ContactPoint' )
7889 location , _ , _ = empty .matrix_world .decompose ()
7990 create_vector (location , contact_point_node , 'Pos' )
80- file .write ('\t GeometryContactPoint\t = X:' + format_str (location .x ) + ' Y:' + format_str (location .y ) + ' Z:' + format_str (location .z ) + '\n ' )
91+ file .write (
92+ '\t GeometryContactPoint\t = X:' +
93+ format_str (
94+ location .x ) +
95+ ' Y:' +
96+ format_str (
97+ location .y ) +
98+ ' Z:' +
99+ format_str (
100+ location .z ) +
101+ '\n ' )
81102
82103 write (root , filepath )
83104 file .close ()
84105 context .report ({'INFO' }, 'exporting geometry data finished' )
85- print ('exporting geometry data finished' )
106+ print ('exporting geometry data finished' )
0 commit comments