Skip to content

Commit

Permalink
autopep8 action fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
feliwir authored and Tarcontar committed Jan 11, 2021
1 parent 3bac661 commit d9b5fe6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion io_mesh_w3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion io_mesh_w3d/common/utils/box_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
31 changes: 26 additions & 5 deletions io_mesh_w3d/geometry_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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'}
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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')
print('exporting geometry data finished')

0 comments on commit d9b5fe6

Please sign in to comment.