diff options
author | Mikhail Rachinskiy <mikhail.rachinskiy@gmail.com> | 2021-05-14 14:12:47 +0300 |
---|---|---|
committer | Mikhail Rachinskiy <mikhail.rachinskiy@gmail.com> | 2021-05-14 14:12:47 +0300 |
commit | 8f1c831af6419c469f5da22e013e67163662b15d (patch) | |
tree | 32162360179e20948e6acbbe68e8cb0bcc7d3ed2 /object_print3d_utils/export.py | |
parent | bb16aba5bd3873794eefe167497118b6063b9a85 (diff) |
3D-Print: new export option Data Layers
Enables export of normals, UVs, vertex colors and materials for
formats that support it.
Disabled by default to reduce filesize.
Diffstat (limited to 'object_print3d_utils/export.py')
-rw-r--r-- | object_print3d_utils/export.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/object_print3d_utils/export.py b/object_print3d_utils/export.py index fc225ccc..2f846aaf 100644 --- a/object_print3d_utils/export.py +++ b/object_print3d_utils/export.py @@ -81,6 +81,7 @@ def write_mesh(context, report_cb): path_mode = 'COPY' if print_3d.use_export_texture else 'AUTO' export_path = bpy.path.abspath(print_3d.export_path) obj = layer.objects.active + export_data_layers = print_3d.use_data_layers # Create name 'export_path/blendname-objname' # add the filename component @@ -129,9 +130,13 @@ def write_mesh(context, report_cb): filepath = bpy.path.ensure_ext(filepath, ".ply") ret = bpy.ops.export_mesh.ply( filepath=filepath, + use_ascii=False, use_mesh_modifiers=True, use_selection=True, global_scale=global_scale, + use_normals=export_data_layers, + use_uv_coords=export_data_layers, + use_colors=export_data_layers, ) elif export_format == 'X3D': addon_ensure("io_scene_x3d") @@ -140,8 +145,9 @@ def write_mesh(context, report_cb): filepath=filepath, use_mesh_modifiers=True, use_selection=True, - path_mode=path_mode, global_scale=global_scale, + path_mode=path_mode, + use_normals=export_data_layers, ) elif export_format == 'OBJ': addon_ensure("io_scene_obj") @@ -150,16 +156,18 @@ def write_mesh(context, report_cb): filepath=filepath, use_mesh_modifiers=True, use_selection=True, - path_mode=path_mode, global_scale=global_scale, + path_mode=path_mode, + use_normals=export_data_layers, + use_uvs=export_data_layers, + use_materials=export_data_layers, ) else: assert 0 # for formats that don't support images - if export_format in {'STL', 'PLY'}: - if path_mode == 'COPY': - image_copy_guess(filepath, context.selected_objects) + if path_mode == 'COPY' and export_format in {'STL', 'PLY'}: + image_copy_guess(filepath, context.selected_objects) if 'FINISHED' in ret: if report_cb is not None: |