From a53e56e282df3359f0fc2c4ad5f71f916d1e7f74 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 5 Jun 2015 13:25:04 +0200 Subject: [PATCH] Handle finished signal for the ReadMeshJob started from command line args This puts the actual mesh into the scene rather than just loading it and discarding it afterwards. Now file arguments supplied to the application actually work. Fixes "Open With" on Windows and the related Asana issue. --- cura/CuraApplication.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index f6d41a51c8..55e1e466a4 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -162,6 +162,7 @@ class CuraApplication(QtApplication): for file in self.getCommandLineOption("file", []): job = ReadMeshJob(os.path.abspath(file)) + job.finished.connect(self._onFileLoaded) job.start() self.exec_() @@ -447,3 +448,15 @@ class CuraApplication(QtApplication): def _onMessageActionTriggered(self, message, action): if action == "eject": self.getStorageDevice("LocalFileStorage").ejectRemovableDrive(message._sdcard) + + def _onFileLoaded(self, job): + mesh = job.getResult() + if mesh != None: + node = SceneNode() + + node.setSelectable(True) + node.setMeshData(mesh) + node.setName(os.path.basename(job.getFileName())) + + op = AddSceneNodeOperation(node, self.getController().getScene().getRoot()) + op.push()