From 6ec69d523b2bea433f5fc94d7a21669bc9744d25 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 20 Jul 2016 13:05:45 +0200 Subject: [PATCH] Fixed reloading meshes for 3mf CURA-1622 --- cura/CuraApplication.py | 6 +++++- plugins/3MFReader/ThreeMFReader.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4715ff6009..361facc30c 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -851,7 +851,11 @@ class CuraApplication(QtApplication): def _reloadMeshFinished(self, job): # TODO; This needs to be fixed properly. We now make the assumption that we only load a single mesh! - job._node.setMeshData(job.getResult().getMeshData()) + mesh_data = job.getResult().getMeshData() + if mesh_data: + job._node.setMeshData(job.getResult().getMeshData()) + else: + Logger.log("w", "Could not find a mesh in reloaded node.") def _openFile(self, file): job = ReadMeshJob(os.path.abspath(file)) diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index 2a51e442da..57d76b2783 100644 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -111,6 +111,8 @@ class ThreeMFReader(MeshReader): if len(objects) > 1: group_decorator = GroupDecorator() result.addDecorator(group_decorator) + elif len(objects) == 1: + result = result.getChildren()[0] # Only one object found, return that. except Exception as e: Logger.log("e", "exception occured in 3mf reader: %s", e)