Print3D: Use Operator.report for Export tool
This commit is contained in:
parent
a1fd696188
commit
55b918828f
|
@ -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
|
||||
|
|
|
@ -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'}
|
||||
|
|
Loading…
Reference in New Issue