diff --git a/io_mesh_w3d/__init__.py b/io_mesh_w3d/__init__.py index 79ccb9ca..be63c958 100644 --- a/io_mesh_w3d/__init__.py +++ b/io_mesh_w3d/__init__.py @@ -426,7 +426,7 @@ class TOOLS_PANEL_PT_w3d(bpy.types.Panel): bl_label = 'W3D Tools' bl_space_type = 'VIEW_3D' bl_region_type = 'UI' - + def draw(self, context): self.layout.operator('scene.export_geometry_data', icon='CUBE', text='Export Geometry Data') diff --git a/io_mesh_w3d/common/utils/box_export.py b/io_mesh_w3d/common/utils/box_export.py index ea5ce155..888b044c 100644 --- a/io_mesh_w3d/common/utils/box_export.py +++ b/io_mesh_w3d/common/utils/box_export.py @@ -17,7 +17,7 @@ def retrieve_boxes(container_name): name_=name, center=mesh_object.location) box_mesh = mesh_object.to_mesh(preserve_all_data_layers=False, depsgraph=None) - # TODO: use mesh_object.bound_box ? + # TODO: use mesh_object.bound_box ? box.extend = Vector( (box_mesh.vertices[0].co.x * 2, box_mesh.vertices[0].co.y * 2, diff --git a/io_mesh_w3d/geometry_export.py b/io_mesh_w3d/geometry_export.py index 7070915e..003c01ae 100644 --- a/io_mesh_w3d/geometry_export.py +++ b/io_mesh_w3d/geometry_export.py @@ -6,6 +6,7 @@ from io_mesh_w3d.w3x.io_xml import * from io_mesh_w3d.common.utils.helpers import get_objects + def format_str(value): return '{:.3f}'.format(value) @@ -16,7 +17,7 @@ class ExportGeometryData(bpy.types.Operator, ExportHelper): bl_options = {'REGISTER', 'UNDO'} filename_ext = '.xml' - + def execute(self, context): export_geometry_data(self, self.filepath) return {'FINISHED'} @@ -30,7 +31,7 @@ def export_geometry_data(context, filepath): file = open(inifilepath, 'w') root = create_named_root('Geometry') - root.set('isSmall', str(False)); + root.set('isSmall', str(False)) index = 0 @@ -68,7 +69,17 @@ def export_geometry_data(context, filepath): create_vector(location, shape_node, 'Offset') if (location.length > 0.01): - file.write('\tGeometryOffset\t\t\t= X:' + format_str(location.x) + ' Y:' + format_str(location.y) + ' Z:' + format_str(location.z) + '\n') + file.write( + '\tGeometryOffset\t\t\t= X:' + + format_str( + location.x) + + ' Y:' + + format_str( + location.y) + + ' Z:' + + format_str( + location.z) + + '\n') file.write('\n') index += 1 @@ -77,9 +88,19 @@ def export_geometry_data(context, filepath): contact_point_node = create_node(root, 'ContactPoint') location, _, _ = empty.matrix_world.decompose() create_vector(location, contact_point_node, 'Pos') - file.write('\tGeometryContactPoint\t= X:' + format_str(location.x) + ' Y:' + format_str(location.y) + ' Z:' + format_str(location.z) + '\n') + file.write( + '\tGeometryContactPoint\t= X:' + + format_str( + location.x) + + ' Y:' + + format_str( + location.y) + + ' Z:' + + format_str( + location.z) + + '\n') write(root, filepath) file.close() context.report({'INFO'}, 'exporting geometry data finished') - print('exporting geometry data finished') \ No newline at end of file + print('exporting geometry data finished')