Print3D: Use Operator.report for Export tool

This commit is contained in:
Mikhail Rachinskiy 2019-09-22 12:20:40 +04:00
parent a1fd696188
commit 55b918828f
2 changed files with 6 additions and 7 deletions

View File

@ -52,7 +52,7 @@ def image_copy_guess(filepath, objects):
traceback.print_exc()
def write_mesh(context, info, report_cb):
def write_mesh(context, report_cb):
scene = context.scene
collection = context.collection
layer = context.view_layer
@ -190,11 +190,12 @@ def write_mesh(context, info, report_cb):
layer.objects.active = context_backup["active_object"]
if 'FINISHED' in ret:
info.append((f"{os.path.basename(filepath)!r} ok", None))
if report_cb is not None:
report_cb({'INFO'}, f"Exported: {filepath!r}")
return True
info.append((f"{os.path.basename(filepath)!r} fail", None))
if report_cb is not None:
report_cb({'ERROR'}, "Export failed")
return False

View File

@ -744,9 +744,7 @@ class MESH_OT_print3d_export(Operator):
def execute(self, context):
from . import export
info = []
ret = export.write_mesh(context, info, self.report)
report.update(*info)
ret = export.write_mesh(context, self.report)
if ret:
return {'FINISHED'}